sleep 2
done
+new_hostname=$($new_shell hostname)
+
########### end initial processing, begin actually modifying things ##########
restore_new_btrbk=false
fi
-$new_shell bash -s <<'EOF'
+$new_shell bash -xs <<'EOF'
set -eE
-if mountpoint /m; then sudo umount /m; fi
-if mountpoint /o; then sudo umount /o; fi
+if mountpoint -q /m; then sudo umount /m; fi
+if mountpoint -q /o; then sudo umount /o; fi
EOF
# if new_host is not on home network, make mail.iankelling.org not resolve
if [[ $new_host == $HOSTNAME ]] && ! $at_home; then
echo | $wrt_shell cedit mail_host /etc/hosts || [[ $? == 1 ]] # 1 means file changed.
else
- $wrt_shell bash -s <<EOFOUTER
- if ! cedit mail_host /etc/hosts <<EOF; then
-\$(grep "\b$new_host\b" /etc/hosts | awk '{print \$1}') mail.iankelling.org
+ $wrt_shell bash -xs $new_host <<'EOFOUTER'
+new_host=$1
+cedit mail_host /etc/hosts <<EOF || /etc/init.d/dnsmasq restart
+$(grep "\b$new_hostname\b" /etc/hosts | awk '{print $1}') mail.iankelling.org
EOF
-/etc/init.d/dnsmasq restart
EOFOUTER
fi
-
$old_shell /a/bin/distro-setup/install-my-scripts
-$old_shell primary-setup $new_host
+$old_shell primary-setup $new_hostname
sudo dd of=/etc/btrbk.conf <<'EOF'
ssh_identity /root/.ssh/home
sudo btrbk -l debug --progress run
$new_shell /a/bin/distro-setup/install-my-scripts
$new_shell mount-latest-subvol
-$new_shell primary-setup $new_host
+$new_shell primary-setup $new_hostname
if $restore_new_btrbk; then
$new_shell sudo systemctl start btrbk.timer