diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-30 14:33:12 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-30 14:33:36 -0300 |
commit | c580e34c6fe24107817d6a72956e77b23f043beb (patch) | |
tree | 5b2a610df5a8a167ed0d32b48b03611e07489886 /src/etc/rc.shutdown | |
parent | 205c51a217d29316334aebbc0cbc123794ba5160 (diff) | |
download | pfsense-c580e34c6fe24107817d6a72956e77b23f043beb.zip pfsense-c580e34c6fe24107817d6a72956e77b23f043beb.tar.gz |
Consider globals_override.inc and replace hard coded pfSense string by product_name
Diffstat (limited to 'src/etc/rc.shutdown')
-rwxr-xr-x | src/etc/rc.shutdown | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/etc/rc.shutdown b/src/etc/rc.shutdown index aa6468a..bf79683 100755 --- a/src/etc/rc.shutdown +++ b/src/etc/rc.shutdown @@ -5,7 +5,17 @@ if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then exit -1 fi -product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4` +globals_inc="/etc/inc/globals.inc" +if [ -f /etc/inc/globals_override.inc ]; then + globals_inc="/etc/inc/globals_override.inc ${globals_inc}" +fi +product=$(cat ${globals_inc} | \ + grep product_name | \ + head -n 1 | \ + sed 's/^.*=>* *//; s/["\;,]*//g') + +# product cannot be blank +product=${product:-"pfSense"} echo echo "${product} is now shutting down ..." @@ -20,10 +30,10 @@ HOME=/; export HOME PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH -# If PLATFORM is pfSense then remove +# If PLATFORM is $product then remove # temporary files on shutdown from /tmp/ PLATFORM=`cat /etc/platform` -if [ "$PLATFORM" = "pfSense" ]; then +if [ "$PLATFORM" = "${product}" ]; then find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1 fi @@ -31,7 +41,7 @@ USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml` DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'` DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2` # If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot... -if [ "${PLATFORM}" != "pfSense" ] || [ ${USE_MFS_TMPVAR} -gt 0 ] || [ "${DISK_TYPE}" = "md" ]; then +if [ "${PLATFORM}" != "${product}" ] || [ ${USE_MFS_TMPVAR} -gt 0 ] || [ "${DISK_TYPE}" = "md" ]; then /etc/rc.backup_rrd.sh /etc/rc.backup_dhcpleases.sh fi |