Commit 3606a039 authored by Franco Fichtner's avatar Franco Fichtner

rc: start to simplify cdrom handling; zap varmfs/etcmfs

etcmfs has been known to break when /etc gets too big, so
just remove it with a general /tmp partition that is set via
the tools.git through rc.conf and slap unionfs mounts on top.
parent f82a8985
......@@ -24,12 +24,6 @@ PLATFORM=`/bin/cat /usr/local/etc/platform`
# Set our current version
version=`/bin/cat /usr/local/etc/version`
# Setup dumpdev/ddb/savecore"
echo "Configuring crash dumps..."
if [ "$PLATFORM" = "pfSense" ]; then
/usr/local/etc/rc.dumpon
fi
if [ -e /root/force_fsck ]; then
echo "Forcing filesystem check..."
/sbin/fsck -y -t ufs /
......@@ -66,7 +60,16 @@ if [ "$PLATFORM" = "pfSense" ]; then
fi
if [ "${PLATFORM}" = "cdrom" ]; then
/usr/local/etc/rc.cdrom
/etc/rc.d/tmp start
# fake a writeable environment in some subdirs
for i in cf etc home root usr var; do
/bin/mkdir -p /tmp/.cdrom/${i}
/sbin/mount_unionfs /tmp/.cdrom/${i} /${i}
done
# special handling for link
/sbin/mount_nullfs /cf/conf /conf
else
# Mount /. If it fails run a fsck.
if [ "$PLATFORM" = "nanobsd" ]; then
......@@ -132,6 +135,21 @@ else
fi
fi
# set keyboard map if needed
/etc/rc.d/syscons onestart
# probe for a persistent core dump device
/usr/local/etc/rc.dumpon
# Bootstrap config.xml if necessary
if [ ! -f /conf/config.xml ]; then
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
echo " done."
fi
/bin/rm -f /root/force_fsck
/bin/rm -f /root/TRIM_set
/bin/rm -f /root/TRIM_unset
......@@ -210,22 +228,6 @@ if ls /usr/local/share/pbi-keys/*.ssl >/dev/null 2>&1; then
cp -f /usr/local/share/pbi-keys/*.ssl /var/db/pbi/keys
fi
if [ "$PLATFORM" = "cdrom" ] ; then
echo -n "Mounting unionfs directories..."
/bin/mkdir /tmp/unionfs
/bin/mkdir /tmp/unionfs/usr
/bin/mkdir /tmp/unionfs/root
/bin/mkdir /tmp/unionfs/sbin
/bin/mkdir /tmp/unionfs/bin
/bin/mkdir /tmp/unionfs/boot
/sbin/mount_unionfs /tmp/unionfs/usr /usr/
/sbin/mount_unionfs /tmp/unionfs/root /root/
/sbin/mount_unionfs /tmp/unionfs/bin /bin/
/sbin/mount_unionfs /tmp/unionfs/sbin /sbin/
/sbin/mount_unionfs /tmp/unionfs/boot /boot/
echo "done."
fi
# make some directories in /var
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/at/jobs/ /var/empty 2>/dev/null
/bin/rm -rf $varrunpath/*
......
#!/bin/sh
#
# rc.cdrom - livedisc specific routines
# For pfSense
# Size of memory file system /conf /home partitions
partsize="6m"
export VARMFS_COPYDBPKG=yes
for i in tmp varmfs etcmfs; do
if [ -f /etc/rc.d/$i ]; then
sh /etc/rc.d/$i start
fi
done
# Add /conf and populate with stock configuration.
if [ ! -f /conf/config.xml ]; then
echo -n "Generating a MFS /conf partition... "
device=$(mdconfig -a -t malloc -s ${partsize})
newfs /dev/${device} > /dev/null 2>&1
mount /dev/${device} /conf
cp /usr/local/etc/config.xml /conf
mount_nullfs /conf /cf/conf
echo "done."
fi
echo -n "Generating a MFS /home partition... "
device=$(mdconfig -a -t malloc -s ${partsize})
newfs /dev/${device} > /dev/null 2>&1
mount /dev/${device} /home
echo "done."
# Create some needed directories
/bin/mkdir -p /var/db/pkg/
/bin/mkdir -p /var/tmp/vi.recover/
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