aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-08 20:56:20 +0000
committermerakor <cem@ckyln.com>2020-05-08 20:56:20 +0000
commit1cac0fc4205b78995d5fff32fa4a002c4232be5d (patch)
treef09e5b4d7e19b5dd56b49736ac3e3f332c285233
parent1e6fc1f606bfc04ab81f3eec27bbff7173de0be2 (diff)
downloadcpt-1cac0fc4205b78995d5fff32fa4a002c4232be5d.tar.gz
kiss: sort manifest during pkg_swap
Issues may arise during package removal, and there may be leftover files if we don't reverse sort the manifest when we are swapping files around. FossilOrigin-Name: a43039025ea2c6f0cf1989fd2a683cf3916926aa2396fc00a44c824679188632
-rwxr-xr-xkiss14
1 files changed, 6 insertions, 8 deletions
diff --git a/kiss b/kiss
index 91e28b3..7305269 100755
--- a/kiss
+++ b/kiss
@@ -928,21 +928,19 @@ pkg_swap() {
log "Swapping '$2' from '$pkg_owns' to '$1'"
# Convert the current owner to an alternative and rewrite
- # its manifest file to reflect this.
+ # its manifest file to reflect this. We then resort this file
+ # so no issues arise when removing packages.
cp -Pf "$2" "$pkg_owns>${alt#*>}"
sed "$(esc "$2" "$PWD/$pkg_owns>${alt#*>}")" \
- "../installed/$pkg_owns/manifest" > \
- "../installed/$pkg_owns/manifest.tmp"
- mv -f "../installed/$pkg_owns/manifest.tmp" \
- "../installed/$pkg_owns/manifest"
+ "../installed/$pkg_owns/manifest" |
+ sort -r -o "../installed/$pkg_owns/manifest"
fi
# Convert the desired alternative to a real file and rewrite
# the manifest file to reflect this. The reverse of above.
mv -f "$alt" "$2"
- sed "$(esc "$PWD/$alt" "$2")" "../installed/$1/manifest" > \
- "../installed/$1/manifest.tmp"
- mv -f "../installed/$1/manifest.tmp" "../installed/$1/manifest"
+ sed "$(esc "$PWD/$alt" "$2")" "../installed/$1/manifest" |
+ sort -r -o "../installed/$pkg_owns/manifest"
}
pkg_etc() {