X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=primary-setup;h=09ae728bc6c02c13a7b61fbab1951da362023154;hb=12e7a0f3de4f4f1b1f8e56e7cbe2e972027e0a42;hp=1a6ce0e05158124c1078040fdf24b1ab7f6cf068;hpb=6561b24248188e5bce423acab25c2c14c7e5ce6d;p=distro-setup diff --git a/primary-setup b/primary-setup index 1a6ce0e..09ae728 100755 --- a/primary-setup +++ b/primary-setup @@ -1,11 +1,16 @@ #!/bin/bash # usage $0 [MAIL_HOST] +# setup things which involve being the primary host or not set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -# setup things which involve being the primary host or not + +if [[ $EUID == 0 && ! $SUDO_USER ]]; then + echo "$0: error: requires running as nonroot or sudo" + exit 1 +fi if [[ $1 ]]; then new_host=$1 @@ -13,11 +18,13 @@ if [[ $1 ]]; then source /a/bin/bash_unpublished/source-state fi -if [[ $HOSTNAME == $MAIL_HOST ]]; then +if [[ $HOSTNAME == "$MAIL_HOST" ]]; then # arbtt disabled for now #DISPLAY=:0 arbtt-capture --sample-rate=10 & sudo systemctl start rss2email.timer sudo systemctl enable rss2email.timer + sudo systemctl start btrbk.timer + sudo systemctl enable btrbk.timer else sudo systemctl stop rss2email.timer