diff options
Diffstat (limited to 'recipes-core')
-rw-r--r-- | recipes-core/multitech/config/config.init | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init index 2a1e0b5..f4611ab 100644 --- a/recipes-core/multitech/config/config.init +++ b/recipes-core/multitech/config/config.init @@ -1,5 +1,5 @@ #!/bin/sh - +set -x CONFIG_DIR=/var/config RUN_CONF_DIR=/run/config @@ -163,7 +163,7 @@ function copydir { links+=(${f}) continue fi - if ! [[ -f "$to/$f" ]] ; then + if ! [[ -f "$to/${newdir}/$f" ]] ; then cp -a "${f}" "$to/${newdir}/${f}" fi done @@ -222,14 +222,13 @@ case $1 in # Create links in /etc for file in $FILES; do if ! [[ -L /etc/$file ]] && ! [[ -d /etc/$file ]] ; then - rm -rf /etc/$file - ln -sf ${CONFIG_DIR}/$file /etc/$file - elif [[ -d /etc/$file ]] ; then - # JAK create links in directory. - linkdir "${CONFIG_DIR}/${file}" "/etc/${file}" + rm -rf /etc/$file + ln -sf ${CONFIG_DIR}/$file /etc/$file + elif [[ -d /etc/$file ]] ; then + linkdir "${CONFIG_DIR}/${file}" "/etc/${file}" fi done - + # Move bluetooth wifi stuff to config directory. # We don't have factory defaults. ((dobackup=1)) @@ -248,19 +247,21 @@ case $1 in # We must copy individual files and create symlinks instead. for file in ${BTWIFIFILES}; do isdir=0 - # If last character is /, make the CONFIG directory. + # If last character is /, make the CONFIG directory. if [[ ${file: -1} == / ]] ; then isdir=1 file=${file%?} - if ! [[ -d ${CONFIG_DIR}/$file ]] ; then + if ! [[ -d ${CONFIG_DIR}/$file ]] ; then rm -f ${CONFIG_DIR}/$file 2>/dev/null || true - mkdir ${CONFIG_DIR}/$file - fi - if [[ -d ${file} ]] ; then + mkdir ${CONFIG_DIR}/$file + ln -sf ${CONFIG_DIR}/$file /etc/$file 2>/dev/null || true + fi + + if [[ -d ${file} ]] && [[ -d /etc/${file} ]] ; then copydir "/etc/${file}" "${CONFIG_DIR}" fi - fi - + fi + if ((isdir == 0)); then dir=$(dirname $file) if [[ $dir != '.' ]] ; then @@ -287,8 +288,10 @@ case $1 in ) rm -rf old fi - rm -rf /etc/$file - ln -sf ${CONFIG_DIR}/$file /etc/$file + if [[ -e /etc/$file ]] ; then + rm -rf /etc/$file + ln -sf ${CONFIG_DIR}/$file /etc/$file + fi else if ! [[ -L "/etc/${file}" ]] ; then rm -f "/etc/${file}/*" |