fs: make symlinking more resilient when something's already at the location
This commit is contained in:
parent
1d0cadce85
commit
19c254c266
|
@ -298,7 +298,10 @@ let
|
||||||
lnfrom="$1"
|
lnfrom="$1"
|
||||||
lnto="$2"
|
lnto="$2"
|
||||||
|
|
||||||
ln -sf --no-dereference "$lnto" "$lnfrom"
|
# ln is clever when there's something else at the place we want to create the link
|
||||||
|
# only create the link if nothing's there or what is there is another link,
|
||||||
|
# otherwise you'll get links at unexpected fs locations
|
||||||
|
! test -e "$lnfrom" || test -L "$lnfrom" && ln -sf --no-dereference "$lnto" "$lnfrom"
|
||||||
'';
|
'';
|
||||||
scriptArgs = [ path link-cfg.target ];
|
scriptArgs = [ path link-cfg.target ];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user