summaryrefslogtreecommitdiffstats
path: root/src/etc/rc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-01 13:26:03 -0300
committerRenato Botelho <renato@netgate.com>2015-10-01 13:27:30 -0300
commite4121dde007c66ec9e2f4c9ecb4a94d38c5fa6cc (patch)
tree211ec70afaea8c0610814f461dd3b040f157c158 /src/etc/rc
parent3ece711605c23bda1176e341d8f96417d3b82b5d (diff)
downloadpfsense-e4121dde007c66ec9e2f4c9ecb4a94d38c5fa6cc.zip
pfsense-e4121dde007c66ec9e2f4c9ecb4a94d38c5fa6cc.tar.gz
Introduce read_global_var:
- Add a new script, read_global_var, that returns the value of any item contained in global array $g - Replace all grep and sed magic from shell scripts
Diffstat (limited to 'src/etc/rc')
-rwxr-xr-xsrc/etc/rc25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/etc/rc b/src/etc/rc
index 22dec60..a0531c9 100755
--- a/src/etc/rc
+++ b/src/etc/rc
@@ -25,17 +25,9 @@ PLATFORM=`/bin/cat /etc/platform`
# Set our current version
version=`/bin/cat /etc/version`
-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"}
+# Read product_name from $g, defaults to pfSense
+# Use php -n here because we are not ready to load extensions yet
+product=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var product_name pfSense)
# Setup dumpdev/ddb/savecore"
echo "Configuring crash dumps..."
@@ -148,17 +140,16 @@ if [ "$CDDEVICE" != "" ]; then
cdcontrol -f /dev/"$CDDEVICE" eject
fi
-varrunpath=$(cat ${globals_inc} | \
- grep varrun_path | \
- head -n 1 | \
- sed 's/^.*=>* *//; s/["\;,]*//g')
+# Use php -n here because we are not ready to load extensions yet
+varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run")
if [ "$PLATFORM" = "${product}" ] && [ "${USE_MFS_TMPVAR}" != "true" ]; then
/sbin/mdmfs -S -M -s 4m md $varrunpath
fi
-hideplatform=$(egrep -c 'hideplatform.*=>* *true' ${globals_inc} 2>/dev/null)
-if [ "$hideplatform" -gt "0" ]; then
+# Use php -n here because we are not ready to load extensions yet
+hideplatform=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var hideplatform)
+if [ "$hideplatform" = "true" ]; then
platformbanner="" # hide the platform
else
platformbanner=" on the '${PLATFORM}' platform"
OpenPOWER on IntegriCloud