updated stuff
This commit is contained in:
parent
638dc45020
commit
586aa3b5e7
10 changed files with 82 additions and 37 deletions
|
@ -2,13 +2,6 @@ alias ls='exa -al --color=always --group-directories-first'
|
|||
alias la='exa -a --color=always --group-directories-first'
|
||||
alias ll='exa -l --color=always --group-directories-first'
|
||||
alias lt='exa -aT --color=always --group-directories-first'
|
||||
alias lg='ls --git'
|
||||
|
||||
alias grep='grep --color'
|
||||
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
|
||||
|
||||
alias fd='find . -type d -name'
|
||||
alias ff='find . -type f -name'
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
|
|
|
@ -1,36 +1,65 @@
|
|||
# Docker
|
||||
_appup_docker () {
|
||||
if hash docker-compose >/dev/null 2>&1; then
|
||||
if hash docker-machine >/dev/null 2>&1; then
|
||||
if docker-machine status | grep -qi "Stopped"; then
|
||||
read -q "REPLY?Docker Machine is not running, would you like to start it? [y/n] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
docker-machine start default && eval $(docker-machine env default)
|
||||
# Check if docker has been started
|
||||
if [ "${APPUP_CHECK_STARTED:-true}" = true ]; then
|
||||
if hash docker-machine >/dev/null 2>&1 && [ "${APPUP_DOCKER_MACHINE:-true}" = true ]; then
|
||||
if docker-machine status | grep -qi "Stopped"; then
|
||||
read -r -k 1 "REPLY?Docker Machine is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
docker-machine start default && eval $(docker-machine env default)
|
||||
echo ""
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
elif docker ps 2>&1 | grep -qi "Is the docker daemon running?"; then
|
||||
read -r -k 1 "REPLY?Docker for Mac is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
open -a Docker
|
||||
|
||||
echo ""
|
||||
echo "Waiting for docker to start.."
|
||||
echo ""
|
||||
|
||||
# Wait for it to start
|
||||
while true; do
|
||||
if docker ps 2>&1 | grep -qi "Is the docker daemon running?" || docker ps 2>&1 | grep -qi "connection refused"; then
|
||||
sleep 5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
return
|
||||
return0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check YAML extension
|
||||
compose_file=''
|
||||
compose_project_file=''
|
||||
|
||||
|
||||
if [ -e "docker-compose.yml" ]; then
|
||||
compose_file='docker-compose.yml'
|
||||
elif [ -e "docker-compose.yaml" ]; then
|
||||
compose_file='docker-compose.yaml'
|
||||
fi
|
||||
|
||||
|
||||
# <cmd> <project name> will look for docker-compose.<project name>.yml
|
||||
if [ -n "$2" ]; then
|
||||
if [ -e "docker-compose.$2.yml" ]; then
|
||||
compose_project_file="docker-compose.$2.yml"
|
||||
elif [ -e "docker-compose.$2.yaml" ]; then
|
||||
compose_project_file="docker-compose.$2.yaml"
|
||||
fi
|
||||
|
||||
if [ -n "$compose_project_file" ]; then
|
||||
|
||||
if [ -n "$compose_project_file" ]; then
|
||||
# Override project name from custom env
|
||||
if [ -e ".env.$2" ]; then
|
||||
project=$(source ".env.$2"; echo $COMPOSE_PROJECT_NAME)
|
||||
|
||||
|
@ -51,6 +80,7 @@ _appup_docker () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Vagrant
|
||||
_appup_vagrant () {
|
||||
if hash vagrant >/dev/null 2>&1; then
|
||||
vagrant $1 "${@:2}"
|
||||
|
@ -59,6 +89,7 @@ _appup_vagrant () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Commands
|
||||
up () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker up "$@"
|
||||
|
@ -108,4 +139,3 @@ stop () {
|
|||
env stop "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -40,14 +40,24 @@ extract() {
|
|||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zst|*.tzst)
|
||||
tar --zstd --help &> /dev/null \
|
||||
&& tar --zstd -xvf "$1" \
|
||||
|| zstdcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
|
||||
(*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
|
||||
(*.lz4) lz4 -d "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
|
@ -58,6 +68,7 @@ extract() {
|
|||
cd ..; rm *.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*.zst) unzstd "$1" ;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
|
|
|
@ -3,6 +3,3 @@ cmds=(status show start stop reload restart enable disable daemon-reload)
|
|||
for cmd in $cmds; do
|
||||
alias sc-$cmd="sudo systemctl $cmd"
|
||||
done
|
||||
|
||||
alias sc-enablenow="sc-enable --now"
|
||||
alias sc-disablenow="sc-disable --now"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue