summaryrefslogtreecommitdiffstats
path: root/etc/rc.embedded
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-03-11 22:16:18 -0400
committerjim-p <jimp@pfsense.org>2013-03-11 22:16:18 -0400
commite92e83d4e2e3465bca9ca6d3cc4f746ef6566476 (patch)
treeb72aaf0e1c0b2130b62c28ff7c6ed84076569f64 /etc/rc.embedded
parent94ca4e0d47cf61b8e8c812ca3dc18356fc166fb0 (diff)
downloadpfsense-e92e83d4e2e3465bca9ca6d3cc4f746ef6566476.zip
pfsense-e92e83d4e2e3465bca9ca6d3cc4f746ef6566476.tar.gz
Add the ability for full installs to optionally use RAM disks for /tmp and /var, and to allow selecting a size for /tmp and /var RAM disks on both Full installs and NanoBSD.
I think I caught most of the edge cases for transitioning into and out of RAM disk mode, and preserving data across reboots as is done on NanoBSD (RRD, DHCP leases, pkg/pbi info).
Diffstat (limited to 'etc/rc.embedded')
-rwxr-xr-xetc/rc.embedded30
1 files changed, 15 insertions, 15 deletions
diff --git a/etc/rc.embedded b/etc/rc.embedded
index ada4558..426495f 100755
--- a/etc/rc.embedded
+++ b/etc/rc.embedded
@@ -4,27 +4,27 @@
# For pfSense
# Size of /tmp
-tmpsize="40m"
+USE_MFS_TMP_SIZE=`/usr/bin/grep use_mfs_tmp_size /cf/conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
+if [ ${USE_MFS_TMP_SIZE} -gt 0 ]; then
+ tmpsize="${USE_MFS_TMP_SIZE}m"
+else
+ tmpsize="40m"
+fi
# Size of /var
-varsize="60m"
+USE_MFS_VAR_SIZE=`/usr/bin/grep use_mfs_var_size /cf/conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
+if [ ${USE_MFS_VAR_SIZE} -gt 0 ]; then
+ varsize="${USE_MFS_VAR_SIZE}m"
+else
+ varsize="60m"
+fi
# Run some initialization routines
[ -f /etc/rc.d/uzip ] && /etc/rc.d/uzip start
-echo -n "Setting up embedded specific environment..."
-# Initialize MFS for /tmp. Partly taken from /etc/rc.d/var
-if (/bin/mkdir -p /tmp/.diskless 2> /dev/null); then
- rmdir /tmp/.diskless
-else
- mdmfs -S -M -s ${tmpsize} md /tmp
-fi
-# Initialize MFS for /var. Partly taken from /etc/rc.d/var
-if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
- rmdir /var/.diskless
-else
- mdmfs -S -M -s ${varsize} md /var
-fi
+echo -n "Setting up memory disks..."
+mdmfs -S -M -s ${tmpsize} md /tmp
+mdmfs -S -M -s ${varsize} md /var
# Create some needed directories
/bin/mkdir -p /var/db
OpenPOWER on IntegriCloud