dir_prep fixes

Merge pull request #235 from icenine451/cooker-0.6.1b-icenine451
This commit is contained in:
XargonWan 2023-01-11 08:56:23 +01:00 committed by GitHub
commit 63f77057e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -502,6 +502,12 @@ dir_prep() {
mv -f "$symlink" "$symlink.old" mv -f "$symlink" "$symlink.old"
fi fi
# if the real dir is already a symlink, unlink it first
if [ -L "$real" ];
then
unlink "$real"
fi
# if the real dir doesn't exist we create it # if the real dir doesn't exist we create it
if [ ! -d "$real" ]; if [ ! -d "$real" ];
then then
@ -518,7 +524,7 @@ dir_prep() {
if [ -d "$symlink.old" ]; if [ -d "$symlink.old" ];
then then
echo "Moving the data from $symlink.old to $real" #DEBUG echo "Moving the data from $symlink.old to $real" #DEBUG
mv -f "$symlink".old/* $real mv -f "$symlink.old"/{.[!.],}* $real
echo "Removing $symlink.old" #DEBUG echo "Removing $symlink.old" #DEBUG
rm -rf "$symlink.old" rm -rf "$symlink.old"
fi fi