kiss: replace sed -i with redirection to a temp file

This commit is contained in:
Ethan Sommer 2020-04-28 02:17:01 -04:00
parent d46bbf517d
commit be793fb1f7
1 changed files with 7 additions and 2 deletions

9
kiss
View File

@ -799,14 +799,19 @@ pkg_swap() {
# Convert the current owner to an alternative and rewrite
# its manifest file to reflect this.
cp -Pf "$2" "$pkg_owns>${alt#*>}"
sed -i "$(esc "$2" "$PWD/$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"
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 -i "$(esc "$PWD/$alt" "$2")" "../installed/$1/manifest"
sed "$(esc "$PWD/$alt" "$2")" "../installed/$1/manifest" > \
"../installed/$1/manifest.tmp"
mv -f "../installed/$1/manifest.tmp" "../installed/$1/manifest"
}
pkg_install_files() {