mirror of
https://github.com/TheLocehiliosan/yadm
synced 2026-03-02 03:49:29 +00:00
Remove symlinks before processing a template
This commit is contained in:
7
yadm
7
yadm
@@ -498,15 +498,16 @@ function alt_future_linking() {
|
||||
# a template is defined, process the template
|
||||
debug "Creating $filename from template $target"
|
||||
[ -n "$loud" ] && echo "Creating $filename from template $target"
|
||||
# remove any existing symlink before processing template
|
||||
[ -L "$filename" ] && rm -f "$filename"
|
||||
"$template_cmd" "$target" "$filename"
|
||||
elif [ -n "$target" ]; then
|
||||
# a link target is defined, create symlink
|
||||
debug "Linking $target to $filename"
|
||||
[ -n "$loud" ] && echo "Linking $target to $filename"
|
||||
if [ "$do_copy" -eq 1 ]; then
|
||||
if [ -L "$filename" ]; then
|
||||
rm -f "$filename"
|
||||
fi
|
||||
# remove any existing symlink before copying
|
||||
[ -L "$filename" ] && rm -f "$filename"
|
||||
cp -f "$target" "$filename"
|
||||
else
|
||||
ln -nfs "$target" "$filename"
|
||||
|
||||
Reference in New Issue
Block a user