Skip to content

Commit

Permalink
Updated on_boot package to handle all steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
boostchicken committed Jul 7, 2020
1 parent 1348563 commit 072b6f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
18 changes: 5 additions & 13 deletions on-boot-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,17 @@ rm /etc/systemd/system/udmboot.service
* Built on Ubuntu-20.04 on Windows 10/WSL2

## Steps
1. Copy on_boot.sh and make on_boot.d and add scripts to on_boot.d
```shell script
mkdir -p /mnt/data/on_boot.d
vi /mnt/data/on_boot.sh
chmod u+x /mnt/data/on_boot.sh
```
Example: [on_boot.sh](examples/udm-files/on_boot.sh)

2. Get into the unifios shell on your udm
1. Get into the unifios shell on your udm
```shell script
unifi-os shell
```
3. Download the [udm-boot_1.0.0-1_all.deb](packages/udm-boot_1.0.0-1_all.deb) and install it and go back to the UDM
2. Download [udm-boot_1.0.1-1_all.deb](packages/udm-boot_1.0.0-1_all.deb) and install it and go back to the UDM
```shell script
curl -L https://raw.githubusercontent.com/boostchicken/udm-utilities/master/on-boot-script/packages/udm-boot_1.0.0-1_all.deb -o udm-boot_1.0.0-1_all.deb
dpkg -i udm-boot_1.0.0-1_all.deb
curl -L https://raw.githubusercontent.com/boostchicken/udm-utilities/master/on-boot-script/packages/udm-boot_1.0.1-1_all.deb -o udm-boot_1.0.1-1_all.deb
dpkg -i udm-boot_1.0.1-1_all.deb
exit
```
4. Copy any shell scripts you want to run to /mnt/data/on_boot.d and make sure they are executable and have the correct shebang (#!/bin/sh)
3. Copy any shell scripts you want to run to /mnt/data/on_boot.d on your UDM (not the unifi-os shell)and make sure they are executable and have the correct shebang (#!/bin/sh)
Examples:
* Start a DNS Container [10-dns.sh](../dns-common/on_boot.d/10-dns.sh)
* Start wpa_supplicant [on_boot.d/10-wpa_supplicant.sh](examples/udm-files/on_boot.d/10-wpa_supplicant.sh)
Expand Down
18 changes: 16 additions & 2 deletions on-boot-script/dpkg-build-files/debian/postinst
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
#!/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
Expand Down
Binary file added on-boot-script/packages/udm-boot_1.0.1-1_all.deb
Binary file not shown.

0 comments on commit 072b6f9

Please sign in to comment.