From 9bdd6f81040ad71e300ac4ffdd5cb1cc4686107e Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 9 Oct 2024 01:43:02 -0400 Subject: [PATCH] bug fix --- filesystem/usr/local/bin/prof-backup | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/filesystem/usr/local/bin/prof-backup b/filesystem/usr/local/bin/prof-backup index 41a30ec..b57625c 100755 --- a/filesystem/usr/local/bin/prof-backup +++ b/filesystem/usr/local/bin/prof-backup @@ -38,6 +38,9 @@ # ssh root@kdwg.b8.nz systemctl --now enable profanity if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi + +[[ $EUID == 1000 ]] || exec sudo -u iank "${BASH_SOURCE[0]}" "$@" + source /a/bin/bash-bear-trap/bash-bear source /a/bin/bash_unpublished/source-state @@ -48,15 +51,15 @@ if [[ $HOSTNAME != "$HOST2" ]]; then exit 0 fi -case $HOSTNAME in - kd) - if systemctl --quiet is-active profanity; then - rsync /d/p/profanity{,-config} /p - fi - ;; - *) - if ssh iank@b8.nz systemctl --user --quiet is-active profanity; then - rsync -a b8.nz:/d/p/profanity{,-config} /p - fi - ;; -esac +source /p/c/domain-info + +if [[ $HOSTNAME != $d_host ]]; then + shell_pre="ssh iank@b8.nz" + rsync_pre=b8.nz: +fi + +if $shell_pre systemctl --user --quiet is-active profanity; then + rsync -a $rsync_pre/d/p/profanity{,-config} /p +elif [[ -t 0 ]]; then + echo "profanity service not active. doing nothing" +fi -- 2.30.2