From 332266dbd1b5edd5bc0af3b5a4bd52b62a992fa3 Mon Sep 17 00:00:00 2001 From: Pascal Mathis Date: Fri, 11 May 2018 00:03:23 +0200 Subject: [PATCH] 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 --- debianpkg/backports/ubuntu14.04/debian/frr.postinst | 2 +- debianpkg/frr.postinst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ################################################## -- 2.39.5