2020-07-13 05:37:04 +00:00
|
|
|
# Legacy setup
|
|
|
|
|
|
|
|
## Automated Setup
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
- NB! THESE WILL NOT PERSIST THROUGH FIRMWARE. They still work however
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2020-07-06 05:16:32 +00:00
|
|
|
1. Copy [install.sh](manual-install/install.sh) to your UDM and execute it
|
2023-02-23 05:44:27 +00:00
|
|
|
1. Copy any shell scripts you want to run to /data/on_boot.d and make sure they are executable and have the correct shebang (#!/bin/bash)
|
2023-02-22 16:49:54 +00:00
|
|
|
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-start-containers.sh)
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2020-07-13 05:37:04 +00:00
|
|
|
## Manual Setup
|
2020-07-06 03:09:26 +00:00
|
|
|
|
|
|
|
1. Copy on_boot.sh and make on_boot.d and add scripts to on_boot.d
|
2020-07-13 05:37:04 +00:00
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
mkdir -p /data/on_boot.d
|
|
|
|
vi /data/on_boot.sh
|
|
|
|
chmod u+x /data/on_boot.sh
|
|
|
|
```
|
2020-07-13 05:37:04 +00:00
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
Example: [on_boot.sh](examples/udm-files/on_boot.sh)
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2020-07-13 05:37:04 +00:00
|
|
|
2. Enter the container shell
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
unifi-os shell
|
|
|
|
```
|
2020-07-13 05:37:04 +00:00
|
|
|
|
|
|
|
3. make a script that sshs to the udm and runs on our boot script. 127.0.1.1 always points to the UDM
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
2023-02-23 05:44:27 +00:00
|
|
|
echo "#!/bin/bash
|
2023-02-22 16:49:54 +00:00
|
|
|
ssh -o StrictHostKeyChecking=no root@127.0.1.1 '/data/on_boot.sh'" > /etc/init.d/udm.sh
|
|
|
|
chmod u+x /etc/init.d/udm.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Example: [udm.sh](examples/unifi-os-files/udm.sh)
|
2020-07-13 05:37:04 +00:00
|
|
|
|
|
|
|
4. make a service that runs on startup, after we have networking
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
echo "[Unit]
|
|
|
|
Description=Run On Startup UDM
|
|
|
|
After=network.target
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
[Service]
|
|
|
|
ExecStart=/etc/init.d/udm.sh
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target" > /etc/systemd/system/udmboot.service
|
|
|
|
```
|
2020-07-13 05:37:04 +00:00
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
Example: [udmboot.service](examples/unifi-os-files/udmboot.service)
|
2020-07-06 03:09:26 +00:00
|
|
|
|
2020-07-13 05:37:04 +00:00
|
|
|
5. enable it and test
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
systemctl enable --now udmboot
|
|
|
|
```
|
2020-07-13 05:37:04 +00:00
|
|
|
|
|
|
|
6. back to the udm
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
exit
|
|
|
|
```
|
2020-07-13 05:37:04 +00:00
|
|
|
|
|
|
|
7. reboot your udm/udmpro and make sure it worked
|
|
|
|
|
2023-02-22 16:49:54 +00:00
|
|
|
```sh
|
|
|
|
reboot
|
|
|
|
exit
|
|
|
|
```
|