switch-mail-host $HOSTNAME $1 | pee cat "systemd-cat -t switch-mail-host"
}
lipush() {
- rsync $@ --delete-excluded -ahviSAXPH --specials --devices --delete --relative \
- --exclude-from=/p/c/li-rsync-excludes /a/bin /a/exe /a/h /a/c /p/c/machine_specific/li /a/opt/{emacs,emacs-debianstable,mu} root@iankelling.org:/
- rsync -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments
+ # note, i had --delete-excluded, but that deletes all files in --exclude-from on
+ # the remote site, which doesn't make sense, so not sure why i had it.
+ local p a
+ p=(/a/bin /a/exe /a/h /a/c /p/c/machine_specific/linode{,.hosts} /a/opt/{emacs,emacs-debianstable,mu})
+ a="-ahviSAXPH --specials --devices --delete --relative --exclude-from=/p/c/li-rsync-excludes"
+ rsync $@ $a ${p[@]} root@l2.b8.nz:/
+ rsync $@ $a ${p[@]} /p/c/machine_specific/li root@iankelling.org:/
+ rsync $@ -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments
}
lipushnoe() { # noe = noemacs. for running faster.
rsync $@ --delete-excluded -ahviSAXPH --specials --devices --delete --relative \
set +x
source /a/bin/distro-functions/src/identify-distros
$interactive || set -x
-for f in kd x2 x3 frodo tp li lj demohost kw; do
+for f in kd x2 x3 frodo tp li l2 demohost kw; do
eval "$f() { [[ $HOSTNAME == $f ]]; }"
done
codename=$(debian-codename)
has_wayland() { has_monitor && [[ $codename == buster ]]; }
has_x() { has_monitor && [[ $codename != buster ]]; }
has_monitor() { ! linode ; }
-linode() { lj || li; }
+linode() { l2 || li; }
# linode actually has btrfs now, but we dont do anything with it.
has_btrfs() { ! linode; }
home_network() { ! linode && ! kw; }
done
###### do conflink
-# li needs the bind group before conflink
-if [[ $HOSTNAME == li ]]; then
- getent group bind &>/dev/null || sudo groupadd -r bind
+# linode needs bind group before conflink
+if $linode; then
+ pi-nostart bind9
fi
# this needs to be before installing pacserve so we have gpg conf.
conflink
IFS= read -r -d '' y ||:
end_msg_var+="$y"
}
+end() {
+ e "$end_msg_var"
+ echo 0 >~/.local/distro-end
+ if $pending_reboot; then
+ echo "$0: pending reboot and then finished. doing it now."
+ s reboot now
+ else
+ echo "$0: $(date): ending now)"
+ fi
+ exit 0
+}
die() {
printf "$0: %s\n" "$*" >&2; exit 1
}
popularity-contest popularity-contest/participate boolean true
EOF
-########### begin section including li ################
+########### begin section including linode ################
pi ${p2[@]}
###### begin website setup
case $HOSTNAME in
- li)
-
- pi bind9
+ li|l2)
f=/var/lib/bind/db.b8.nz
if [[ ! -e $f ]]; then
ser stop bind9
- rm -f $f.jnl
- install -m 644 -o bind -g bind /p/c/machine_specific/li/bind-initial/db.b8.nz $f
+ s rm -f $f.jnl
+ s install -m 644 -o bind -g bind /p/c/machine_specific/linode/bind-initial/db.b8.nz $f
ser restart bind9
fi
+ ;;&
+ l2)
+ end
+ ;;
+ li)
case $HOSTNAME in
li) domain=iankelling.org ;;
sgo znc
###### stop znc setup #####
-
- echo 0 >~/.local/distro-end
- echo "$0: $(date): ending now)"
- exit 0
+ end
;;
esac
###### end website setup
fi
-e "$end_msg_var"
######### begin stuff belonging at the end ##########
-echo 0 >~/.local/distro-end
-if $pending_reboot; then
- echo "$0: pending reboot and then finished. doing it now."
- s reboot now
-else
- echo "$0: $(date): ending now)"
-fi
-exit 0
+end
quit
EOF
-nsupdate -k /p/c/machine_specific/li/filesystem/etc/bind/Kb8.nz.*.private <$f
+nsupdate -k /p/c/machine_specific/linode/filesystem/etc/bind/Kb8.nz.*.private <$f
+sed -i 's/^server .*/server l2.b8.nz/' $f
+nsupdate -k /p/c/machine_specific/linode/filesystem/etc/bind/Kb8.nz.*.private <$f
exit
# # persistent initial setup for this:
-# # create files in /a/c/machine_specific/li/filesystem/etc/bind
+# # create files in /a/c/machine_specific/linode/filesystem/etc/bind
# # note, conflink also does some group ownership stuff.
-mkc /p/c/machine_specific/li/filesystem/etc/bind
+mkc /p/c/machine_specific/linode/filesystem/etc/bind
s dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST b8.nz
user=$(id -un)
s chown $user:$user *
# * reload exim
-systemctl reload exim4
-systemctl start exim4
+if systemctl is-active exim4 >/dev/null; then
+ systemctl reload exim4
+else
+ systemctl start exim4
+fi
# * mail monitoring / testing
groupmod -g 609 radicale
usermod -g 609 radicale
fi
-find /o/radicale /var/log/radicale -xdev -exec chown -h 609 {} +
+log_p=/var/log/radicale
+[[ -d $log_p ]] || log_p=
+find /o/radicale -xdev -exec chown -h 609 {} +
find /o/radicale -xdev -exec chgrp -h 609 {} +