Commit ae871654 authored by Franco Fichtner's avatar Franco Fichtner

rc: migration glue for <= 15.1.7 installs

parent 7f6507d0
...@@ -63,7 +63,6 @@ else ...@@ -63,7 +63,6 @@ else
attempts=0 attempts=0
while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
/sbin/fsck -y / /sbin/fsck -y /
/sbin/fsck -y /cf
/sbin/mount -uw / 2>/dev/null /sbin/mount -uw / 2>/dev/null
mount_rc=$? mount_rc=$?
attempts=$((attempts+1)) attempts=$((attempts+1))
...@@ -80,31 +79,13 @@ else ...@@ -80,31 +79,13 @@ else
done done
fi fi
# If /conf is a directory, convert it to a symlink to /cf/conf # !!! migration code for OPNsense <= 15.1.7, do not remove !!!
if [ -d "/conf" ]; then if [ -d "/cf/conf" ]; then
# If item is not a symlink then rm and recreate /bin/rm -f /conf
CONFPOINTSTO=`readlink /conf` /bin/mv /cf/conf /conf
if ! test "x$CONFPOINTSTO" = "x/cf/conf"; then /bin/rm -rf /cf
/bin/rm -rf /conf
/bin/ln -s /cf/conf /conf
fi
fi
# Check to see if a compact flash mountpoint exists
# If it fails to mount then run a fsck -y
if grep -q cf /etc/fstab; then
/sbin/mount -w /cf 2>/dev/null
/sbin/mount -uw /cf 2>/dev/null
mount_rc=$?
attempts=0
while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
/sbin/umount /cf
/sbin/fsck -y /cf
/sbin/mount -w /cf 2>/dev/null
mount_rc=$?
attempts=$((attempts+1))
done
fi fi
# !!! migration code for OPNsense <= 15.1.7, do not remove !!!
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /conf/config.xml` USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /conf/config.xml`
if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
...@@ -126,11 +107,13 @@ fi ...@@ -126,11 +107,13 @@ fi
# probe for a persistent core dump device # probe for a persistent core dump device
/usr/local/etc/rc.dumpon /usr/local/etc/rc.dumpon
# set up config directory structure
/bin/mkdir -p /conf/backup
/bin/mkdir -p /conf/sshd
# Bootstrap config.xml if necessary # Bootstrap config.xml if necessary
if [ ! -f /conf/config.xml ]; then if [ ! -f /conf/config.xml ]; then
echo -n "Bootstrapping config.xml..." echo -n "Bootstrapping config.xml..."
/bin/mkdir -p /conf/backup
/bin/mkdir -p /conf/sshd
/bin/cp /usr/local/etc/config.xml /conf/config.xml /bin/cp /usr/local/etc/config.xml /conf/config.xml
echo "done." echo "done."
fi fi
...@@ -201,11 +184,6 @@ fi ...@@ -201,11 +184,6 @@ fi
/bin/rm -rf /var/tmp/* /bin/rm -rf /var/tmp/*
echo -n "Creating symlinks..." echo -n "Creating symlinks..."
# Make sure symlink is correct on nanobsd
if [ "$PLATFORM" = "nanobsd" ] ; then
/bin/rm /conf
/bin/ln -s /cf/conf/ /conf
fi
# Repair symlinks if they are broken # Repair symlinks if they are broken
if [ -f /etc/newsyslog.conf ]; then if [ -f /etc/newsyslog.conf ]; then
...@@ -258,10 +236,6 @@ if [ ! -d /var/tmp ]; then ...@@ -258,10 +236,6 @@ if [ ! -d /var/tmp ]; then
/bin/mkdir -p /var/tmp /bin/mkdir -p /var/tmp
fi fi
if [ ! -d /conf/backup/ ]; then
/bin/mkdir -p /conf/backup/
fi
set -T set -T
trap "echo 'Reboot interrupted'; exit 1" 3 trap "echo 'Reboot interrupted'; exit 1" 3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment