From 76c17952a744af085a17e9efdd5d8763aec55480 Mon Sep 17 00:00:00 2001 From: Chris Blake Date: Sun, 16 Jun 2024 14:49:16 -0500 Subject: [PATCH] fix: ensure unvrpro services don't exist on unvr This is for https://github.com/riptidewave93/UNVR-NAS/issues/12, but we want to make sure UNVRPRO only services do not exist on the normal UNVR. --- scripts/docker/bootstrap/001-bootstrap | 14 +++++++++----- scripts/docker/run_debootstrap.sh | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/docker/bootstrap/001-bootstrap b/scripts/docker/bootstrap/001-bootstrap index e0af4e4..3a00c92 100755 --- a/scripts/docker/bootstrap/001-bootstrap +++ b/scripts/docker/bootstrap/001-bootstrap @@ -20,12 +20,16 @@ apt-mark hold linux-image-* # We do not want these, as we run our own kernel! # Setup our services systemctl enable ubnt-init -systemctl enable mock-ubnt-api -systemctl enable ulcmd -systemctl enable ulcmd-reboot-hook -systemctl enable ulcmd-shutdown-hook systemctl enable unvr-fan-daemon +# Do we have ulcmd? if so, we are UNVRPRO so enable ulcmd services +if [ -f "/usr/bin/ulcmd" ]; then + systemctl enable mock-ubnt-api + systemctl enable ulcmd + systemctl enable ulcmd-reboot-hook + systemctl enable ulcmd-shutdown-hook +fi + # Now that we have our wanted kernel in place, do the rest of our installs apt-get -o Dpkg::Options::="--force-confold" -y --allow-downgrades \ --allow-remove-essential --allow-change-held-packages install cloud-init \ @@ -67,9 +71,9 @@ jq --null-input --compact-output \ jq --null-input --compact-output \ "{uuid: \"fa4b1c66-ef79-11e5-87a0-0002b3a176b4\", devicename: \"enp0s2\", method: \"dhcp\", method6: \"auto\"}" | \ omv-confdbadm update "conf.system.network.interface" - + # Set hostname omv-confdbadm update "conf.system.network.dns" "{\"hostname\": \"unvr-nas\"}" -sed -i "s|myhostname = .*|myhostname = unvr-nas|g" /etc/postfix/main.cf # Cleanup stuff we don't want floating around apt-get autoclean || true diff --git a/scripts/docker/run_debootstrap.sh b/scripts/docker/run_debootstrap.sh index bc9cbc8..3f4e54e 100755 --- a/scripts/docker/run_debootstrap.sh +++ b/scripts/docker/run_debootstrap.sh @@ -60,8 +60,18 @@ if [ "${BOARD}" == "UNVRPRO" ]; then # Now for the REAL JANK! patch ulcmd so it doesn't rely on /proc/ubnthal, so we can use our userspace tool ubnteeprom sed -i 's|/proc/ubnthal/system.info|/tmp/.ubnthal_system_info|g' "${build_path}/rootfs/usr/bin/ulcmd" else - # Remove our ld.so.conf.d as it's not needed for UVNR - rm "${build_path}/rootfs/etc/ld.so.conf.d/ubnt.conf" + # Remove UNVRPRO specific files/services + rm "${build_path}/rootfs/etc/ld.so.conf.d/ubnt.conf" \ + "${build_path}/rootfs/etc/systemd/system/mock-ubnt-api.service" \ + "${build_path}/rootfs/etc/systemd/system/ulcmd.service" \ + "${build_path}/rootfs/etc/systemd/system/ulcmd-reboot-hook.service" \ + "${build_path}/rootfs/etc/systemd/system/ulcmd-shutdown-hook.service" \ + "${build_path}/rootfs/usr/bin/mock-ubnt-api" \ + "${build_path}/rootfs/usr/bin/ubnt-systool" \ + "${build_path}/rootfs/usr/bin/ubnt-tools" \ + "${build_path}/rootfs/usr/bin/ustorage" \ + "${build_path}/rootfs/usr/lib/init/boot/ubnt-ulcmd.sh" \ + "${build_path}/rootfs/usr/lib/python3/dist-packages/ubnthelpers.py" fi # Copy over bluetooth firmware files