iankelling.org
/
git
/
distro-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix ssh wrapper
[distro-setup]
/
primary-setup
diff --git
a/primary-setup
b/primary-setup
index d6c0ed9ec4cf8ea43d64d2312fe0f50a46b23532..cc335d124814c42b80f849c29753b11a11da59ac 100755
(executable)
--- a/
primary-setup
+++ b/
primary-setup
@@
-3,31
+3,37
@@
# usage $0 [MAIL_HOST]
# setup things which involve being the primary host or not
# 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
+source /usr/local/lib/err
+
+pre="${0##*/}:"
+m() { printf "$pre %s\n" "$*"; "$@"; }
+e() { printf "$pre %s\n" "$*"; }
+err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; }
if [[ $EUID == 0 && ! $SUDO_USER ]]; then
if [[ $EUID == 0 && ! $SUDO_USER ]]; then
- e
cho "$0: error:
requires running as nonroot or sudo"
+ e
rr "
requires running as nonroot or sudo"
exit 1
fi
if [[ $1 ]]; then
new_host=$1
exit 1
fi
if [[ $1 ]]; then
new_host=$1
- sed -ri "s/MAIL_HOST=.*/MAIL_HOST=$new_host/" /a/bin/bash_unpublished/source-state
+
m
sed -ri "s/MAIL_HOST=.*/MAIL_HOST=$new_host/" /a/bin/bash_unpublished/source-state
source /a/bin/bash_unpublished/source-state
fi
if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
# arbtt disabled for now
#DISPLAY=:0 arbtt-capture --sample-rate=10 &
source /a/bin/bash_unpublished/source-state
fi
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
+ m sudo systemctl start rss2email.timer
+ m sudo systemctl enable rss2email.timer
+ m sudo systemctl start btrbk.timer
+ m sudo systemctl enable btrbk.timer
else
else
- sudo systemctl stop rss2email.timer
- sudo systemctl stop rss2email.service
- sudo systemctl disable rss2email.timer
+
m
sudo systemctl stop rss2email.timer
+
m
sudo systemctl stop rss2email.service
+
m
sudo systemctl disable rss2email.timer
# arbtt disabled for now
# for ((i=0; i<10; i++)); do
# killall arbtt-capture || break
# arbtt disabled for now
# for ((i=0; i<10; i++)); do
# killall arbtt-capture || break
@@
-38,6
+44,6
@@
else
# done
fi
# done
fi
-/a/exe/mail-setup
+
m
/a/exe/mail-setup
exit 0
:
exit 0
: