summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2017-12-06 15:24:32 -0600
committerJohn Klug <john.klug@multitech.com>2017-12-06 15:24:32 -0600
commit76b42f3669fbd3e4dfa1757b52ad8777299deb47 (patch)
tree70f3ddcb818c93dafa2fe25a9cb398d3a6f571ee
parentd5360140f86c763e2ea1f9e8c81e238dbeec083b (diff)
downloadmeta-mlinux-76b42f3669fbd3e4dfa1757b52ad8777299deb47.tar.gz
meta-mlinux-76b42f3669fbd3e4dfa1757b52ad8777299deb47.tar.bz2
meta-mlinux-76b42f3669fbd3e4dfa1757b52ad8777299deb47.zip
Add Bluetooth and WiFi configuration to the config directory.
-rw-r--r--recipes-core/multitech/config/config.init78
1 files changed, 77 insertions, 1 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init
index 874416c..17ee777 100644
--- a/recipes-core/multitech/config/config.init
+++ b/recipes-core/multitech/config/config.init
@@ -15,6 +15,23 @@ ppp/chap-secrets \
ppp/peers \
"
+# Files used by bluetooth or wifi.
+BTWIFIFILES="\
+bluetooth/ \
+default/bluetooth \
+default/hostapd \
+default/rs9113 \
+dnsmasq.d/ \
+hosts \
+hostname \
+hostapd.conf \
+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}
@@ -64,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`
@@ -94,6 +114,62 @@ case $1 in
ln -sf ${CONFIG_DIR}/$file /etc/$file
fi
done
+
+ # 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 last character is /, make the CONFIG directory.
+ if [[ ${file: -1} == / ]] ; then
+ file=${file%?}
+ echo directory $file operations
+ if ! [[ -d ${CONFIG_DIR}/$file ]] ; then
+ rm -f ${CONFIG_DIR}/$file 2>/dev/null || true
+ mkdir ${CONFIG_DIR}/$file
+ fi
+ fi
+ if [[ ! -L /etc/$file ]]; then
+ echo "Creating link to ${CONFIG_DIR}/$file"
+ dir=$(dirname $file)
+ if [[ $dir != '.' ]] ; then
+ mkdir -p "$dir"
+ fi
+ rm -rf old
+ mkdir old
+ if ! [[ -f $file ]] ; then
+ # Need to preserve old files which is difficult with busybox!
+ if [[ -d $file ]] || [[ -f $file ]] ; then
+ cp --parents -a $file old || true
+ fi
+ (
+ cd /etc
+ if [[ -d $file ]] || [[ -f $file ]] ; then
+ cp --parents -a $file ${CONFIG_DIR} || true
+ fi
+ )
+ (
+ cd old
+ if [[ -d $file ]] || [[ -f $file ]] ; then
+ cp --parents -a $file .. || true
+ fi
+ )
+ rm -rf old
+ fi
+ rm -rf /etc/$file
+ ln -sf ${CONFIG_DIR}/$file /etc/$file
+ fi
+ done
+
;;