diff options
author | merakor <cem@ckyln.com> | 2020-05-09 15:36:20 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-05-09 15:36:20 +0000 |
commit | c2d982785297f51d568096638d899940da4b7a3f (patch) | |
tree | 4bf9bc296590202d0db6870b8b35be5c17a2a1b2 | |
parent | 1dd28319950e2eb0a1e30c9577a5c7b1ec790971 (diff) | |
download | cpt-c2d982785297f51d568096638d899940da4b7a3f.tar.gz |
kiss: remove esc function
FossilOrigin-Name: 401e07356a89e0ea40664a76dbe03b46b7bca0a993eed8f12a96b20005ab21ff
-rwxr-xr-x | kiss | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -66,15 +66,6 @@ as_root() { esac } -esc() { - # Escape all required characters in both the search and - # replace portions of two strings for use in a 'sed' call - # as "plain-text". - printf 's/^%s$/%s/' \ - "$(printf %s "$1" | sed 's/[]\/$*.^[]/\\&/g')" \ - "$(printf %s "$2" | sed 's/[\/&]/\\&/g')" -} - pop() { # Remove an item from a "string list". This allows us # to remove a 'sed' call and reuse this code throughout. @@ -923,7 +914,7 @@ pkg_swap() { # 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#*>}")" \ + sed "s#^$2#$PWD/$pkg_owns>${alt#*>}#" \ "../installed/$pkg_owns/manifest" | sort -r -o "../installed/$pkg_owns/manifest" fi @@ -931,7 +922,7 @@ pkg_swap() { # 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" | + sed "s#^$PWD/$alt#$2#" "../installed/$1/manifest" | sort -r -o "../installed/$1/manifest" } |