From e5269cf3cfb1951a8748162a1c461d2d9b55efce Mon Sep 17 00:00:00 2001 From: John Dorman <427295+boostchicken@users.noreply.github.com> Date: Mon, 13 May 2024 19:34:28 -0700 Subject: [PATCH] 4.0 support (#608) --- att-ipv6/10-att-ipv6.sh | 21 +++++++-------- .../on_boot.d/30-cloudflare-ddns.sh | 19 ++++++------- dns-common/on_boot.d/10-dns.sh | 21 +++++++-------- haproxy/50-haproxy.sh | 20 ++++++-------- haproxy/update-haproxy.sh | 20 ++++++-------- hdhomerun/on_boot.d/99-hdhomerun.sh | 5 +--- homebridge/on_boot.d/25-homebridge.sh | 22 +++++++-------- .../on_boot.d/30-ipt-enable-logs-launch.sh | 20 ++++++-------- ipt-enable-logs/scripts/ipt-enable-logs.sh | 5 +--- ipt-enable-logs/scripts/refresh-iptables.sh | 19 ++++++------- modern-unix/on_boot.d/10-shell-profile.sh | 2 +- .../profile/global.profile.d/aliases.sh | 2 +- .../settings/profile/global.profile.d/opt.sh | 2 +- mosquitto/on_boot.d/45-mosquitto.sh | 21 +++++++-------- on-boot-script-2.x/Dockerfile | 4 +-- on-boot-script-2.x/README.md | 8 +++--- .../dpkg-build-files/debian/prerm | 2 +- .../udm-files/on_boot.d/10-shell-profile.sh | 5 +--- .../on_boot.d/15-add-github-ssh-keys.sh | 22 +++++++-------- .../on_boot.d/15-add-root-ssh-keys.sh | 22 +++++++-------- .../on_boot.d/15-add-ssh-known-hosts.sh | 22 +++++++-------- .../on_boot.d/15-preserve-history.sh | 19 ++++++------- .../udm-files/on_boot.d/25-add-cron-jobs.sh | 5 +--- on-boot-script-2.x/remote_install.sh | 20 ++++++-------- on-boot-script/README.md | 2 +- .../dpkg-build-files/debian/postinst | 2 +- .../on_boot.d/15-preserve-history.sh | 21 +++++++-------- on-boot-script/remote_install.sh | 27 +++++++------------ .../on_boot.d/42-watch-for-changes.sh | 21 +++++++-------- podman-install/on_boot.d/00-podman.sh | 19 ++++++------- podman-update/01-podman-update.sh | 20 ++++++-------- rclone/10-rclone.sh | 19 ++++++------- rclone/README.md | 2 +- run-pihole/DoTE.Dockerfile | 2 +- run-pihole/upd_pihole.sh | 5 +--- suricata/on_boot.d/25-suricata.sh | 20 ++++++-------- tailscale/on_boot.d/20-tailscale.sh | 2 +- unbound/on_boot.d/11-unbound-macvlanip.sh | 22 +++++++-------- unbound/scripts/init_unbound.sh | 6 +---- unbound/scripts/upd_unbound.sh | 3 +++ wireguard-go/on_boot.d/20-wireguard.sh | 19 ++++++------- zerotier-one/20-zerotier.sh | 23 +++++++--------- 42 files changed, 229 insertions(+), 334 deletions(-) diff --git a/att-ipv6/10-att-ipv6.sh b/att-ipv6/10-att-ipv6.sh index 69823be..46a08e5 100755 --- a/att-ipv6/10-att-ipv6.sh +++ b/att-ipv6/10-att-ipv6.sh @@ -1,22 +1,19 @@ -#! /bin/sh +#! /bin/bash set -eo pipefail # Get DataDir location DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists if [ ! -d "$DATA_DIR/att-ipv6" ]; then diff --git a/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh b/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh index cbb92ef..a42e0b3 100644 --- a/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh +++ b/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh @@ -4,18 +4,15 @@ CONTAINER=cloudflare-ddns DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists if [ ! -d "$DATA_DIR/cloudflare-ddns" ]; then diff --git a/dns-common/on_boot.d/10-dns.sh b/dns-common/on_boot.d/10-dns.sh index 710e801..d47961c 100644 --- a/dns-common/on_boot.d/10-dns.sh +++ b/dns-common/on_boot.d/10-dns.sh @@ -3,19 +3,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; -esac + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac ## configuration variables: VLAN=5 IPV4_IP="10.0.5.3" diff --git a/haproxy/50-haproxy.sh b/haproxy/50-haproxy.sh index 506f013..082ddcd 100644 --- a/haproxy/50-haproxy.sh +++ b/haproxy/50-haproxy.sh @@ -4,20 +4,16 @@ CONTAINER=haproxy DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # Check if the directory exists if [ ! -d "${DATA_DIR}/haproxy" ]; then # If it does not exist, create the directory diff --git a/haproxy/update-haproxy.sh b/haproxy/update-haproxy.sh index 65b3e3e..5d205ef 100644 --- a/haproxy/update-haproxy.sh +++ b/haproxy/update-haproxy.sh @@ -3,20 +3,16 @@ IMAGE=haproxy:latest DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - podman pull $IMAGE podman stop haproxy podman rm haproxy diff --git a/hdhomerun/on_boot.d/99-hdhomerun.sh b/hdhomerun/on_boot.d/99-hdhomerun.sh index 69e9657..806c732 100644 --- a/hdhomerun/on_boot.d/99-hdhomerun.sh +++ b/hdhomerun/on_boot.d/99-hdhomerun.sh @@ -8,10 +8,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) diff --git a/homebridge/on_boot.d/25-homebridge.sh b/homebridge/on_boot.d/25-homebridge.sh index e7a27fa..1a307c7 100755 --- a/homebridge/on_boot.d/25-homebridge.sh +++ b/homebridge/on_boot.d/25-homebridge.sh @@ -5,20 +5,16 @@ CONTAINER=homebridge DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; -esac - + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac ## network configuration and startup: CNI_PATH=${DATA_DIR}/podman/cni # Check if the directory exists diff --git a/ipt-enable-logs/on_boot.d/30-ipt-enable-logs-launch.sh b/ipt-enable-logs/on_boot.d/30-ipt-enable-logs-launch.sh index bb62650..71ea16a 100755 --- a/ipt-enable-logs/on_boot.d/30-ipt-enable-logs-launch.sh +++ b/ipt-enable-logs/on_boot.d/30-ipt-enable-logs-launch.sh @@ -4,20 +4,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # Check if the directory exists if [ ! -d "${DATA_DIR}/scripts" ]; then # If it does not exist, create the directory diff --git a/ipt-enable-logs/scripts/ipt-enable-logs.sh b/ipt-enable-logs/scripts/ipt-enable-logs.sh index 7b8d40e..020647a 100755 --- a/ipt-enable-logs/scripts/ipt-enable-logs.sh +++ b/ipt-enable-logs/scripts/ipt-enable-logs.sh @@ -5,10 +5,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) diff --git a/ipt-enable-logs/scripts/refresh-iptables.sh b/ipt-enable-logs/scripts/refresh-iptables.sh index 5900cd1..1e63865 100755 --- a/ipt-enable-logs/scripts/refresh-iptables.sh +++ b/ipt-enable-logs/scripts/refresh-iptables.sh @@ -3,18 +3,15 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists diff --git a/modern-unix/on_boot.d/10-shell-profile.sh b/modern-unix/on_boot.d/10-shell-profile.sh index 20e035b..c3b9169 100755 --- a/modern-unix/on_boot.d/10-shell-profile.sh +++ b/modern-unix/on_boot.d/10-shell-profile.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bssh ## Configure shell profile PROFILE_SOURCE=/data/settings/profile/global.profile.d diff --git a/modern-unix/settings/profile/global.profile.d/aliases.sh b/modern-unix/settings/profile/global.profile.d/aliases.sh index e24544f..27232b0 100755 --- a/modern-unix/settings/profile/global.profile.d/aliases.sh +++ b/modern-unix/settings/profile/global.profile.d/aliases.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash alias ...=../.. alias ....=../../.. diff --git a/modern-unix/settings/profile/global.profile.d/opt.sh b/modern-unix/settings/profile/global.profile.d/opt.sh index 96fe4ca..e73dc0e 100755 --- a/modern-unix/settings/profile/global.profile.d/opt.sh +++ b/modern-unix/settings/profile/global.profile.d/opt.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash PATH="/data/opt:$PATH" export PATH diff --git a/mosquitto/on_boot.d/45-mosquitto.sh b/mosquitto/on_boot.d/45-mosquitto.sh index 110f796..a0db047 100755 --- a/mosquitto/on_boot.d/45-mosquitto.sh +++ b/mosquitto/on_boot.d/45-mosquitto.sh @@ -3,18 +3,15 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists @@ -36,7 +33,7 @@ CONTAINER_CNI_PATH="${DATA_DIR}/podman/cni/45-mosquitto.conflist" # make sure cni plugs are installed if ! test -f /opt/cni/bin/macvlan; then echo "Error: CNI plugins not found. You can install it with the following command:" >&2 - echo " curl -fsSLo ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/main/cni-plugins/05-install-cni-plugins.sh && /bin/sh ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh" >&2 + echo " curl -fsSLo ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/main/cni-plugins/05-install-cni-plugins.sh && /bin/bash ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh" >&2 exit 1 fi diff --git a/on-boot-script-2.x/Dockerfile b/on-boot-script-2.x/Dockerfile index 1089acd..c610f4b 100644 --- a/on-boot-script-2.x/Dockerfile +++ b/on-boot-script-2.x/Dockerfile @@ -1,7 +1,7 @@ -FROM debian:stretch-slim +FROM debian:bookworm-slim RUN set -ex \ - && echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list \ + && echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list \ && apt-get update \ && apt-get install -y --no-install-recommends \ build-essential \ diff --git a/on-boot-script-2.x/README.md b/on-boot-script-2.x/README.md index fa717e3..1a1e45a 100644 --- a/on-boot-script-2.x/README.md +++ b/on-boot-script-2.x/README.md @@ -22,7 +22,7 @@ You can execute in UDM/Pro/SE and UDR with: ```bash -curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script-2.x/remote_install.sh" | /bin/sh +curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script-2.x/remote_install.sh" | /bin/bash ``` This is a force to install script so will uninstall any previous version and install on_boot keeping your on boot files. @@ -37,11 +37,11 @@ This will also install CNI Plugins & CNI Bridge scripts. If you are using UDMSE/ unifi-os shell ``` -2. Download [udm-boot-2x_1.0.1_all.deb](packages/udm-boot_1.0.0-2x_all.deb) and install it and go back to the UDM. +2. Download [udm-boot-2x_1.0.1_all.deb](packages/udm-boot-2x_1.0.1_all.deb) and install it and go back to the UDM. ```bash - curl -L [[https://udm-boot.boostchicken.dev](https://unifi.boostchicken.io/udm-boot-2x_1.0.0_all.deb)](https://unifi.boostchicken.io/udm-boot-2x_1.0.0_all.deb) -o udm-boot-2x_1.0.0_all.deb - dpkg -i udm-boot-2x_1.0.0_all.deb + curl -L [[https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb](https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb)](https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb) -o udm-boot-2x_1.0.1_all.deb + dpkg -i udm-boot-2x_1.0.1_all.deb systemctl enable udm-boot exit ``` diff --git a/on-boot-script-2.x/dpkg-build-files/debian/prerm b/on-boot-script-2.x/dpkg-build-files/debian/prerm index 5b52e6d..7535e2a 100755 --- a/on-boot-script-2.x/dpkg-build-files/debian/prerm +++ b/on-boot-script-2.x/dpkg-build-files/debian/prerm @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # prerm script for udm-boot # # see: dh_installdeb(1) diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/10-shell-profile.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/10-shell-profile.sh index 5b6642d..70fe319 100644 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/10-shell-profile.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/10-shell-profile.sh @@ -5,10 +5,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-github-ssh-keys.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-github-ssh-keys.sh index dfa4168..623738b 100644 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-github-ssh-keys.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-github-ssh-keys.sh @@ -1,21 +1,17 @@ #!/bin/bash # Get DataDir location -DATA_DIR="/data" -case "$(ubnt-device-info firmware || true)" in +DATA_DIR="/data"case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac ## Config Variables - please edit these # Set to true to download public keys from a github user account diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-root-ssh-keys.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-root-ssh-keys.sh index 990f9e1..2dcd27e 100644 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-root-ssh-keys.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-root-ssh-keys.sh @@ -1,20 +1,16 @@ #!/bin/bash # Get DataDir location -DATA_DIR="/data" -case "$(ubnt-device-info firmware || true)" in +DATA_DIR="/data"case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac ## Places public keys in ~/.ssh/authorized_keys diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-ssh-known-hosts.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-ssh-known-hosts.sh index 6d4910d..224f2e9 100644 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-ssh-known-hosts.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-ssh-known-hosts.sh @@ -1,20 +1,16 @@ #!/bin/bash # Get DataDir location -DATA_DIR="/data" -case "$(ubnt-device-info firmware || true)" in +DATA_DIR="/data"case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac ##################################################### # ADD KNOWN HOSTS AS BELOW - CHANGE BEFORE RUNNING # diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-preserve-history.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-preserve-history.sh index 78cbe79..130a348 100755 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/15-preserve-history.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/15-preserve-history.sh @@ -3,18 +3,15 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac mkdir -p ${DATA_DIR}/.home diff --git a/on-boot-script-2.x/examples/udm-files/on_boot.d/25-add-cron-jobs.sh b/on-boot-script-2.x/examples/udm-files/on_boot.d/25-add-cron-jobs.sh index 7995730..8878a22 100644 --- a/on-boot-script-2.x/examples/udm-files/on_boot.d/25-add-cron-jobs.sh +++ b/on-boot-script-2.x/examples/udm-files/on_boot.d/25-add-cron-jobs.sh @@ -5,10 +5,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) diff --git a/on-boot-script-2.x/remote_install.sh b/on-boot-script-2.x/remote_install.sh index e370605..358b45d 100755 --- a/on-boot-script-2.x/remote_install.sh +++ b/on-boot-script-2.x/remote_install.sh @@ -4,20 +4,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # A change in the name udm-boot would need to be reflected as well in systemctl calls. SYSTEMCTL_PATH="/etc/systemd/system/udm-boot.service" SYMLINK_SYSTEMCTL="/etc/systemd/system/multi-user.target.wants/udm-boot.service" diff --git a/on-boot-script/README.md b/on-boot-script/README.md index d78df1d..ff558ff 100644 --- a/on-boot-script/README.md +++ b/on-boot-script/README.md @@ -34,7 +34,7 @@ You can execute in UDM/Pro/SE and UDR with: ```bash -curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script/remote_install.sh" | /bin/sh +curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script/remote_install.sh" | /bin/bash ``` This is a force to install script so will uninstall any previous version and install on_boot keeping your on boot files. diff --git a/on-boot-script/dpkg-build-files/debian/postinst b/on-boot-script/dpkg-build-files/debian/postinst index 7732185..bde4069 100644 --- a/on-boot-script/dpkg-build-files/debian/postinst +++ b/on-boot-script/dpkg-build-files/debian/postinst @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # postinst script for udm-boot # # see: dh_installdeb(1) diff --git a/on-boot-script/examples/udm-files/on_boot.d/15-preserve-history.sh b/on-boot-script/examples/udm-files/on_boot.d/15-preserve-history.sh index 78cbe79..88f6e11 100755 --- a/on-boot-script/examples/udm-files/on_boot.d/15-preserve-history.sh +++ b/on-boot-script/examples/udm-files/on_boot.d/15-preserve-history.sh @@ -3,19 +3,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; -esac + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac mkdir -p ${DATA_DIR}/.home for file in .ash_history .bash_history; do diff --git a/on-boot-script/remote_install.sh b/on-boot-script/remote_install.sh index e4eb00c..568ecda 100755 --- a/on-boot-script/remote_install.sh +++ b/on-boot-script/remote_install.sh @@ -1,26 +1,19 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # Get DataDir location DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; -4*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; -esac - + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac # A change in the name udm-boot would need to be reflected as well in systemctl calls. SYSTEMCTL_PATH="/etc/systemd/system/udm-boot.service" SYMLINK_SYSTEMCTL="/etc/systemd/system/multi-user.target.wants/udm-boot.service" diff --git a/persist-changes/on_boot.d/42-watch-for-changes.sh b/persist-changes/on_boot.d/42-watch-for-changes.sh index b8949f6..0d85aae 100644 --- a/persist-changes/on_boot.d/42-watch-for-changes.sh +++ b/persist-changes/on_boot.d/42-watch-for-changes.sh @@ -3,19 +3,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; -esac + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac # Check if the directory exists if [ ! -d "${DATA_DIR}/scripts" ]; then diff --git a/podman-install/on_boot.d/00-podman.sh b/podman-install/on_boot.d/00-podman.sh index 89ec50f..be4eb7b 100755 --- a/podman-install/on_boot.d/00-podman.sh +++ b/podman-install/on_boot.d/00-podman.sh @@ -45,18 +45,15 @@ esac DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac CACHE_DIR="${DATA_DIR}/podman/cache" diff --git a/podman-update/01-podman-update.sh b/podman-update/01-podman-update.sh index b6694ee..5709c8d 100644 --- a/podman-update/01-podman-update.sh +++ b/podman-update/01-podman-update.sh @@ -1,20 +1,16 @@ #!/bin/bash # Get DataDir location -DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists diff --git a/rclone/10-rclone.sh b/rclone/10-rclone.sh index e5d5873..e311bd0 100644 --- a/rclone/10-rclone.sh +++ b/rclone/10-rclone.sh @@ -4,18 +4,15 @@ CONTAINER=rclone DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists diff --git a/rclone/README.md b/rclone/README.md index cd7d9c7..99e6c8f 100644 --- a/rclone/README.md +++ b/rclone/README.md @@ -29,5 +29,5 @@ 1. Login to run rclone commands locally to create and test configs ```sh - podman exec -ti rclone /bin/sh + podman exec -ti rclone / ``` diff --git a/run-pihole/DoTE.Dockerfile b/run-pihole/DoTE.Dockerfile index c844f72..2412892 100644 --- a/run-pihole/DoTE.Dockerfile +++ b/run-pihole/DoTE.Dockerfile @@ -6,5 +6,5 @@ RUN curl -fsSLo /opt/dote https://github.com/chrisstaite/DoTe/releases/latest/do chmod +x /opt/dote && \ usermod -aG pihole www-data; \ mkdir -p /etc/cont-init.d && \ - echo -e "#!/bin/sh\nchmod +x /opt/dote\n/opt/dote \$DOTE_OPTS -d\n" > /etc/cont-init.d/10-dote.sh && \ + echo -e "#!/bin/bash\nchmod +x /opt/dote\n/opt/dote \$DOTE_OPTS -d\n" > /etc/cont-init.d/10-dote.sh && \ chmod +x /etc/cont-init.d/10-dote.sh diff --git a/run-pihole/upd_pihole.sh b/run-pihole/upd_pihole.sh index 730d0ff..be484ed 100755 --- a/run-pihole/upd_pihole.sh +++ b/run-pihole/upd_pihole.sh @@ -7,10 +7,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) diff --git a/suricata/on_boot.d/25-suricata.sh b/suricata/on_boot.d/25-suricata.sh index ef5fe27..00f7356 100644 --- a/suricata/on_boot.d/25-suricata.sh +++ b/suricata/on_boot.d/25-suricata.sh @@ -3,20 +3,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # Check if the directory exists if [ ! -d "${DATA_DIR}/suricata-rules" ]; then # If it does not exist, create the directory diff --git a/tailscale/on_boot.d/20-tailscale.sh b/tailscale/on_boot.d/20-tailscale.sh index a18dea6..d03e41e 100755 --- a/tailscale/on_boot.d/20-tailscale.sh +++ b/tailscale/on_boot.d/20-tailscale.sh @@ -15,7 +15,7 @@ start() { tailscale/tailscale \ tailscaled --state=mem: # Changing sysctls inside the container to support running an exit node - cat <<'INIT' | podman exec --privileged ${CONTAINER} /bin/sh + cat <<'INIT' | podman exec --privileged ${CONTAINER} /bin/bash echo '1' > /proc/sys/net/ipv4/ip_forward ; echo '1' > /proc/sys/net/ipv6/conf/all/forwarding ; INIT diff --git a/unbound/on_boot.d/11-unbound-macvlanip.sh b/unbound/on_boot.d/11-unbound-macvlanip.sh index e51b343..c1ff933 100644 --- a/unbound/on_boot.d/11-unbound-macvlanip.sh +++ b/unbound/on_boot.d/11-unbound-macvlanip.sh @@ -3,20 +3,16 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # Check if the directory exists if [ ! -d "${DATA_DIR}/unbound" ]; then # If it does not exist, create the directory @@ -60,7 +56,7 @@ CONTAINER=unbound if ! test -f /opt/cni/bin/macvlan; then echo "Error: CNI plugins not found. You can install it with the following command:" >&2 - echo " curl -fsSLo ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/main/cni-plugins/05-install-cni-plugins.sh && /bin/sh ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh" >&2 + echo " curl -fsSLo ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/main/cni-plugins/05-install-cni-plugins.sh && /bin/bash ${DATA_DIR}/on_boot.d/05-install-cni-plugins.sh" >&2 exit 1 fi diff --git a/unbound/scripts/init_unbound.sh b/unbound/scripts/init_unbound.sh index e3d977e..1280102 100755 --- a/unbound/scripts/init_unbound.sh +++ b/unbound/scripts/init_unbound.sh @@ -5,10 +5,7 @@ case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; -2*) - DATA_DIR="/data" - ;; -3*) +2* | 3* | 4*) DATA_DIR="/data" ;; *) @@ -16,7 +13,6 @@ case "$(ubnt-device-info firmware || true)" in exit 1 ;; esac - # init unbound container - quick and dirty for now # no checks, no balances diff --git a/unbound/scripts/upd_unbound.sh b/unbound/scripts/upd_unbound.sh index 1dd34ae..5f7a3c7 100755 --- a/unbound/scripts/upd_unbound.sh +++ b/unbound/scripts/upd_unbound.sh @@ -11,6 +11,9 @@ case "$(ubnt-device-info firmware || true)" in 3*) DATA_DIR="/data" ;; +4*) +    DATA_DIR="/data" +    ;; *) echo "ERROR: No persistent storage found." 1>&2 exit 1 diff --git a/wireguard-go/on_boot.d/20-wireguard.sh b/wireguard-go/on_boot.d/20-wireguard.sh index b798125..198171b 100644 --- a/wireguard-go/on_boot.d/20-wireguard.sh +++ b/wireguard-go/on_boot.d/20-wireguard.sh @@ -4,18 +4,15 @@ DATA_DIR="/data" case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac # Check if the directory exists diff --git a/zerotier-one/20-zerotier.sh b/zerotier-one/20-zerotier.sh index 731fdb0..06507c6 100755 --- a/zerotier-one/20-zerotier.sh +++ b/zerotier-one/20-zerotier.sh @@ -1,22 +1,17 @@ #!/bin/bash # Get DataDir location -DATA_DIR="/data" -case "$(ubnt-device-info firmware || true)" in +DATA_DIR="/data"case "$(ubnt-device-info firmware || true)" in 1*) - DATA_DIR="/mnt/data" - ;; -2*) - DATA_DIR="/data" - ;; -3*) - DATA_DIR="/data" - ;; + DATA_DIR="/mnt/data" + ;; +2* | 3* | 4*) + DATA_DIR="/data" + ;; *) - echo "ERROR: No persistent storage found." 1>&2 - exit 1 - ;; + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; esac - # Check if the directory exists if [ ! -d "${DATA_DIR}/zerotier-one" ]; then # If it does not exist, create the directory