From: Ian Kelling Date: Wed, 9 Oct 2024 05:43:02 +0000 (-0400) Subject: bug fix X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=9bdd6f81040ad71e300ac4ffdd5cb1cc4686107e;p=distro-setup bug fix --- 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