📥️ Various nice improvements
This commit is contained in:
21
roles/shell/files/bin/vault.sh
Executable file
21
roles/shell/files/bin/vault.sh
Executable 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
|
Reference in New Issue
Block a user