summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-01-04 15:12:16 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-01-04 15:12:16 -0500
commitbd9e8f3d19098563f4798553176d3e3ab9b50b04 (patch)
tree018d079452f9740c8536bfff1d2c63bdafbb0c5f /src
parent2ef8b28334f0f69caf4bec4ecc68fdd85802c185 (diff)
librefetch-install: fix
Diffstat (limited to 'src')
-rw-r--r--src/librefetch/librefetch-install.in16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librefetch/librefetch-install.in b/src/librefetch/librefetch-install.in
index 13ac876..1a18757 100644
--- a/src/librefetch/librefetch-install.in
+++ b/src/librefetch/librefetch-install.in
@@ -20,6 +20,7 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+set -ueE
. "$(librelib messages)"
# This line should be installed
@@ -57,14 +58,15 @@ post_install() {
msg2 "%s: librefetch is already in %q" "${0##*/}" "$(realpath -s "$file")"
local line del=false
for line in "${old_code[@]}"; do
- if has_line "$line"; then
- pre_remove
- post_install
+ if has_line "$file" "$line"; then
+ msg2 "%s: ... but it's an old version" "${0##*/}"
+ pre_remove "$file"
+ post_install "$file"
return $?
fi
done
else
- msg2 "%s: adding librefetch to %1" "${0##*/}" "$(realpath -s "$file")"
+ msg2 "%s: adding librefetch to %q" "${0##*/}" "$(realpath -s "$file")"
printf '%s\n' "$new_code" >> "$file"
fi
}
@@ -75,14 +77,14 @@ pre_remove() {
msg2 "%s: removing librefetch from %q" "${0##*/}" "$(realpath -s "$file")"
# Check for the old stuff
- sed -ri 's/^#(.* )# commented out by the libretools post_install script/\1/' "$file"
+ sed -ri 's/^#(.*) # commented out by the libretools post_install script/\1/' "$file"
local line
for line in "${old_code[@]}"; do
- del_line "$line"
+ del_line "$file" "$line"
done
# Check for the current stuff
- del_line "$new_code"
+ del_line "$file" "$new_code"
}
usage() {