fix(deploy): managed symlinks changing owners relink silently; quarantine reserved for genuine divergence
This commit is contained in:
+13
-8
@@ -47,16 +47,21 @@ deploy_file() { # $1 = repo file path, $2 = home-relative target path
|
||||
if [ -L "$tgt" ]; then
|
||||
if [ "$(realpath "$tgt")" = "$(realpath "$src")" ]; then return 0; fi # already deployed
|
||||
case "$MODE" in
|
||||
check) echo "DRIFT $2 (symlink points elsewhere: $(realpath "$tgt"))" ;;
|
||||
check) echo "RELINK $2 (managed symlink changing owners)" ;;
|
||||
adopt) echo "SKIP $2 (foreign symlink, --adopt does not overwrite)" ; skipped=$((skipped+1)) ;;
|
||||
sync)
|
||||
ts="$(date +%Y%m%d-%H%M%S)-$$"
|
||||
dest="$QUAR/$HOST/$ts/$2"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mv -- "$tgt" "$dest"
|
||||
ln -sfn "$(realpath "$src")" "$tgt"
|
||||
actions=$((actions+1)); quarantined=$((quarantined+1))
|
||||
echo "QUAR $2 -> .quarantine/$HOST/$ts/$2"
|
||||
if [[ "$(realpath "$tgt")" == "$REPO/"* ]]; then
|
||||
# managed file changing owners between packages: silent relink, nothing to quarantine
|
||||
ln -sfn "$(realpath "$src")" "$tgt"; actions=$((actions+1))
|
||||
else
|
||||
ts="$(date +%Y%m%d-%H%M%S)-$$"
|
||||
dest="$QUAR/$HOST/$ts/$2"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mv -- "$tgt" "$dest"
|
||||
ln -sfn "$(realpath "$src")" "$tgt"
|
||||
actions=$((actions+1)); quarantined=$((quarantined+1))
|
||||
echo "QUAR $2 -> .quarantine/$HOST/$ts/$2"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user