summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-28 10:47:08 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-28 10:47:08 -0700
commit374aa37ece5d67d003da358e35f0326da3cd2397 (patch)
treef9dd056dbbe1f8bdaba2faadbd277b090ae792c3 /bin
parent6ec1972b43512356f988fa23aa33c86b3629d16e (diff)
downloadportage-374aa37ece5d67d003da358e35f0326da3cd2397.tar.gz
portage-374aa37ece5d67d003da358e35f0326da3cd2397.tar.bz2
portage-374aa37ece5d67d003da358e35f0326da3cd2397.zip
etc-update: support PAGER env var for bug #384663
Diffstat (limited to 'bin')
-rwxr-xr-xbin/etc-update11
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/etc-update b/bin/etc-update
index 42518adc6..2af04cc4c 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -33,6 +33,12 @@ get_config() {
"${PORTAGE_CONFIGROOT}"etc/etc-update.conf)
}
+cmd_var_is_valid() {
+ # return true if the first whitespace-separated token contained
+ # in "${1}" is an executable file, false otherwise
+ [[ -x $(type -P ${1%%[[:space:]]*}) ]]
+}
+
diff_command() {
local cmd=${diff_command//%file1/$1}
${cmd//%file2/$2}
@@ -566,7 +572,10 @@ using_editor=$(get_config using_editor)
merge_command=$(get_config merge_command)
declare -i mode=$(get_config mode)
[[ -z ${mode} ]] && mode=0
-[[ -z ${pager} ]] && pager="cat"
+if ! cmd_var_is_valid "${pager}" ; then
+ pager=${PAGER}
+ cmd_var_is_valid "${pager}" || pager=cat
+fi
if [ "${using_editor}" == 0 ]; then
# Sanity check to make sure diff exists and works