# 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
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