diff options
author | John Klug <john.klug@multitech.com> | 2022-03-30 15:19:41 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2022-03-30 15:19:41 -0500 |
commit | fde4f2a2ea3232a610fb80562bfd1a04cad558c4 (patch) | |
tree | 783c9cfa180812002449215dabab4ea2339ed656 /recipes-core | |
parent | 0290ef5fb26e58dcf67956c3d3a2321420aa2633 (diff) | |
download | meta-mlinux-fde4f2a2ea3232a610fb80562bfd1a04cad558c4.tar.gz meta-mlinux-fde4f2a2ea3232a610fb80562bfd1a04cad558c4.tar.bz2 meta-mlinux-fde4f2a2ea3232a610fb80562bfd1a04cad558c4.zip |
Files in directories were not preserved when update image was written.
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}/*" |