summaryrefslogtreecommitdiffstats
path: root/src/etc/rc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-09-30 10:12:36 -0300
committerRenato Botelho <renato@netgate.com>2015-09-30 10:45:56 -0300
commit48b79a600859d1cce8f23835bd7922a64817c74c (patch)
tree823c41533885c0ab613639fcef9d9d373c55dfca /src/etc/rc
parentf39bb5b636b2f8d14cda7d23b29eb732aadf4a78 (diff)
downloadpfsense-48b79a600859d1cce8f23835bd7922a64817c74c.zip
pfsense-48b79a600859d1cce8f23835bd7922a64817c74c.tar.gz
Make sure pkg db and cache is safe on nanobsd and on pfSense with /var mounted as MFS
Diffstat (limited to 'src/etc/rc')
-rwxr-xr-xsrc/etc/rc30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/etc/rc b/src/etc/rc
index 9a67415..f2bb698 100755
--- a/src/etc/rc
+++ b/src/etc/rc
@@ -159,23 +159,25 @@ echo
/sbin/conscontrol mute off >/dev/null
-if [ "$PLATFORM" = "cdrom" ] ; then
- # do nothing for cdrom platform
-elif [ "$PLATFORM" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
- # Ensure that old-style PKG packages can be persistent across reboots
- /bin/mkdir -p /root/var/db/pkg
- /bin/rm -rf /var/db/pkg
- /bin/ln -s /root/var/db/pkg/ /var/db/pkg
-else
+if [ "$PLATFORM" = "pfSense" ]; then
+ # If use MFS var is disabled, move files back to place
+ if [ ${USE_MFS_TMPVAR} -eq 0 -a -d /root/var/db/pkg ]; then
+ rm -rf /var/db/pkg 2>/dev/null
+ rm -rf /var/cache/pkg 2>/dev/null
+ mv /root/var/db/pkg /var/db
+ mv /root/var/cache/pkg /var/cache
+ # If use MFS var is enabled, move files to a safe place
+ elif [ ${USE_MFS_TMPVAR} -gt 0 -a ! -d /root/var/db/pkg ]; then
+ /bin/mkdir -p /root/var/db /root/var/cache
+ mv /var/db/pkg /root/var/db
+ mv /var/cache/pkg /root/var/cache
+ ln -sf ../../root/var/db/pkg /var/db/pkg
+ ln -sf ../../root/var/cache/pkg /var/cache/pkg
+ fi
+
SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
/sbin/swapon -a 2>/dev/null >/dev/null
/etc/rc.savecore
-
- if [ -d /root/var/db/pkg ]; then
- # User must have just disabled RAM disks, move these back into place.
- /bin/mkdir -p /var/db/pkg
- /bin/mv /root/var/db/pkg /var/db/pkg
- fi
fi
if [ "$PLATFORM" = "cdrom" ] ; then
OpenPOWER on IntegriCloud