mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Clear up problems with /etc/rc.d/{abi|cleanvar|cleartmp} brought
to light by the PR. Specifically, convert these three scripts into good rc.d citizens, making sure that their functionality is preserved, but the rc.d framework rules are not broken. Add support for cleanvar as a regular rc.d script in the default rc.conf, and document this in the man page. Add a descriptive comment to rc.conf that regarding the three emulation/compatibility services provided by abi so users will not be confused by these services not having their own startup scripts. PR: conf/84574 Submitted by: Alexander Botero-Lowry
This commit is contained in:
parent
f668cd5df7
commit
ea871df08c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153537
|
@ -54,6 +54,7 @@ varmfs="AUTO" # Set to YES to always create an mfs /var, NO to never
|
|||
varsize="32m" # Size of mfs /var if created
|
||||
varmfs_flags="-S -M" # Extra mount options for the mfs /var
|
||||
populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never
|
||||
cleanvar_enable="YES" # Clean the /var directory
|
||||
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
|
||||
script_name_sep=" " # Change if your startup scripts' names contain spaces
|
||||
rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
|
||||
|
@ -483,9 +484,12 @@ check_quotas="YES" # Check quotas on startup (or NO).
|
|||
accounting_enable="NO" # Turn on process accounting (or NO).
|
||||
ibcs2_enable="NO" # Ibcs2 (SCO) emulation loaded at startup (or NO).
|
||||
ibcs2_loaders="coff" # List of additional Ibcs2 loaders (or NO).
|
||||
|
||||
# Emulation/compatibility services provided by /etc/rc.d/abi
|
||||
sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO).
|
||||
linux_enable="NO" # Linux binary compatibility loaded at startup (or NO).
|
||||
svr4_enable="NO" # SysVR4 emulation loaded at startup (or NO).
|
||||
|
||||
osf1_enable="NO" # Alpha OSF/1 emulation loaded at startup (or NO).
|
||||
clear_tmp_enable="NO" # Clear /tmp at startup.
|
||||
ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks
|
||||
|
|
39
etc/rc.d/abi
39
etc/rc.d/abi
|
@ -10,12 +10,9 @@
|
|||
|
||||
. /etc/rc.subr
|
||||
|
||||
echo -n 'Additional ABI support:'
|
||||
|
||||
name="sysvipc"
|
||||
rcvar=`set_rcvar`
|
||||
start_cmd="sysv_start"
|
||||
stop_cmd=":"
|
||||
name="abi"
|
||||
start_precmd="${name}_prestart"
|
||||
start_cmd=":"
|
||||
|
||||
sysv_start()
|
||||
{
|
||||
|
@ -24,12 +21,6 @@ sysv_start()
|
|||
kldload sysvsem >/dev/null 2>&1
|
||||
kldload sysvshm >/dev/null 2>&1
|
||||
}
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
||||
name="linux"
|
||||
rcvar=`set_rcvar`
|
||||
start_cmd="linux_start"
|
||||
|
||||
linux_start()
|
||||
{
|
||||
|
@ -41,15 +32,23 @@ linux_start()
|
|||
/compat/linux/sbin/ldconfig
|
||||
fi
|
||||
}
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
||||
name="svr4"
|
||||
rcvar=`set_rcvar`
|
||||
start_precmd="echo -n ' svr4'"
|
||||
start_cmd="kldload svr4 > /dev/null 2>&1"
|
||||
svr4_start()
|
||||
{
|
||||
echo -n ' svr4'
|
||||
kldload svr4 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
abi_prestart()
|
||||
{
|
||||
echo -n 'Additional ABI support:'
|
||||
|
||||
checkyesno sysvipc_enable && sysv_start
|
||||
checkyesno linux_enable && linux_start
|
||||
checkyesno svr4_enable && svr4_start
|
||||
|
||||
echo '.'
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
||||
echo '.'
|
||||
|
|
|
@ -6,6 +6,18 @@
|
|||
# PROVIDE: cleanvar
|
||||
# REQUIRE: mountcritlocal var
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="cleanvar"
|
||||
rcvar=`set_rcvar`
|
||||
|
||||
start_precmd="${name}_prestart"
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd=":"
|
||||
|
||||
extra_commands="reload"
|
||||
reload_cmd="${name}_start"
|
||||
|
||||
purgedir()
|
||||
{
|
||||
local dir file
|
||||
|
@ -34,20 +46,28 @@ purgedir()
|
|||
fi
|
||||
}
|
||||
|
||||
# These files must be removed only the first time this script is run
|
||||
# on boot.
|
||||
#
|
||||
[ "$1" != "reload" ] && rm -f /var/run/clean_var /var/spool/lock/clean_var
|
||||
cleanvar_prestart()
|
||||
{
|
||||
# These files must be removed only the first time this script is run
|
||||
# on boot.
|
||||
#
|
||||
rm -f /var/run/clean_var /var/spool/lock/clean_var
|
||||
}
|
||||
|
||||
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
|
||||
purgedir /var/run
|
||||
# And an initial utmp file
|
||||
(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
|
||||
>/var/run/clean_var
|
||||
fi
|
||||
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
|
||||
purgedir /var/spool/lock
|
||||
>/var/spool/lock/clean_var
|
||||
fi
|
||||
rm -rf /var/spool/uucp/.Temp/*
|
||||
cleanvar_start ()
|
||||
{
|
||||
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
|
||||
purgedir /var/run
|
||||
# And an initial utmp file
|
||||
(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
|
||||
>/var/run/clean_var
|
||||
fi
|
||||
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
|
||||
purgedir /var/spool/lock
|
||||
>/var/spool/lock/clean_var
|
||||
fi
|
||||
rm -rf /var/spool/uucp/.Temp/*
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
|
@ -12,12 +11,12 @@
|
|||
|
||||
name="cleartmp"
|
||||
rcvar=`set_rcvar clear_tmp`
|
||||
start_cmd="cleartmp_start"
|
||||
stop_cmd=":"
|
||||
x11_socket_dirs="/tmp/.X11-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/.XIM-unix"
|
||||
start_cmd="${name}_start"
|
||||
|
||||
cleartmp_start()
|
||||
{
|
||||
|
||||
local x11_socket_dirs="/tmp/.X11-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/.XIM-unix"
|
||||
echo "Clearing /tmp."
|
||||
#
|
||||
# Prune quickly with one rm, then use find to clean up
|
||||
|
@ -27,14 +26,16 @@ cleartmp_start()
|
|||
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
|
||||
find -x . ! -name . ! -name lost+found ! -name quota.user \
|
||||
! -name quota.group -exec rm -rf -- {} \; -type d -prune)
|
||||
|
||||
# Remove X lock files, since they will prevent you from restarting X.
|
||||
rm -f /tmp/.X[0-9]-lock
|
||||
|
||||
# Create socket directories with correct permissions to avoid
|
||||
# security problem.
|
||||
#
|
||||
rm -fr ${x11_socket_dirs}
|
||||
mkdir -m 1777 ${x11_socket_dirs}
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
||||
# Remove X lock files, since they will prevent you from restarting X.
|
||||
rm -f /tmp/.X[0-9]-lock
|
||||
|
||||
# Create socket directories with correct permissions to avoid security problem.
|
||||
rm -fr ${x11_socket_dirs}
|
||||
mkdir -m 1777 ${x11_socket_dirs}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 10, 2005
|
||||
.Dd December 19, 2005
|
||||
.Dt RC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -322,6 +322,11 @@ Note that this process requires access to certain commands in
|
|||
before
|
||||
.Pa /usr
|
||||
is mounted on normal systems.
|
||||
.It Va cleanvar_enable
|
||||
.Pq Vt bool
|
||||
Clean the
|
||||
.Pa /var
|
||||
directory.
|
||||
.It Va local_startup
|
||||
.Pq Vt str
|
||||
List of directories to search for startup script files.
|
||||
|
|
Loading…
Reference in a new issue