From: Pascal Mathis Date: Thu, 10 May 2018 22:03:23 +0000 (+0200) Subject: debianpkg: improve VTYSH_PAGER environment check X-Git-Tag: frr-6.1-dev~460^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=332266dbd1b5edd5bc0af3b5a4bd52b62a992fa3;p=matthieu%2Ffrr.git debianpkg: improve VTYSH_PAGER environment check 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 --- diff --git a/debianpkg/backports/ubuntu14.04/debian/frr.postinst b/debianpkg/backports/ubuntu14.04/debian/frr.postinst index b1d463a33d..5a14e510cd 100644 --- a/debianpkg/backports/ubuntu14.04/debian/frr.postinst +++ b/debianpkg/backports/ubuntu14.04/debian/frr.postinst @@ -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 ################################################## diff --git a/debianpkg/frr.postinst b/debianpkg/frr.postinst index 972f8c0500..32af741c98 100644 --- a/debianpkg/frr.postinst +++ b/debianpkg/frr.postinst @@ -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 ##################################################