mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 03:29:06 +00:00 
			
		
		
		
	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>
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash -e
 | 
						|
 | 
						|
######################
 | 
						|
PASSWDFILE=/etc/passwd
 | 
						|
GROUPFILE=/etc/group
 | 
						|
 | 
						|
frruid=`egrep "^frr:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
 | 
						|
frrgid=`egrep "^frr:" $GROUPFILE | awk -F ":" '{ print $3 }'`
 | 
						|
frrvtygid=`egrep "^frrvty:" $GROUPFILE | awk -F ":" '{ print $3 }'`
 | 
						|
 | 
						|
[ -n ${frruid} ]    || (echo "No uid for frr in ${PASSWDFILE}"   && /bin/false)
 | 
						|
[ -n ${frrgid} ]    || (echo "No gid for frr in ${GROUPFILE}"    && /bin/false)
 | 
						|
[ -n ${frrVTYgid} ] || (echo "No gid for frrvty in ${GROUPFILE}" && /bin/false)
 | 
						|
 | 
						|
chown ${frruid}:${frrgid} /etc/frr
 | 
						|
chown ${frruid}:${frrgid} /etc/frr/*
 | 
						|
touch /etc/frr/vtysh.conf
 | 
						|
chgrp ${frrvtygid} /etc/frr/vtysh*
 | 
						|
chmod 644 /etc/frr/*
 | 
						|
 | 
						|
ENVIRONMENTFILE=/etc/environment
 | 
						|
if ! egrep --quiet '^VTYSH_PAGER=' ${ENVIRONMENTFILE}; then
 | 
						|
    echo "VTYSH_PAGER=/bin/cat"  >> ${ENVIRONMENTFILE}
 | 
						|
fi
 | 
						|
##################################################
 | 
						|
 | 
						|
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
 | 
						|
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
 | 
						|
 | 
						|
# This is most likely due to the answer "no" to the "really stop the server"
 | 
						|
# question in the prerm script.
 | 
						|
if [ "$1" = "abort-upgrade" ]; then
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
 | 
						|
#DEBHELPER#
 | 
						|
 |