summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-03-10 17:48:39 -0600
committerJohn Klug <john.klug@multitech.com>2022-03-10 17:48:39 -0600
commitc170ebccd8ea303d689689e654652925fcbc5323 (patch)
tree6b4ce64b3011b41b6a578efe94af08928fe46de3 /recipes-core
parentd69af360a0f97879171814bd056372bad9a7df9d (diff)
downloadmeta-mlinux-c170ebccd8ea303d689689e654652925fcbc5323.tar.gz
meta-mlinux-c170ebccd8ea303d689689e654652925fcbc5323.tar.bz2
meta-mlinux-c170ebccd8ea303d689689e654652925fcbc5323.zip
Guard against circular symlinks
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/multitech/config/config.init11
1 files changed, 9 insertions, 2 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init
index 282b0bb..2a1e0b5 100644
--- a/recipes-core/multitech/config/config.init
+++ b/recipes-core/multitech/config/config.init
@@ -145,6 +145,11 @@ function copydir {
ln -sf "$to/$newdir" "$from"
else
mkdir "$to/$newdir" >/dev/null 2>&1 || true
+ if [[ -L $from ]] ; then
+ # If we have a symlink to a directory,
+ # skip copying any files.
+ return 0
+ fi
savedir=$(pwd)
cd "$from"
for f in * ; do
@@ -285,8 +290,10 @@ case $1 in
rm -rf /etc/$file
ln -sf ${CONFIG_DIR}/$file /etc/$file
else
- rm -f "/etc/${file}/*"
- linkdir "${CONFIG_DIR}/${file}" "/etc/${file}"
+ if ! [[ -L "/etc/${file}" ]] ; then
+ rm -f "/etc/${file}/*"
+ linkdir "${CONFIG_DIR}/${file}" "/etc/${file}"
+ fi
fi
done
;;