unifios-utilities/persist-changes
2022-11-01 01:52:28 -07:00
..
on_boot.d Add persist-changes script (#401) 2022-11-01 01:52:28 -07:00
scripts Add persist-changes script (#401) 2022-11-01 01:52:28 -07:00
README.md Add persist-changes script (#401) 2022-11-01 01:52:28 -07:00

Persist changes

Do you want to make some custom changes to your UDM which Unifi hasn't released yet? Would you like to make some changes that on EdgeOS would be achieved with config.something.yml?

If you just make changes to the interfaces, Unifi will overwrite what you've done periodically/next time you change something. Luckily we can hook into Unifi's state file and perform the updates immediately afterwards.

For example, configuring two IP addresses on your WAN interface, so that you can get to your modem's configuration.

Installation

  1. Enable on-boot-script
  2. Copy 42-watch-for-changes.sh to /mnt/data/on_boot.d/
    • Check the FILE variable, it should point to a file that exists, it might be in /data or in /mnt/data
  3. Copy on-state-change.sh to /mnt/data/scripts/
  4. Edit /mnt/data/scripts/on-state-change.sh to your heart's content

Make sure that your script doesn't error in the likely case that it tries to execute an update which has already been made

Example: configuring two IP addresses on your WAN interface

/mnt/data/scripts/on-state-change.sh

#!/bin/sh

# give port9 this IP, allows access to router web interface
ip addr add 192.168.0.2/24 dev eth8 || true