📥️ Various nice improvements

This commit is contained in:
2022-12-19 13:59:24 +01:00
parent 92a48a403b
commit bc0dd6487f
16 changed files with 71 additions and 52 deletions

View File

@@ -1,13 +1,14 @@
#!/bin/sh
which lsd>/dev/null
if [ "$?" = "0" ]; then
alias ls="lsd -h --color=auto --group-dirs first"
else
([ $? -eq 0 ] && \
alias ls="lsd -h --color=auto --group-dirs first") || \
alias ls="ls -h --color=auto --group-directories-first"
fi
# ([ "$?" = "0" ] && \
# alias ls="lsd -h --color=auto --group-dirs first") || \
# if [ $? -eq 0 ]; then
# alias ls="lsd -h --color=auto --group-dirs first"
# else
# alias ls="ls -h --color=auto --group-directories-first"
# fi
which doas>/dev/null && [ $? -eq 0 ] && alias doas="sudo"
alias\
ll="ls -l"\
la="ls -a"\

21
roles/shell/files/bin/vault.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
[ -z "$REMOTE" ] && REMOTE=siv@archy.42069.no:/home/coder
run_rsync() {
rsync "$1" "$2" "$3"
[ $? -eq 12 ] && echo -e "\e[0;31mRsync is missing on the remote server!\e[0," && exit 0
}
pull() {
run_rsync "$1" "$3" "$2"
}
push() {
run_rsync "$1" "$2" "$3"
}
sync() {
pull "$1" "$2" "$3"
push "$1" "$2" "$3"
}
case "$1" in
mount) cryfs ~/.vault ~/vault -o allow_root ;;
push|pull|sync) $1 "-aze ssh" "$HOME/.vault" "$REMOTE" ;;
*) echo "Usage: $0 [ push | pull | sync | mount ]" ;;
esac