mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
rc: same fix for /tmp MFS
If users want read-only media they need to put their own /etc/fstab entries into the system as the MFS options from the config should not work under unknown conditions.
This commit is contained in:
parent
653651046f
commit
d26c77a1ea
1
plist
1
plist
@ -134,6 +134,7 @@
|
||||
/usr/local/etc/rc.subr.d/livemode
|
||||
/usr/local/etc/rc.subr.d/recover
|
||||
/usr/local/etc/rc.subr.d/swapon
|
||||
/usr/local/etc/rc.subr.d/tmp
|
||||
/usr/local/etc/rc.subr.d/var
|
||||
/usr/local/etc/rc.syshook
|
||||
/usr/local/etc/rc.syshook.d/05-beep.stop
|
||||
|
||||
10
src/etc/rc
10
src/etc/rc
@ -134,14 +134,8 @@ fi
|
||||
# write /var/run/dmesg.boot
|
||||
/etc/rc.d/dmesg onestart
|
||||
|
||||
USE_MFS_TMP=$(/usr/bin/grep -c 'use_mfs_tmp[^_]' /conf/config.xml)
|
||||
|
||||
if [ ${USE_MFS_TMP} -ne 0 ]; then
|
||||
mount -t tmpfs -o mode=01777 tmpfs /tmp
|
||||
else
|
||||
rm -rf /tmp/*
|
||||
chmod 1777 /tmp
|
||||
fi
|
||||
# all sorts of maintenance tasks for /tmp
|
||||
/usr/local/etc/rc.subr.d/tmp
|
||||
|
||||
# set up and recover a crash dump before activating swap
|
||||
/usr/local/etc/rc.subr.d/crashdump
|
||||
|
||||
46
src/etc/rc.subr.d/tmp
Executable file
46
src/etc/rc.subr.d/tmp
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2014-2018 Franco Fichtner <franco@opnsense.org>
|
||||
# Copyright (c) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
# Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
USE_MFS_TMP=$(/usr/bin/grep -c 'use_mfs_tmp[^_]' /conf/config.xml)
|
||||
|
||||
# see if / is writable (aka. non-LiveCD boot)
|
||||
if _tmpdir=$(mktemp -d -q /.diskless.XXXXXX); then
|
||||
# only remove the directory
|
||||
rmdir ${_tmpdir}
|
||||
else
|
||||
USE_MFS_TMP=0
|
||||
fi
|
||||
|
||||
if [ ${USE_MFS_TMP} -ne 0 ]; then
|
||||
mount -t tmpfs -o mode=01777 tmpfs /tmp
|
||||
else
|
||||
rm -rf /tmp/*
|
||||
chmod 1777 /tmp
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user