mod_for_test_scripts: change PAGER to /usr/local only if less is there
TEST=image built with less in /usr/bin has correct $PAGER
BUG=None
Change-Id: I8b7f8545ba386ee828ef036fff90f215c3cb74ee
Reviewed-on: https://chromium-review.googlesource.com/317455
Commit-Ready: Andrey Ulanov <andreyu@google.com>
Tested-by: Andrey Ulanov <andreyu@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/mod_for_test_scripts/360setPagerLess b/mod_for_test_scripts/360setPagerLess
index 411800d..5eb8f0e 100755
--- a/mod_for_test_scripts/360setPagerLess
+++ b/mod_for_test_scripts/360setPagerLess
@@ -2,7 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
-# The PAGER variable defaults to /usr/bin/less but it will get installed
+# The PAGER variable defaults to /usr/bin/less but it may get installed
# to /usr/local/bin/less on a test image, so fix the default
+USR_LOCAL="${ROOT_FS_DIR}/usr/local"
+
+if [ ! -f "${USR_LOCAL}/bin/less" ]; then
+ echo "Nothing to do. less is not installed in /usr/local."
+ exit 0
+fi
+
sed -i 's:/usr/bin/less:/usr/local/bin/less:g' ${ROOT_FS_DIR}/etc/profile