mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
rc: adjust and fix missing pkgng database when using MFS
While there, embed rc.embedded and fix permissions of rc.halt.
This commit is contained in:
parent
a4fab55bc4
commit
18cf4e9ea0
48
src/etc/rc
48
src/etc/rc
@ -17,6 +17,7 @@ HOME=/
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
export HOME PATH
|
||||
|
||||
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /conf/config.xml`
|
||||
PLATFORM=`/bin/cat /usr/local/etc/platform`
|
||||
|
||||
if [ "${PLATFORM}" = "nanobsd" ]; then
|
||||
@ -87,9 +88,35 @@ else
|
||||
fi
|
||||
# !!! migration code for OPNsense <= 15.1.7, do not remove !!!
|
||||
|
||||
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /conf/config.xml`
|
||||
if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
|
||||
/usr/local/etc/rc.embedded
|
||||
USE_MFS_TMP_SIZE=`/usr/bin/grep use_mfs_tmp_size /conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
|
||||
if [ ! -z ${USE_MFS_TMP_SIZE} ] && [ ${USE_MFS_TMP_SIZE} -gt 0 ]; then
|
||||
tmpsize="${USE_MFS_TMP_SIZE}m"
|
||||
else
|
||||
tmpsize="40m"
|
||||
fi
|
||||
|
||||
USE_MFS_VAR_SIZE=`/usr/bin/grep use_mfs_var_size /conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
|
||||
if [ ! -z ${USE_MFS_VAR_SIZE} ] && [ ${USE_MFS_VAR_SIZE} -gt 0 ]; then
|
||||
varsize="${USE_MFS_VAR_SIZE}m"
|
||||
else
|
||||
varsize="60m"
|
||||
fi
|
||||
|
||||
echo -n "Setting up memory disks..."
|
||||
|
||||
if [ ! -d /root/var/db/pkg ]; then
|
||||
/bin/mkdir -p /root/var/db
|
||||
/bin/mv /var/db/pkg /root/var/db/
|
||||
fi
|
||||
|
||||
mdmfs -S -M -s ${tmpsize} md /tmp
|
||||
mdmfs -S -M -s ${varsize} md /var
|
||||
|
||||
/bin/mkdir -p /var/db
|
||||
/bin/ln -s /root/var/db/pkg /var/db/pkg
|
||||
|
||||
echo "done."
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -148,21 +175,18 @@ fi
|
||||
# Enable console output if its muted.
|
||||
/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
|
||||
if [ "$PLATFORM" = "cdrom" -o "$PLATFORM" = "nanobsd" -o \
|
||||
${USE_MFS_TMPVAR} -gt 0 ]; then
|
||||
# do nothing for cdrom and nanobsd platforms
|
||||
else
|
||||
/sbin/swapon -a
|
||||
/usr/local/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
|
||||
# User must have just disabled RAM disks,
|
||||
# let's move these back into place.
|
||||
/bin/mkdir -p /var/db
|
||||
/bin/mv /root/var/db/pkg /var/db/
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Size of /tmp
|
||||
USE_MFS_TMP_SIZE=`/usr/bin/grep use_mfs_tmp_size /conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
|
||||
if [ ! -z ${USE_MFS_TMP_SIZE} ] && [ ${USE_MFS_TMP_SIZE} -gt 0 ]; then
|
||||
tmpsize="${USE_MFS_TMP_SIZE}m"
|
||||
else
|
||||
tmpsize="40m"
|
||||
fi
|
||||
|
||||
# Size of /var
|
||||
USE_MFS_VAR_SIZE=`/usr/bin/grep use_mfs_var_size /conf/config.xml | /usr/bin/cut -f2 -d'>' | /usr/bin/cut -f1 -d'<'`
|
||||
if [ ! -z ${USE_MFS_VAR_SIZE} ] && [ ${USE_MFS_VAR_SIZE} -gt 0 ]; then
|
||||
varsize="${USE_MFS_VAR_SIZE}m"
|
||||
else
|
||||
varsize="60m"
|
||||
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
|
||||
|
||||
# Ensure vi's recover directory is present
|
||||
/bin/mkdir -p /var/tmp/vi.recover/
|
||||
echo " done."
|
||||
0
src/etc/rc.halt
Normal file → Executable file
0
src/etc/rc.halt
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user