diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2014-01-20 20:50:55 -0200 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2014-01-20 20:50:55 -0200 |
commit | 39c64730f2efb54aa5c409bfd585e1d9fd10357e (patch) | |
tree | dc2ce167d77eae63eeb182308ad713e81680df52 /libre-testing/libretools/libretools.install | |
parent | 798e0029a8b8ba950b4ef20a2b229e06f3086dd2 (diff) | |
parent | ab3686a1307a02a1a12859ac1be35b36a16bac9a (diff) |
Merge branch 'master' of ssh://projects.parabolagnulinux.org:1863/srv/git/abslibre
Diffstat (limited to 'libre-testing/libretools/libretools.install')
-rw-r--r-- | libre-testing/libretools/libretools.install | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/libre-testing/libretools/libretools.install b/libre-testing/libretools/libretools.install index a451add36..35edf68c7 100644 --- a/libre-testing/libretools/libretools.install +++ b/libre-testing/libretools/libretools.install @@ -4,10 +4,14 @@ _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 "$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")' + 'DLAGENTS+=({https,libre}"::/usr/bin/librefetch -p $(printf "%q" "$BUILDFILE") -- %u %o")' +) # has_line $line has_line() { grep -Fxq -- "$1" etc/makepkg.conf; } @@ -32,13 +36,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 +65,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 } |