diff options
-rw-r--r-- | recipes-core/multitech/config/config.init | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init index 17ee777..8b1abe5 100644 --- a/recipes-core/multitech/config/config.init +++ b/recipes-core/multitech/config/config.init @@ -3,6 +3,7 @@ CONFIG_MTDC=/dev/mtd6 CONFIG_MTDB=/dev/mtdblock6 CONFIG_DIR=/var/config +RUN_CONF_DIR=/run/config OEM_MTDC=/dev/mtd7 OEM_MTDB=/dev/mtdblock7 @@ -60,6 +61,10 @@ mount_oem() { case $1 in start) + if ! [[ -f /run/config/device_info.json ]] ; then + [[ -d /run/config ]] || mkdir -m 755 -p /run/config + /sbin/get-eeprom-device-info -t1 # Radio might not be found yet. + fi # mount config if not already mounted if ! grep -q "^${CONFIG_MTDB} " /proc/mounts; then mount_config @@ -129,45 +134,45 @@ case $1 in 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 + # 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 - fi - rm -rf /etc/$file - ln -sf ${CONFIG_DIR}/$file /etc/$file - 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 |