summaryrefslogtreecommitdiff
path: root/recipes/multitech/config/config.init
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2010-04-30 10:50:57 -0500
committerJesse Gilles <jgilles@multitech.com>2010-04-30 10:50:57 -0500
commit0431f878edd38a1af264e5727e1e4d604f1a95fd (patch)
tree8fbede06fa2bf4835e9d032d1263ae120eb99837 /recipes/multitech/config/config.init
parent15028387890effa23f9cd0479b586f31c0752b88 (diff)
add Multi-Tech-specific recipes
Diffstat (limited to 'recipes/multitech/config/config.init')
-rw-r--r--recipes/multitech/config/config.init59
1 files changed, 59 insertions, 0 deletions
diff --git a/recipes/multitech/config/config.init b/recipes/multitech/config/config.init
new file mode 100644
index 0000000000..770be18e23
--- /dev/null
+++ b/recipes/multitech/config/config.init
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+CONFIG_MTDC=/dev/mtd6
+CONFIG_DIR=/var/config
+
+FILES="network/interfaces \
+ppp/options \
+ppp/pap-secrets \
+ppp/chap-secrets \
+ppp/peers \
+passwd \
+group"
+
+case $1 in
+ start)
+ echo "Mounting ${CONFIG_DIR}"
+ mkdir -p ${CONFIG_DIR}
+ mount ${CONFIG_DIR}
+
+ # Prepare flash for JFFS2 if mount fails
+ if [ $? -ne 0 ]; then
+ echo "Creating ${CONFIG_DIR}"
+ flash_eraseall -j ${CONFIG_MTDC}
+ mount ${CONFIG_DIR}
+ fi
+
+ # Default all config files if requested
+ cd ${CONFIG_DIR}
+ if [ -f force_defaults ]; then
+ echo "Extracting default config files"
+ tar -xvf /etc/defaults.tar.gz
+ rm -f force_defaults
+ fi
+
+ # Extract any missing files
+ TARFILES=`tar -tf /etc/defaults.tar.gz`
+ for file in $TARFILES; do
+ if [ ! -e $file ]; then
+ tar -xvf /etc/defaults.tar.gz $file
+ fi
+ done
+
+ # Create links in /etc
+ for file in $FILES; do
+ if [ ! -L /etc/$file ]; then
+ echo "Creating link to ${CONFIG_DIR}/$file"
+ rm -rf /etc/$file
+ ln -sf ${CONFIG_DIR}/$file /etc/$file
+ fi
+ done
+
+ ;;
+
+ *)
+ echo "Usage: $0 {start}"
+ exit 2
+ ;;
+
+esac