From: Ian Kelling Date: Fri, 18 Oct 2019 22:24:59 +0000 (-0400) Subject: fixes for second bind host X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=f9ec6d39566c13775abd5d1709a44e5bd1c32997 fixes for second bind host --- diff --git a/brc2 b/brc2 index 144f0c6..fb14eaa 100644 --- a/brc2 +++ b/brc2 @@ -118,9 +118,14 @@ bpush() { 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 \ diff --git a/distro-begin b/distro-begin index 570d077..783c6ce 100755 --- a/distro-begin +++ b/distro-begin @@ -80,14 +80,14 @@ source $script_dir/pkgs 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; } @@ -217,9 +217,9 @@ EOF 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 diff --git a/distro-end b/distro-end index c97df51..3772e87 100755 --- a/distro-end +++ b/distro-end @@ -27,6 +27,17 @@ end_msg() { 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 } @@ -53,7 +64,7 @@ s debconf-set-selections <~/.local/distro-end - echo "$0: $(date): ending now)" - exit 0 + end ;; esac ###### end website setup @@ -1670,7 +1681,6 @@ EOF fi -e "$end_msg_var" @@ -1684,11 +1694,4 @@ 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 diff --git a/dynamic-ip-update b/dynamic-ip-update index f696c0c..1f55f4c 100755 --- a/dynamic-ip-update +++ b/dynamic-ip-update @@ -80,15 +80,17 @@ answer 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 * diff --git a/machine_specific/linode.hosts b/machine_specific/linode.hosts new file mode 100644 index 0000000..9d2158e --- /dev/null +++ b/machine_specific/linode.hosts @@ -0,0 +1,2 @@ +li +l2 diff --git a/machine_specific/li/filesystem/etc/bind/named.conf.local b/machine_specific/linode/filesystem/etc/bind/named.conf.local similarity index 100% rename from machine_specific/li/filesystem/etc/bind/named.conf.local rename to machine_specific/linode/filesystem/etc/bind/named.conf.local diff --git a/machine_specific/li/filesystem/var/lib/bind/db.b8.nz b/machine_specific/linode/filesystem/var/lib/bind/db.b8.nz similarity index 100% rename from machine_specific/li/filesystem/var/lib/bind/db.b8.nz rename to machine_specific/linode/filesystem/var/lib/bind/db.b8.nz diff --git a/mail-setup b/mail-setup index 3efee8b..a8692ef 100755 --- a/mail-setup +++ b/mail-setup @@ -875,8 +875,11 @@ fi # * 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 diff --git a/radicale-setup b/radicale-setup index cb43a47..1d0ca16 100755 --- a/radicale-setup +++ b/radicale-setup @@ -57,7 +57,9 @@ if [[ $uid != 609 ]]; then 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 {} +