summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-core/multitech/config/config.init35
1 files changed, 31 insertions, 4 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init
index 2a40c16..f1d43b3 100644
--- a/recipes-core/multitech/config/config.init
+++ b/recipes-core/multitech/config/config.init
@@ -17,9 +17,10 @@ ppp/peers \
# Files used by bluetooth or wifi.
BTWIFIFILES="\
-bluetooth
-default/rs9113 \
+bluetooth \
+default/bluetooth \
default/hostapd \
+default/rs9113 \
dnsmasq.d \
hosts \
hostname \
@@ -28,6 +29,9 @@ modprobe.d \
wpa_supplicant.conf \
"
+# File hidden so it is not removed on hardware reset
+WIFITAR=".defaults2.tar.gz"
+
mount_config() {
echo "Mounting ${CONFIG_DIR}"
mkdir -p ${CONFIG_DIR}
@@ -77,7 +81,10 @@ case $1 in
if [ -f force_defaults ]; then
echo "Extracting default config files"
tar -xvf /etc/defaults.tar.gz
-
+ if [[ -f ${WIFITAR} ]] ; then
+ echo "Extract original wifi related files"
+ tar -xvf ${WIFITAR}
+ fi
if [ -f /etc/default_pass ]; then
echo "Defaulting root password"
PASSHASH=`cat /etc/default_pass`
@@ -110,6 +117,17 @@ case $1 in
# Move bluetooth wifi stuff to config directory.
# We don't have factory defaults.
+ ((dobackup=1))
+ for file in ${BTWIFIFILES}; do
+ if [[ -L /etc/$file ]]; then
+ ((dobackup=0))
+ break
+ fi
+ done
+ if ((dobackup==1)) ; then
+ tar -C /etc -czf ${CONFIG_DIR}/${WIFITAR} ${BTWIFIFILES}
+ fi
+
for file in ${BTWIFIFILES}; do
if [[ ! -L /etc/$file ]]; then
echo "Creating link to ${CONFIG_DIR}/$file"
@@ -117,7 +135,16 @@ case $1 in
if [[ $dir != '.' ]] ; then
mkdir -p "$dir"
fi
- mv /etc/$file ${CONFIG_DIR}/$file
+ rm -rf old
+ mkdir old
+ if ! [[ -f $file ]] ; then
+ # Need to preserve old files which is difficult with busybox!
+ mv $file old
+ (cd /etc;cp -a $file ${CONFIG_DIR})
+ cp -a old/$file .
+ rm -rf old
+ fi
+ rm -rf /etc/$file
ln -sf ${CONFIG_DIR}/$file /etc/$file
fi
done