From aec23d4d07e390a2a74635c35b39f5a0ba0f7439 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 25 Feb 2021 22:33:39 -0500 Subject: [PATCH] various fixes --- brc | 2 +- distro-begin | 15 ++++++--- distro-end | 33 +++++++++++-------- dynamic-ip-update | 20 ++++++----- .../kd/filesystem/etc/btrbk/rust.conf | 19 +++++++++++ .../etc/systemd/system/btrbkrust.service | 7 ++++ .../etc/systemd/system/btrbkrust.timer | 8 +++++ mail-setup | 22 +++++-------- 8 files changed, 86 insertions(+), 40 deletions(-) create mode 100644 machine_specific/kd/filesystem/etc/btrbk/rust.conf create mode 100644 machine_specific/kd/filesystem/etc/systemd/system/btrbkrust.service create mode 100644 machine_specific/kd/filesystem/etc/systemd/system/btrbkrust.timer diff --git a/brc b/brc index 9aeff8c..c9078ee 100644 --- a/brc +++ b/brc @@ -1236,7 +1236,7 @@ safe_rename() { # warn and dont rename if file exists. sd() { - sudo dd of="$1" 2>/dev/null + sudo dd status=none of="$1" } ser() { diff --git a/distro-begin b/distro-begin index 1ad65f4..e4958f5 100755 --- a/distro-begin +++ b/distro-begin @@ -472,10 +472,17 @@ if encrypted; then fi ##### make extra dirs -dirs=(/mnt/{1,2,3,4,5,6,7,8,9} /nocow/t /bu/md /bu/md/{cur,tmp,new} /bu/mnt) -sudo mkdir -p "${dirs[@]}" -# allow to fail because they could have read-only mounts on them -sudo chown $USER:$USER "${dirs[@]}" ||: +dirs=() +for dir in /mnt/{1,2,3,4,5,6,7,8,9} /nocow/t /bu/md /bu/md/{cur,tmp,new} /bu/mnt; do + [[ -e $dir ]] && continue + dirs+=($dir) +done +if (( ${#dirs[@]} )); then + # mkdir -p on a mounted directory will fail. so will chown if its an ro mount + sudo mkdir -p "${dirs[@]}" + sudo chown $USER:$USER "${dirs[@]}" +fi + # disabled temporarily ###### setup /i diff --git a/distro-end b/distro-end index 3c37330..5c802ca 100755 --- a/distro-end +++ b/distro-end @@ -525,27 +525,27 @@ case $HOSTNAME in sudo rm -fv /etc/apache2/sites-enabled/mumble.iankelling.org # general vpn for as needed use - vpn-server-setup -d -r -4 10.2.2 -p 443 -n hole + vpn-server-setup -d -r -4 10.5.5 -p 443 -n hole sd /etc/openvpn/client-config-hole/kw <<'EOF' -ifconfig-push 10.2.2.9 255.255.255.0 +ifconfig-push 10.5.5.9 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/x3 <<'EOF' -ifconfig-push 10.2.2.8 255.255.255.0 +ifconfig-push 10.5.5.8 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/x2 <<'EOF' -ifconfig-push 10.2.2.7 255.255.255.0 +ifconfig-push 10.5.5.7 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/wclient <<'EOF' -ifconfig-push 10.2.2.6 255.255.255.0 +ifconfig-push 10.5.5.6 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/frodo <<'EOF' -ifconfig-push 10.2.2.5 255.255.255.0 +ifconfig-push 10.5.5.5 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/amy <<'EOF' -ifconfig-push 10.2.2.3 255.255.255.0 +ifconfig-push 10.5.5.3 255.255.255.0 EOF sd /etc/openvpn/client-config-hole/kd <<'EOF' -ifconfig-push 10.2.2.2 255.255.255.0 +ifconfig-push 10.5.5.2 255.255.255.0 EOF #vpn-mk-client-cert -s "" -n hole 72.14.176.105 @@ -1214,6 +1214,9 @@ case $HOSTNAME in frodo) tdir=/i/k ;; + kd) + tdir=/d/tor + ;; *) tdir=/nocow/user ;; @@ -1300,15 +1303,17 @@ File.write(p, JSON.pretty_generate(JSON.parse(File.read(p)).merge({ "peer-port" => 61486, "cache-size-mb" => 256, "ratio-limit" => 5.0, -"ratio-limit-enabled" => true, +"ratio-limit-enabled" => false, })) + "\n") EOF -####### end transmission - +####### end transmission case $HOSTNAME in kd) + # to persist upload/dl metadata. initially, moved all the stuff + # in /var/lib/transmission-daemon to /d/tor + s usermod --home /d/tor debian-transmission sgo transmission-daemon-nn ;; esac @@ -1495,9 +1500,9 @@ DEVICESCAN -a -o on -S on -n standby,q $sched \ if [[ $HOSTNAME != frodo ]]; then s cedit hole /etc/hosts </dev/null; then ip6=$out6 fi - if [[ $cur6 != $ip6 ]]; then - up6=true - fi fi +if [[ $cur6 != $ip6 ]]; then + up6=true +fi if ! $up4 && ! $up6; then exit 0 @@ -74,14 +76,16 @@ EOF fi if $up6; then - cat >>$f <>$f <>$f <>$f <>$f <