iopsys-feed/wifimngr/files/214-uci-wireless
Ronny Nilsson a01a3be0d1 sysupgrade: move UCI diff into a separate function lib
For reuse by other modules as well.
2020-03-29 12:22:47 +02:00

35 lines
721 B
Bash

#!/bin/sh
# As part of sysupgrade we migrate the users custom changes to the
# new fs. (Those which differ from the first boot defaults.)
# Abort on any error.
set -e
# Do nothing if user want to discard old settings.
if [ -n "$SAVE_CONFIG" ] && [ $SAVE_CONFIG -eq 0 ]; then
exit 0
fi
# Source functions.
for f in /lib/upgrade/iopsys*.sh; do
[ -r "$f" -a -s "$f" ] || continue
source $f
done
[ -d "/lib/config/snapshots/first_boot/uci" ] || exit 0
# Does this system has WiFi?
hasWifi=$(chroot "${2}" db -q get hw.board.hasWifi)
[ "$hasWifi" = "1" ] || exit 0
uci_possibly_migrate_package "wireless" "$2" || exit
# Report success.
logger -s -p daemon.info -t post-hooks -- "UCI wireless migrated."
exit 0