From 79f7343cb471941137540dab163a6e1b01ba446b Mon Sep 17 00:00:00 2001 From: Ronny Nilsson Date: Thu, 26 Mar 2020 16:23:07 +0100 Subject: [PATCH] sysupgrade: uci wireless santity checks. --- wifimngr/files/214-uci-wireless | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wifimngr/files/214-uci-wireless b/wifimngr/files/214-uci-wireless index e8bce0715..0e8507fa3 100644 --- a/wifimngr/files/214-uci-wireless +++ b/wifimngr/files/214-uci-wireless @@ -22,13 +22,18 @@ hasWifi=$(chroot "${2}" db -q get hw.board.hasWifi) # Read the very first verion of the wireless settings. -chroot "${2}" uci -c "/lib/config/snapshots/first_boot/uci" \ - show wireless >"/tmp/wireless-first-$$" +if ! chroot "${2}" uci -c "/lib/config/snapshots/first_boot/uci" \ + -q show wireless >"/tmp/wireless-first-$$" || \ + [ ! -s "/tmp/wireless-first-$$" ]; then + exit 0 +fi # Let the current UCI export its wireless settings. -chroot "${2}" uci show wireless >"/tmp/wireless-current-$$" - +if ! chroot "${2}" uci -q show wireless >"/tmp/wireless-current-$$" || \ + [ ! -s "/tmp/wireless-current-$$" ]; then + exit 0 +fi # If there a diff between the two? if grep -vFf "/tmp/wireless-first-$$" "/tmp/wireless-current-$$" \