From ee12ce2ee3b67a3041825c13e40ec52675fa49b1 Mon Sep 17 00:00:00 2001 From: chris007de Date: Mon, 16 Nov 2020 21:55:04 +0100 Subject: [PATCH] [#1] Store hnap config file persistently on device --- overlay/fw/etc/init.d/S92basestation.sh | 4 ++++ overlay/fw/root/{config.txt => hnap_config.txt} | 0 overlay/fw/root/save_hnap_config | 9 +++++++++ 3 files changed, 13 insertions(+) rename overlay/fw/root/{config.txt => hnap_config.txt} (100%) create mode 100755 overlay/fw/root/save_hnap_config diff --git a/overlay/fw/etc/init.d/S92basestation.sh b/overlay/fw/etc/init.d/S92basestation.sh index b64726b..82ca487 100755 --- a/overlay/fw/etc/init.d/S92basestation.sh +++ b/overlay/fw/etc/init.d/S92basestation.sh @@ -5,6 +5,10 @@ # Autostart the basestation service start() { + # Restore stored configuration + [[ -d /mnt/jffs2/root ]] && cd /mnt/jffs2/root && md5sum -s -c hnap_config.md5 && cp hnap_config.txt /root + + # Check if autostart is enabled if [ `fw_printenv -n hnap_bs_autostart` = 1 ] then printf "Starting basestation application" diff --git a/overlay/fw/root/config.txt b/overlay/fw/root/hnap_config.txt similarity index 100% rename from overlay/fw/root/config.txt rename to overlay/fw/root/hnap_config.txt diff --git a/overlay/fw/root/save_hnap_config b/overlay/fw/root/save_hnap_config new file mode 100755 index 0000000..29cc9bb --- /dev/null +++ b/overlay/fw/root/save_hnap_config @@ -0,0 +1,9 @@ +#!/bin/sh +set +e + +cat /proc/mounts | grep -q mtd2 || (echo "Filesystem not mounted use device_format_jffs2 command to setup your partition"; exit 1) + +install -D /root/hnap_config.txt -t /mnt/jffs2/root +cd /root +md5sum hnap_config.txt 2>/dev/null > /mnt/jffs2/root/hnap_config.md5 +