aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-28 21:06:19 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-28 21:06:19 +0000
commit8bf2a805b2f8494485d8edc7bbcde345cbbd26c5 (patch)
tree8b0fad8bb1bc38a4ce221d5b9e008c845d4c8312
parentf9aa9cd90ed52cba6a360f43462fc62ff6b961cb (diff)
downloadcpt-8bf2a805b2f8494485d8edc7bbcde345cbbd26c5.tar.gz
kiss: avoid sed -i
FossilOrigin-Name: 37f917404e7bfc5a6ce0c7173bbd91d6db7a9815f04369ecceb6cc29c78dfceb
-rwxr-xr-xkiss13
1 files changed, 9 insertions, 4 deletions
diff --git a/kiss b/kiss
index 52a2252..c5ec626 100755
--- a/kiss
+++ b/kiss
@@ -826,11 +826,12 @@ pkg_conflicts() {
"$tar_dir/$p_name/$cho_dir/$p_name$con_name"
regex_escape "$con" "/$cho_dir/$p_name$con_name"
+ mani=$tar_dir/$p_name/$pkg_db/$p_name/manifest
# Rewrite the package's manifest to update its location
# to its new spot (and name) in the choices directory.
- sed -i "s/^$sea\$/$rep/" \
- "$tar_dir/$p_name/$pkg_db/$p_name/manifest"
+ sed "s/^$sea\$/$rep/" "$mani" > "$mani.1"
+ mv -f "$mani.1" "$mani"
done
else
if "$grep" -Fxf "$cac_dir/$pid-m" -- "$@"; then
@@ -872,19 +873,23 @@ pkg_swap() {
log "Swapping '$2' from '$pkg_owns' to '$1'"
regex_escape "$2" "$PWD/$pkg_owns>${alt#*>}"
+ mani=${PWD%/*}/installed/$pkg_owns/manifest
# Convert the current owner to an alternative and rewrite
# its manifest file to reflect this.
dosu cp -f "'$2'" "'$pkg_owns>${alt#*>}'"
- dosu sed -i "'s/^$sea\$/$rep/'" "'../installed/$pkg_owns/manifest'"
+ dosu sed "'s/^$sea\$/$rep/'" \
+ "'$mani' > '$mani.1' && mv -f '$mani.1' '$mani'"
fi
regex_escape "$PWD/$alt" "$2"
+ mani=${PWD%/*}/installed/$1/manifest
# Convert the desired alternative to a real file and rewrite
# the manifest file to reflect this. The reverse of above.
dosu mv -f "'$alt'" "'$2'"
- dosu sed -i "'s/^$sea\$/$rep/'" "'../installed/$1/manifest'"
+ dosu sed "'s/^$sea\$/$rep/'" \
+ "'$mani' > '$mani.1' && mv -f '$mani.1' '$mani'"
}
pkg_remove() {