summaryrefslogtreecommitdiff
path: root/libre-testing/libretools/libretools.install
diff options
context:
space:
mode:
Diffstat (limited to 'libre-testing/libretools/libretools.install')
-rw-r--r--libre-testing/libretools/libretools.install29
1 files changed, 18 insertions, 11 deletions
diff --git a/libre-testing/libretools/libretools.install b/libre-testing/libretools/libretools.install
index a451add36..202456fea 100644
--- a/libre-testing/libretools/libretools.install
+++ b/libre-testing/libretools/libretools.install
@@ -4,10 +4,13 @@ _edit_code=" 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o
_edit_cmnt='#%s # commented out by the libretools post_install script'
_add_cmnt='# The following line is added by the libretools post_install script'
-_add_code='[[ ! -x /usr/bin/librefetch ]] || DLAGENTS+=({https,libre}"::/usr/bin/librefetch -p \"\$BUILDFILE\" -- %u %o")'
+_add_code='DLAGENTS+=({https,libre}"::/usr/bin/librefetch -p $(printf "%q" "$BUILDFILE") -- %u %o")'
-# This line was installed by previous versions of this script
-_old_code='[[ ! -x /usr/bin/librefetch ]] || DLAGENTS+=("libre::/usr/bin/librefetch -p \"\$BUILDFILE\" %u %o")'
+# These lines were installed by previous versions of this script
+_old_code=(
+ '[[ ! -x /usr/bin/librefetch ]] || DLAGENTS+=("libre::/usr/bin/librefetch -p \"\$BUILDFILE\" %u %o")'
+ '[[ ! -x /usr/bin/librefetch ]] || DLAGENTS+=({https,libre}"::/usr/bin/librefetch -p \"\$BUILDFILE\" -- %u %o")'
+)
# has_line $line
has_line() { grep -Fxq -- "$1" etc/makepkg.conf; }
@@ -32,13 +35,14 @@ rep_line() {
post_install() {
if grep -q 'librefetch' etc/makepkg.conf; then
libremessages msg2 "libretools: librefetch is already in /etc/makepkg.conf"
- if has_line "$_old_code"; then
- libremessages msg2 "libretools: removing old librefetch entry in /etc/makepkg.conf"
- del_line "$_old_code"
- post_install
- else
- return 0
- fi
+ local line del=false
+ for line in "${_old_code[@]}"; do
+ if has_line "$line"; then
+ pre_remove
+ post_install
+ return $?
+ fi
+ done
else
libremessages msg2 "libretools: adding librefetch to /etc/makepkg.conf"
rep_line "$_edit_code" "$(printf "$_edit_cmnt" '&')"
@@ -60,5 +64,8 @@ pre_remove() {
del_line "$_add_cmnt"
del_line "$_add_code"
- del_line "$_old_code"
+ local line
+ for line in "${_old_code[@]}"; do
+ del_line "$line"
+ done
}