fixes for second bind host
authorIan Kelling <ian@iankelling.org>
Fri, 18 Oct 2019 22:24:59 +0000 (18:24 -0400)
committerIan Kelling <ian@iankelling.org>
Fri, 18 Oct 2019 22:24:59 +0000 (18:24 -0400)
brc2
distro-begin
distro-end
dynamic-ip-update
machine_specific/linode.hosts [new file with mode: 0644]
machine_specific/linode/filesystem/etc/bind/named.conf.local [moved from machine_specific/li/filesystem/etc/bind/named.conf.local with 100% similarity]
machine_specific/linode/filesystem/var/lib/bind/db.b8.nz [moved from machine_specific/li/filesystem/var/lib/bind/db.b8.nz with 100% similarity]
mail-setup
radicale-setup

diff --git a/brc2 b/brc2
index 144f0c62d1289b75ddbd96246e72a36019bcbc9f..fb14eaa76a854fda26146cf4f356126078620606 100644 (file)
--- 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 \
index 570d077ca68d1fc9f5bdbb666962de4e83506bdb..783c6cebab6c90c46a95fab76bb611a416a92636 100755 (executable)
@@ -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
index c97df5182dc131ebb983ce3802d4658a032e7e58..3772e87a3d189607c69ae4beebb0e3e9e2c92c61 100755 (executable)
@@ -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 <<EOF
 popularity-contest popularity-contest/participate boolean true
 EOF
 
-########### begin section including li ################
+########### begin section including linode ################
 pi ${p2[@]}
 
 
@@ -394,16 +405,19 @@ EOF
 
 ###### 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
+      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 ;;
@@ -553,10 +567,7 @@ EOF
     sgo znc
     ###### stop znc setup #####
 
-
-    echo 0 >~/.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
index f696c0ceba3312e0bc4b56a6316d9c309a863c96..1f55f4c458145c6c600d6910a1108aee4521fd21 100755 (executable)
@@ -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 (file)
index 0000000..9d2158e
--- /dev/null
@@ -0,0 +1,2 @@
+li
+l2
index 3efee8bf7f7c7882ffef931ea2d39d9ecd45b3f5..a8692ef23d53ce75e8c7a53361d0615d1a08c67b 100755 (executable)
@@ -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
index cb43a477fd2399b64486a423c47070d98f10dd35..1d0ca163ca6b80e3cf62f131673021bd14a8daad 100755 (executable)
@@ -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 {} +