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