1717# A change in the name udm-boot would need to be reflected as well in systemctl calls.
1818SYSTEMCTL_PATH=" /etc/systemd/system/udm-boot.service"
1919SYMLINK_SYSTEMCTL=" /etc/systemd/system/multi-user.target.wants/udm-boot.service"
20-
20+ SERVICE_META_URL= " https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/refs/heads/main/on-boot-script-2.x/dpkg-build-files/udm-boot.service "
2121CNI_PLUGINS_SCRIPT_RAW_URL=" https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/cni-plugins/05-install-cni-plugins.sh"
2222CNI_PLUGINS_ON_BOOT_FILENAME=" $( basename " $CNI_PLUGINS_SCRIPT_RAW_URL " ) "
2323
@@ -130,31 +130,18 @@ install_on_boot_udm_series() {
130130 unset download_url tmp_path
131131}
132132
133- # Credits @peacey: https://github.com/unifi-utilities/unifios-utilities/issues/214#issuecomment-886869295
134- udmse_on_boot_systemd () {
135- cat << EOF
136- [Unit]
137- Description=Run On Startup UDM
138- Wants=network-online.target
139- After=network-online.target
140-
141- [Service]
142- Type=forking
143- ExecStart=bash -c 'mkdir -p ${DATA_DIR} /on_boot.d && find -L ${DATA_DIR} /on_boot.d -mindepth 1 -maxdepth 1 -type f -print0 | sort -z | xargs -0 -r -n 1 -- bash -c \'if test -x "\$ 0"; then echo "%n: running \$ 0"; "\$ 0"; else case "\$ 0" in *.sh) echo "%n: sourcing \$ 0"; . "\$ 0";; *) echo "%n: ignoring \$ 0";; esac; fi\''
144-
145- [Install]
146- WantedBy=multi-user.target
147-
148- EOF
149- }
150-
151133install_on_boot_udr_se () {
152134 systemctl disable udm-boot
153135 systemctl daemon-reload
154136 rm -f " $SYMLINK_SYSTEMCTL "
155137
156138 echo " Creating systemctl service file"
157- udmse_on_boot_systemd > " $SYSTEMCTL_PATH " || return 1
139+
140+ if ! download_on_path " $SYSTEMCTL_PATH " " $SERVICE_META_URL " ; then
141+ echo
142+ echo " Failed to download on-boot script service" 1>&2
143+ exit 1
144+ fi
158145 sleep 1s
159146
160147 echo " Enabling UDM boot..."
@@ -164,9 +151,6 @@ install_on_boot_udr_se() {
164151
165152 [ -e " $SYMLINK_SYSTEMCTL " ]
166153}
167-
168- # --- main ---
169-
170154header
171155
172156depends_on ubnt-device-info
0 commit comments