mirror of
https://github.com/unifi-utilities/unifios-utilities.git
synced 2024-08-30 18:32:21 +00:00
48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure)
|
|
echo '#!/bin/sh
|
|
|
|
if [ -d /mnt/data/on_boot.d ]; then
|
|
for i in /mnt/data/on_boot.d/*.sh; do
|
|
if [ -r $i ]; then
|
|
. $i
|
|
fi
|
|
done
|
|
fi
|
|
' > /tmp/on_boot.sh
|
|
scp -o StrictHostKeyChecking=no /tmp/on_boot.sh root@127.0.1.1:/mnt/data/on_boot.sh
|
|
ssh -o StrictHostKeyChecking=no root@127.0.1.1 'chmod +x /mnt/data/on_boot.sh'
|
|
ssh -o StrictHostKeyChecking=no root@127.0.1.1 'mkdir -p /mnt/data/on_boot.d'
|
|
|
|
rm /tmp/on_boot.sh
|
|
|
|
echo "#!/bin/sh
|
|
ssh -o StrictHostKeyChecking=no root@127.0.1.1 '/mnt/data/on_boot.sh'" > /etc/init.d/udm.sh
|
|
chmod +x /etc/init.d/udm.sh
|
|
echo "[Unit]
|
|
Description=Run On Startup UDM
|
|
After=network.target
|
|
|
|
[Service]
|
|
ExecStart=/etc/init.d/udm.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target" > /etc/systemd/system/udmboot.service
|
|
systemctl enable udmboot
|
|
systemctl start udmboot
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|