diff --git a/borg-backup.homeserver.sh b/borg-backup.homeserver.sh index f292f42..8e23d5a 100755 --- a/borg-backup.homeserver.sh +++ b/borg-backup.homeserver.sh @@ -4,7 +4,7 @@ export BORG_REPO=/srv/data/backup/borg/homeserver # See the section "Passphrase notes" for more infos. -export BORG_PASSPHRASE="$(cat /root/secret/borg-homeserver.key)" +export BORG_PASSPHRASE="$(cat /root/secret/borg/borg-homeserver.key)" # some helpers and error handling: info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } diff --git a/download-with-sftp.sh b/download-with-sftp.sh index bdce71e..c370571 100755 --- a/download-with-sftp.sh +++ b/download-with-sftp.sh @@ -19,7 +19,8 @@ borg check -v data/backup/borg/snowboard status_check=$? echo "finished checking the downloaded repo. Status: $status_check" if [ "$status_check" -eq "0" ]; then - chown fileserver:fileserver $REPO_DIR/$backupdir + cd $REPO_ROOT + chown fileserver:fileserver $backupdir rm -r old else echo "the new repo was not checked successfully, keeping old repo." diff --git a/mount-docker-sockets.sh b/mount-docker-sockets.sh new file mode 100755 index 0000000..d5845e8 --- /dev/null +++ b/mount-docker-sockets.sh @@ -0,0 +1,25 @@ +#!/bin/bash +TARGET=/var/run/docker-snowboard.socket +MAX_FAILS=10 +SLEEP_TIME=2 + +echo "removing $TARGET" +rm /var/run/docker-snowboard.sock -rf +echo "relaying snowboards socket with ssh" +ssh -nNT -L /var/run/docker-snowboard.sock:/var/run/docker.sock root@cscherr.de & + +# check if the target is a socket, and adjust it. +for ((i=0; i<=MAX_FAILS; i++)); do + if [[ $(file -b /var/run/docker-snowboard.sock) = 'socket' ]]; then + set -e + echo "$TARGET is a socket, adjusting permissions" + chmod 660 /var/run/docker-snowboard.sock + chgrp docker /var/run/docker-snowboard.sock + exit 0 # good end + else + echo "$i: $TARGET is not a socket" + fi + sleep $SLEEP_TIME +done +echo "$TARGET is not a socket even after waiting" +exit 1 # bad end diff --git a/tailscale.sh b/tailscale.sh new file mode 100644 index 0000000..dbc2043 --- /dev/null +++ b/tailscale.sh @@ -0,0 +1,5 @@ +#!/bin/bash +tailscale up \ + --login-server https://vpn.cscherr.de \ + --advertise-exit-node \ + --accept-risk=lose-ssh