]> git.puffer.fish Git - mirror/frr.git/commitdiff
debianpkg: improve VTYSH_PAGER environment check 2208/head
authorPascal Mathis <mail@pascalmathis.com>
Thu, 10 May 2018 22:03:23 +0000 (00:03 +0200)
committerPascal Mathis <mail@pascalmathis.com>
Thu, 10 May 2018 22:03:23 +0000 (00:03 +0200)
The current post-installation scripts for all Debian packages execute
grep 'VTYSH_PAGER=/bin/cat' to check if the VTYSH_PAGER variable is
present within /etc/environment.

While presence of that environment variable should be checked, the
current implementation does not handle this line being a comment (and
therefor not active) or the user picking a different VTYSH_PAGER than
/bin/cat.

This commit ensures that the environment variable can be freely changed
by the user, while still guaranteeing that it is present in the file
without being a comment.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
debianpkg/backports/ubuntu14.04/debian/frr.postinst
debianpkg/frr.postinst

index b1d463a33d96c5885e4ee35ca8d6b5e276967843..5a14e510cd7175d431070505125e7717ee167404 100644 (file)
@@ -18,7 +18,7 @@ chgrp ${frrvtygid} /etc/frr/vtysh*
 chmod 644 /etc/frr/*
 
 ENVIRONMENTFILE=/etc/environment
-if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
+if ! egrep --quiet '^VTYSH_PAGER=' ${ENVIRONMENTFILE}; then
     echo "VTYSH_PAGER=/bin/cat"  >> ${ENVIRONMENTFILE}
 fi
 ##################################################
index 972f8c0500fb500fdd48004307f14e195b9e876b..32af741c989f5580cd678f1d83b6d4a315242f58 100644 (file)
@@ -19,7 +19,7 @@ chgrp ${frrvtygid} /etc/frr/vtysh*
 chmod 644 /etc/frr/*
 
 ENVIRONMENTFILE=/etc/environment
-if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
+if ! egrep --quiet '^VTYSH_PAGER=' ${ENVIRONMENTFILE}; then
     echo "VTYSH_PAGER=/bin/cat"  >> ${ENVIRONMENTFILE}
 fi
 ##################################################