diff options
author | Renato Botelho <renato@netgate.com> | 2015-11-23 13:11:55 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-11-23 13:14:13 -0200 |
commit | e7c1f181393533828c27734317d00a988c1f7e31 (patch) | |
tree | 014c657df63765fb88b3017ce9703ff746de0e8e | |
parent | 09f653827f6aed1a45ab9612ceaa5333b93bb065 (diff) | |
download | pfsense-e7c1f181393533828c27734317d00a988c1f7e31.zip pfsense-e7c1f181393533828c27734317d00a988c1f7e31.tar.gz |
Move pkg data around early and fix #5493
-rwxr-xr-x | src/etc/rc | 45 |
1 files changed, 26 insertions, 19 deletions
@@ -96,9 +96,35 @@ if [ "${PLATFORM}" != "cdrom" ]; then fi USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar) + unset MOVE_PKG_DATA + if [ "$PLATFORM" = "${product}" ]; then + # If use MFS var is disabled, move files back to place + if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then + MOVE_PKG_DATA=1 + 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}" = "true" -a -f /var/db/pkg/local.sqlite ]; then + MOVE_PKG_DATA=1 + /bin/mkdir -p /root/var/db /root/var/cache + mv /var/db/pkg /root/var/db + mv /var/cache/pkg /root/var/cache + fi + elif [ "${PLATFORM}" = "nanobsd" ]; then + MOVE_PKG_DATA=1 + fi + if [ "${PLATFORM}" = "nanobsd" ] || [ "${USE_MFS_TMPVAR}" = "true" ]; then /etc/rc.embedded fi + + if [ -n "${MOVE_PKG_DATA}" ]; then + /bin/mkdir -p /var/db /var/cache + ln -sf ../../root/var/db/pkg /var/db/pkg + ln -sf ../../root/var/cache/pkg /var/cache/pkg + fi fi /bin/rm -f /root/force_fsck @@ -165,28 +191,9 @@ echo /sbin/conscontrol mute off >/dev/null if [ "$PLATFORM" = "${product}" ]; then - # If use MFS var is disabled, move files back to place - if [ "${USE_MFS_TMPVAR}" != "true" -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}" = "true" -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 -elif [ "${PLATFORM}" = "nanobsd" ]; then - /bin/mkdir -p /var/db /var/cache - ln -sf ../../root/var/db/pkg /var/db/pkg - ln -sf ../../root/var/cache/pkg /var/cache/pkg fi if [ "$PLATFORM" = "cdrom" ] ; then |