Style.
This commit is contained in:
parent
eaa32c75c9
commit
e70a142956
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
extra_commands="save"
|
extra_commands="save"
|
||||||
@ -7,8 +7,8 @@ extra_commands="save"
|
|||||||
description="Sets the local clock to UTC or Local Time."
|
description="Sets the local clock to UTC or Local Time."
|
||||||
description_save="Saves the current time in the BIOS."
|
description_save="Saves the current time in the BIOS."
|
||||||
|
|
||||||
clock=${clock:-${CLOCK:-UTC}}
|
: ${clock:=${CLOCK:-UTC}}
|
||||||
if [ "${clock}" = "UTC" ]; then
|
if [ "$clock" = "UTC" ]; then
|
||||||
utc="UTC"
|
utc="UTC"
|
||||||
else
|
else
|
||||||
utc="Local Time"
|
utc="Local Time"
|
||||||
@ -18,8 +18,8 @@ depend()
|
|||||||
{
|
{
|
||||||
provide clock
|
provide clock
|
||||||
# BSD adjkerntz needs to be able to write to /etc
|
# BSD adjkerntz needs to be able to write to /etc
|
||||||
if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] ||
|
if [ "$clock" = "UTC" -a -e /etc/wall_cmos_clock ] ||
|
||||||
[ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
|
[ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
|
||||||
need root
|
need root
|
||||||
fi
|
fi
|
||||||
keyword nojail noprefix
|
keyword nojail noprefix
|
||||||
@ -28,7 +28,7 @@ depend()
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Starting the System Clock Adjuster [${utc}]"
|
ebegin "Starting the System Clock Adjuster [${utc}]"
|
||||||
if [ "${clock}" != "UTC" ]; then
|
if [ "$clock" != "UTC" ]; then
|
||||||
echo >/etc/wall_cmos_clock
|
echo >/etc/wall_cmos_clock
|
||||||
start-stop-daemon --start --exec /sbin/adjkerntz -- -i
|
start-stop-daemon --start --exec /sbin/adjkerntz -- -i
|
||||||
else
|
else
|
||||||
@ -48,8 +48,8 @@ save()
|
|||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
# Don't tweak the hardware clock on LiveCD halt.
|
# Don't tweak the hardware clock on LiveCD halt.
|
||||||
if yesno "${clock_systohc:-${CLOCK_SYSTOHC}}"; then
|
if yesno "${clock_systohc:-$CLOCK_SYSTOHC}"; then
|
||||||
[ -z "${CDBOOT}" ] && save
|
[ -z "$CDBOOT" ] && save
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Stopping the System Clock Adjuster"
|
ebegin "Stopping the System Clock Adjuster"
|
||||||
|
@ -16,25 +16,27 @@ dir_writeable()
|
|||||||
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
|
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
||||||
|
|
||||||
cleanup_tmp_dir()
|
cleanup_tmp_dir()
|
||||||
{
|
{
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
|
||||||
if ! [ -d "${dir}" ]; then
|
if ! [ -d "$dir" ]; then
|
||||||
mkdir -p "${dir}" || return $?
|
mkdir -p "$dir" || return $?
|
||||||
fi
|
fi
|
||||||
dir_writeable "${dir}" || return 1
|
dir_writeable "$dir" || return 1
|
||||||
chmod +t "${dir}"
|
chmod +t "$dir"
|
||||||
cd "${dir}"
|
cd "$dir"
|
||||||
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
|
if yesno $wipe_tmp; then
|
||||||
ebegin "Wiping ${dir} directory"
|
ebegin "Wiping $dir directory"
|
||||||
local startopts="-x . -depth"
|
local startopts="-x . -depth"
|
||||||
[ "${RC_UNAME}" = Linux ] && startopts=". -xdev -depth"
|
[ "$RC_UNAME" = Linux ] && startopts=". -xdev -depth"
|
||||||
|
|
||||||
# Faster than find
|
# Faster than find
|
||||||
rm -rf -- [^ajlq\.]*
|
rm -rf -- [^ajlq\.]*
|
||||||
|
|
||||||
find ${startopts} ! -name . \
|
find $startopts ! -name . \
|
||||||
! -path "./lost+found" \
|
! -path "./lost+found" \
|
||||||
! -path "./lost+found/*" \
|
! -path "./lost+found/*" \
|
||||||
! -path "./quota.user" \
|
! -path "./quota.user" \
|
||||||
@ -52,11 +54,11 @@ cleanup_tmp_dir()
|
|||||||
-exec rm -rf {} \;
|
-exec rm -rf {} \;
|
||||||
eend 0
|
eend 0
|
||||||
else
|
else
|
||||||
ebegin "Cleaning ${dir} directory"
|
ebegin "Cleaning $dir directory"
|
||||||
rm -rf -- "${dir}"/.X*-lock "${dir}"/esrv* "${dir}"/kio* \
|
rm -rf -- "$dir"/.X*-lock "$dir"/esrv* "$dir"/kio* \
|
||||||
"${dir}"/jpsock.* "${dir}"/.fam* "${dir}"/.esd* \
|
"$dir"/jpsock.* "$dir"/.fam* "$dir"/.esd* \
|
||||||
"${dir}"/orbit-* "${dir}"/ssh-* "${dir}"/ksocket-* \
|
"$dir"/orbit-* "$dir"/ssh-* "$dir"/ksocket-* \
|
||||||
"${dir}"/.*-unix
|
"$dir"/.*-unix
|
||||||
eend 0
|
eend 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -71,12 +73,15 @@ mkutmp()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
|
# Remove any added console dirs
|
||||||
|
rm -rf "$RC_LIBDIR"/console
|
||||||
|
|
||||||
local logw=false runw=false
|
local logw=false runw=false
|
||||||
# Ensure that our basic dirs exist
|
# Ensure that our basic dirs exist
|
||||||
for x in /var/log /var/run /tmp; do
|
for x in /var/log /var/run /tmp; do
|
||||||
if ! [ -d "${x}" ]; then
|
if ! [ -d $x ]; then
|
||||||
if ! mkdir -p "${x}"; then
|
if ! mkdir -p $x; then
|
||||||
eend 1 "failed to create needed directory ${x}"
|
eend 1 "failed to create needed directory $x"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -85,9 +90,9 @@ start()
|
|||||||
if dir_writeable /var/run; then
|
if dir_writeable /var/run; then
|
||||||
ebegin "Creating user login records"
|
ebegin "Creating user login records"
|
||||||
local xtra=
|
local xtra=
|
||||||
[ "${RC_UNAME}" = NetBSD ] && xtra=x
|
[ "$RC_UNAME" = NetBSD ] && xtra=x
|
||||||
for x in "" $xtra; do
|
for x in "" $xtra; do
|
||||||
mkutmp /var/run/utmp${x}
|
mkutmp /var/run/utmp$x
|
||||||
done
|
done
|
||||||
[ -e /var/log/wtmp ] && mkutmp /var/log/wtmp
|
[ -e /var/log/wtmp ] && mkutmp /var/log/wtmp
|
||||||
eend 0
|
eend 0
|
||||||
@ -98,22 +103,22 @@ start()
|
|||||||
! -name ld-elf.so.hints ! -name ld.so.hints);
|
! -name ld-elf.so.hints ! -name ld.so.hints);
|
||||||
do
|
do
|
||||||
# Clean stale sockets
|
# Clean stale sockets
|
||||||
if [ -S "${x}" ]; then
|
if [ -S "$x" ]; then
|
||||||
if type fuser >/dev/null 2>&1; then
|
if type fuser >/dev/null 2>&1; then
|
||||||
fuser "${x}" 2>/dev/null || rm "${x}"
|
fuser "$x" 2>/dev/null || rm -- "$x"
|
||||||
else
|
else
|
||||||
rm "${x}"
|
rm -- "$x"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ ! -f "${x}" ] && continue
|
[ ! -f "$x" ] && continue
|
||||||
# Do not remove pidfiles of already running daemons
|
# Do not remove pidfiles of already running daemons
|
||||||
case "${x}" in
|
case "$x" in
|
||||||
*.pid)
|
*.pid)
|
||||||
start-stop-daemon --test --quiet \
|
start-stop-daemon --test --quiet \
|
||||||
--stop --pidfile "${x}" && continue
|
--stop --pidfile "$x" && continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
rm -f -- "${x}"
|
rm -f -- "$x"
|
||||||
done
|
done
|
||||||
eend 0
|
eend 0
|
||||||
fi
|
fi
|
||||||
@ -121,7 +126,7 @@ start()
|
|||||||
# Clean up /tmp directories
|
# Clean up /tmp directories
|
||||||
local tmp=
|
local tmp=
|
||||||
for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do
|
for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do
|
||||||
cleanup_tmp_dir "${tmp}"
|
cleanup_tmp_dir "$tmp"
|
||||||
done
|
done
|
||||||
|
|
||||||
if dir_writeable /tmp; then
|
if dir_writeable /tmp; then
|
||||||
@ -131,12 +136,14 @@ start()
|
|||||||
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
if [ -x /sbin/restorecon ]; then
|
||||||
|
restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${logw} || dir_writeable /var/log; then
|
if $logw || dir_writeable /var/log; then
|
||||||
# Create an 'after-boot' dmesg log
|
# Create an 'after-boot' dmesg log
|
||||||
if [ "${RC_SYS}" != VSERVER -a "${RC_SYS}" != OPENVZ ]; then
|
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
|
||||||
dmesg > /var/log/dmesg
|
dmesg > /var/log/dmesg
|
||||||
chmod 640 /var/log/dmesg
|
chmod 640 /var/log/dmesg
|
||||||
fi
|
fi
|
||||||
@ -149,10 +156,10 @@ start()
|
|||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
# Write a halt record if we're shutting down
|
# Write a halt record if we're shutting down
|
||||||
if [ "${RC_RUNLEVEL}" = shutdown ]; then
|
if [ "$RC_RUNLEVEL" = shutdown ]; then
|
||||||
[ "${RC_UNAME}" = Linux ] && halt -w
|
[ "$RC_UNAME" = Linux ] && halt -w
|
||||||
if [ "${RC_SYS}" = OPENVZ ]; then
|
if [ "$RC_SYS" = OPENVZ ]; then
|
||||||
yesno ${RC_REBOOT} && printf "" >/reboot
|
yesno $RC_REBOOT && printf "" >/reboot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Sets a font for the consoles."
|
description="Sets a font for the consoles."
|
||||||
@ -7,27 +7,24 @@ description="Sets a font for the consoles."
|
|||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
need localmount termencoding
|
need localmount termencoding
|
||||||
after hotplug
|
after hotplug bootmisc
|
||||||
keyword noopenvz noprefix nouml novserver noxenu
|
keyword noopenvz noprefix nouml novserver noxenu
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
# Forget about any font until we are successful
|
|
||||||
rm -rf "${RC_LIBDIR}"/console
|
|
||||||
|
|
||||||
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||||
consolefont=${consolefont:-${CONSOLEFONT}}
|
consolefont=${consolefont:-${CONSOLEFONT}}
|
||||||
unicodemap=${unicodemap:-${UNICODEMAP}}
|
unicodemap=${unicodemap:-${UNICODEMAP}}
|
||||||
consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}}
|
consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}}
|
||||||
|
|
||||||
if [ -z "${consolefont}" ]; then
|
if [ -z "$consolefont" ]; then
|
||||||
ebegin "Using the default console font"
|
ebegin "Using the default console font"
|
||||||
eend 0
|
eend 0
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${ttyn}" = 0 ]; then
|
if [ "$ttyn" = 0 ]; then
|
||||||
ebegin "Skipping font setup (rc_tty_number == 0)"
|
ebegin "Skipping font setup (rc_tty_number == 0)"
|
||||||
eend 0
|
eend 0
|
||||||
return 0
|
return 0
|
||||||
@ -36,39 +33,39 @@ start()
|
|||||||
local x= param= sf_param= retval=0 ttydev=/dev/tty
|
local x= param= sf_param= retval=0 ttydev=/dev/tty
|
||||||
|
|
||||||
# Get additional parameters
|
# Get additional parameters
|
||||||
if [ -n "${consoletranslation}" ]; then
|
if [ -n "$consoletranslation" ]; then
|
||||||
param="${param} -m ${consoletranslation}"
|
param="$param -m $consoletranslation"
|
||||||
fi
|
fi
|
||||||
if [ -n "${unicodemap}" ]; then
|
if [ -n "${unicodemap}" ]; then
|
||||||
param="${param} -u ${unicodemap}"
|
param="$param -u $unicodemap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the console font
|
# Set the console font
|
||||||
ebegin "Setting console font [${consolefont}]"
|
ebegin "Setting console font [$consolefont]"
|
||||||
[ -d /dev/vc ] && ttydev=/dev/vc/
|
[ -d /dev/vc ] && ttydev=/dev/vc/
|
||||||
x=1
|
x=1
|
||||||
while [ ${x} -le ${ttyn} ]; do
|
while [ $x -le $ttyn ]; do
|
||||||
setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null
|
setfont $consolefont $param -C $ttydev$x >/dev/null
|
||||||
retval=$((${retval} + $?))
|
retval=$(($retval + $?))
|
||||||
x=$((${x} + 1))
|
x=$(($x + 1))
|
||||||
done
|
done
|
||||||
eend ${retval}
|
eend $retval
|
||||||
|
|
||||||
# Store the last font so we can use it ASAP on boot
|
# Store the last font so we can use it ASAP on boot
|
||||||
if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then
|
if [ $retval -eq 0 -a -w "$RC_LIBDIR" ]; then
|
||||||
mkdir -p "${RC_LIBDIR}"/console
|
mkdir -p "$RC_LIBDIR"/console
|
||||||
for font in /usr/share/consolefonts/"${consolefont}".*; do
|
for font in /usr/share/consolefonts/"$consolefont".*; do
|
||||||
:
|
:
|
||||||
done
|
done
|
||||||
cp "${font}" "${RC_LIBDIR}"/console
|
cp "$font" "$RC_LIBDIR"/console
|
||||||
echo "${font##*/}" > "${RC_LIBDIR}"/console/font
|
echo "${font##*/}" >"$RC_LIBDIR"/console/font
|
||||||
if yesno ${unicode:-${UNICODE}}; then
|
if yesno ${unicode:-${UNICODE}}; then
|
||||||
echo "" > "${RC_LIBDIR}"/console/unicode
|
echo "" > "$RC_LIBDIR"/console/unicode
|
||||||
else
|
else
|
||||||
rm -f "${RC_LIBDIR}"/console/unicode
|
rm -f "$RC_LIBDIR"/console/unicode
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return ${retval}
|
return $retval
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/sbin/devd
|
command=/sbin/devd
|
||||||
command_args=${devd_args}
|
command_args=$devd_args
|
||||||
name="Device State Change Daemon"
|
name="Device State Change Daemon"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
|
@ -15,19 +15,19 @@ start() {
|
|||||||
"devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \
|
"devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \
|
||||||
"tmpfs /dev/shm 1777 ,nodev shm" \
|
"tmpfs /dev/shm 1777 ,nodev shm" \
|
||||||
; do
|
; do
|
||||||
set -- ${x}
|
set -- $x
|
||||||
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
|
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
|
||||||
mountinfo -q "$2" && continue
|
mountinfo -q $2 && continue
|
||||||
|
|
||||||
if [ ! -d "$2" ]; then
|
if [ ! -d $2 ]; then
|
||||||
mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \
|
mkdir -m $3 -p $2 >/dev/null 2>&1 || \
|
||||||
ewarn "Could not create $2!"
|
ewarn "Could not create $2!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$2" ]; then
|
if [ -d $2 ]; then
|
||||||
ebegin "Mounting $2"
|
ebegin "Mounting $2"
|
||||||
if ! fstabinfo --mount "$2"; then
|
if ! fstabinfo --mount $2; then
|
||||||
mount -n -t "$1" -o noexec,nosuid"$4" "$5" "$2"
|
mount -n -t $1 -o noexec,nosuid$4 $5 $2
|
||||||
fi
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
@ -12,7 +12,7 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
if [ -n "${dmesg_level}" ]; then
|
if [ -n "$dmesg_level" ]; then
|
||||||
dmesg -n"${dmesg_level}"
|
dmesg -n$dmesg_level
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ depend() {
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
# Setup any user requested dump device
|
# Setup any user requested dump device
|
||||||
if [ -n "${dump_device}" ]; then
|
if [ -n "$dump_device" ]; then
|
||||||
ebegin "Activating kernel core dump device (${dump_device})"
|
ebegin "Activating kernel core dump device ($dump_device)"
|
||||||
dumpon ${dump_device}
|
dumpon ${dump_device}
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
@ -19,7 +19,7 @@ _abort() {
|
|||||||
|
|
||||||
# We should only reboot when first booting
|
# We should only reboot when first booting
|
||||||
_reboot() {
|
_reboot() {
|
||||||
if [ "${RC_RUNLEVEL}" = "${RC_BOOTLEVEL}" ]; then
|
if [ "$RC_RUNLEVEL" = "$RC_BOOTLEVEL" ]; then
|
||||||
reboot "$@"
|
reboot "$@"
|
||||||
_abort || return 1
|
_abort || return 1
|
||||||
fi
|
fi
|
||||||
@ -39,40 +39,40 @@ start()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if _forcefsck; then
|
if _forcefsck; then
|
||||||
fsck_opts="${fsck_opts} -f"
|
fsck_opts="$fsck_opts -f"
|
||||||
check_extra="(check forced)"
|
check_extra="(check forced)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${fsck_passno}" ]; then
|
if [ -n "$fsck_passno" ]; then
|
||||||
check_extra="[passno ${fsck_passno}] ${check_extra}"
|
check_extra="[passno $fsck_passno] $check_extra"
|
||||||
fi
|
fi
|
||||||
ebegin "Checking local filesystems ${check_extra}"
|
ebegin "Checking local filesystems $check_extra"
|
||||||
for p in ${fsck_passno}; do
|
for p in $fsck_passno; do
|
||||||
local IFS="${_IFS}"
|
local IFS="$_IFS"
|
||||||
case "${p}" in
|
case "$p" in
|
||||||
[0-9]*) p="=${p}";;
|
[0-9]*) p="=$p";;
|
||||||
esac
|
esac
|
||||||
set -- "$@" $(fstabinfo --passno "${p}")
|
set -- "$@" $(fstabinfo --passno "$p")
|
||||||
unset IFS
|
unset IFS
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
fsck_opts="${fsck_opts} -C0 -T"
|
fsck_opts="$fsck_opts -C0 -T"
|
||||||
if [ -z "${fsck_passno}" ]; then
|
if [ -z "$fsck_passno" ]; then
|
||||||
fsck_args=${fsck_args--A -p}
|
fsck_args=${fsck_args--A -p}
|
||||||
if echo 2>/dev/null >/.test.$$; then
|
if echo 2>/dev/null >/.test.$$; then
|
||||||
rm -f /.test.$$
|
rm -f /.test.$$
|
||||||
fsck_opts="${fsck_opts} -R"
|
fsck_opts="$fsck_opts -R"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap : INT QUIT
|
trap : INT QUIT
|
||||||
fsck ${fsck_args--p} ${fsck_opts} "$@"
|
fsck ${fsck_args--p} $fsck_opts "$@"
|
||||||
case $? in
|
case $? in
|
||||||
0) eend 0; return 0;;
|
0) eend 0; return 0;;
|
||||||
1) ewend 1 "Filesystems repaired"; return 0;;
|
1) ewend 1 "Filesystems repaired"; return 0;;
|
||||||
2|3) if [ "${RC_UNAME}" = "Linux" ]; then
|
2|3) if [ "$RC_UNAME" = Linux ]; then
|
||||||
ewend 1 "Filesystems repaired, but reboot needed"
|
ewend 1 "Filesystems repaired, but reboot needed"
|
||||||
_reboot -f
|
_reboot -f
|
||||||
else
|
else
|
||||||
@ -80,7 +80,7 @@ start()
|
|||||||
"manual fsck required"
|
"manual fsck required"
|
||||||
_abort
|
_abort
|
||||||
fi;;
|
fi;;
|
||||||
4) if [ "${RC_UNAME}" = "Linux" ]; then
|
4) if [ "$RC_UNAME" = Linux ]; then
|
||||||
ewend 1 "Fileystem errors left uncorrected, aborting"
|
ewend 1 "Fileystem errors left uncorrected, aborting"
|
||||||
_abort
|
_abort
|
||||||
else
|
else
|
||||||
@ -101,6 +101,6 @@ stop()
|
|||||||
_reboot() { return 0; }
|
_reboot() { return 0; }
|
||||||
_forcefsck() { return 1; }
|
_forcefsck() { return 1; }
|
||||||
|
|
||||||
yesno "${fsck_shutdown}" && start
|
yesno $fsck_shutdown && start
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
extra_commands="reset"
|
extra_commands="reset"
|
||||||
hostid_file=${hostid_file:-/etc/hostid}
|
: ${hostid_file:=/etc/hostid}
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
@ -20,14 +20,14 @@ _set()
|
|||||||
id=$(echo "$1" | md5)
|
id=$(echo "$1" | md5)
|
||||||
id="0x${id%????????????????????????}"
|
id="0x${id%????????????????????????}"
|
||||||
fi
|
fi
|
||||||
ebegin "Setting Host ID: ${id}"
|
ebegin "Setting Host ID: $id"
|
||||||
sysctl -w kern.hostid="${id}" >/dev/null
|
sysctl -w kern.hostid="$id" >/dev/null
|
||||||
eend $? || return 1
|
eend $? || return 1
|
||||||
|
|
||||||
if sysctl -n kern.hostuuid >/dev/null 2>&1; then
|
if sysctl -n kern.hostuuid >/dev/null 2>&1; then
|
||||||
[ -n "$1" ] && id=$1
|
[ -n "$1" ] && id=$1
|
||||||
ebegin "Setting Host UUID: ${id}"
|
ebegin "Setting Host UUID: $id"
|
||||||
sysctl kern.hostuuid="${id}" >/dev/null
|
sysctl kern.hostuuid="$id" >/dev/null
|
||||||
eend $? || return 1
|
eend $? || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -38,37 +38,37 @@ _set()
|
|||||||
# otherwise we generate a random UUID.
|
# otherwise we generate a random UUID.
|
||||||
reset()
|
reset()
|
||||||
{
|
{
|
||||||
local uuid= x="[0-9a-f]" y="${x}${x}${x}${x}"
|
local uuid= x="[0-9a-f]" y="$x$x$x$x"
|
||||||
|
|
||||||
if type kenv >/dev/null 2>&1; then
|
if type kenv >/dev/null 2>&1; then
|
||||||
uuid=$(kenv smbios.system.uuid 2>/dev/null)
|
uuid=$(kenv smbios.system.uuid 2>/dev/null)
|
||||||
fi
|
fi
|
||||||
case "${uuid}" in
|
case "$uuid" in
|
||||||
${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
|
$y$y-$y-$y-$y-$y$y$y);;
|
||||||
*) uuid=;;
|
*) uuid=;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "${uuid}" ]; then
|
if [ -n "$uuid" ]; then
|
||||||
rm -f "${hostid_file}"
|
rm -f "$hostid_file"
|
||||||
else
|
else
|
||||||
uuid=$(uuidgen)
|
uuid=$(uuidgen)
|
||||||
if [ -z "${uuid}" ]; then
|
if [ -z "$uuid" ]; then
|
||||||
eerror "Unable to generate a UUID"
|
eerror "Unable to generate a UUID"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! echo "${uuid}" > "${hostid_file}"; then
|
if ! echo "$uuid" >"$hostid_file"; then
|
||||||
eerror "Failed to store UUID in \`${hostid_file}'"
|
eerror "Failed to store UUID in \`$hostid_file'"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_set "${uuid}"
|
_set "$uuid"
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
if [ -r "${hostid_file}" ]; then
|
if [ -r "$hostid_file" ]; then
|
||||||
_set $(cat "${hostid_file}")
|
_set $(cat "$hostid_file")
|
||||||
else
|
else
|
||||||
reset
|
reset
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Sets the hostname of the machine."
|
description="Sets the hostname of the machine."
|
||||||
@ -11,7 +11,7 @@ depend() {
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
hostname=${hostname-${HOSTNAME-localhost}}
|
hostname=${hostname-${HOSTNAME-localhost}}
|
||||||
ebegin "Setting hostname to ${hostname}"
|
ebegin "Setting hostname to $hostname"
|
||||||
hostname "${hostname}"
|
hostname "$hostname"
|
||||||
eend $? "Failed to set the hostname"
|
eend $? "Failed to set the hostname"
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,11 @@ description="Sets the local clock to UTC or Local Time."
|
|||||||
description_save="Saves the current time in the BIOS."
|
description_save="Saves the current time in the BIOS."
|
||||||
description_show="Displays the current time in the BIOS."
|
description_show="Displays the current time in the BIOS."
|
||||||
|
|
||||||
clock_adjfile=${clock_adjfile:-${CLOCK_ADJFILE}}
|
: ${clock_adjfile:=${CLOCK_ADJFILE}}
|
||||||
clock_args=${clock_args:-${CLOCK_OPTS}}
|
: ${clock_args:=${CLOCK_OPTS}}
|
||||||
clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}}
|
: ${clock_systohc:=${CLOCK_SYSTOHC}}
|
||||||
|
: ${clock:=${CLOCK:-UTC}}
|
||||||
clock=${clock:-${CLOCK:-UTC}}
|
if [ "$clock" = "UTC" ]; then
|
||||||
if [ "${clock}" = "UTC" ]; then
|
|
||||||
utc="UTC"
|
utc="UTC"
|
||||||
utc_cmd="--utc"
|
utc_cmd="--utc"
|
||||||
else
|
else
|
||||||
@ -24,7 +23,7 @@ fi
|
|||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
provide clock
|
provide clock
|
||||||
if yesno ${clock_adjfile}; then
|
if yesno $clock_adjfile; then
|
||||||
use root
|
use root
|
||||||
else
|
else
|
||||||
before *
|
before *
|
||||||
@ -47,7 +46,7 @@ setupopts()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${utc}" in
|
case "$utc" in
|
||||||
UTC|Local" "Time);;
|
UTC|Local" "Time);;
|
||||||
*) unset utc_cmd;;
|
*) unset utc_cmd;;
|
||||||
esac
|
esac
|
||||||
@ -58,7 +57,7 @@ _hwclock()
|
|||||||
{
|
{
|
||||||
local err="$(hwclock "$@" 2>&1 >/dev/null)"
|
local err="$(hwclock "$@" 2>&1 >/dev/null)"
|
||||||
|
|
||||||
[ -z "${err}" ] && return 0
|
[ -z "$err" ] && return 0
|
||||||
echo "${err}" >&2
|
echo "${err}" >&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@ -68,38 +67,38 @@ start()
|
|||||||
local retval=0 errstr=""
|
local retval=0 errstr=""
|
||||||
setupopts
|
setupopts
|
||||||
|
|
||||||
if [ -z "${utc_cmd}" ]; then
|
if [ -z "$utc_cmd" ]; then
|
||||||
ewarn "Not setting clock for ${utc} system"
|
ewarn "Not setting clock for $utc system"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Setting system clock using the hardware clock [${utc}]"
|
ebegin "Setting system clock using the hardware clock [$utc]"
|
||||||
if [ -e /proc/modules ]; then
|
if [ -e /proc/modules ]; then
|
||||||
local rtc=
|
local rtc=
|
||||||
for rtc in /dev/rtc /dev/rtc[0-9]*; do
|
for rtc in /dev/rtc /dev/rtc[0-9]*; do
|
||||||
[ -e "${rtc}" ] && break
|
[ -e "$rtc" ] && break
|
||||||
done
|
done
|
||||||
if [ ! -e "${rtc}" ]; then
|
if [ ! -e "${rtc}" ]; then
|
||||||
modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc
|
modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then
|
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
|
||||||
_hwclock --adjust ${utc_cmd}
|
_hwclock --adjust $utc_cmd
|
||||||
retval=$((${retval} + $?))
|
retval=$(($retval + $?))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If setting UTC, don't bother to run hwclock when first booting
|
# If setting UTC, don't bother to run hwclock when first booting
|
||||||
# as that's the default
|
# as that's the default
|
||||||
if [ "${PREVLEVEL}" != "N" -o \
|
if [ "$PREVLEVEL" != N -o \
|
||||||
"${utc_cmd}" != "--utc" -o \
|
"$utc_cmd}" != --utc -o \
|
||||||
-n "${clock_args}" ];
|
-n "$clock_args" ];
|
||||||
then
|
then
|
||||||
_hwclock --hctosys ${utc_cmd} ${clock_args}
|
_hwclock --hctosys $utc_cmd $clock_args
|
||||||
retval=$((${retval} + $?))
|
retval=$(($retval + $?))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eend ${retval} "Failed to set the system clock"
|
eend $retval "Failed to set the system clock"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -107,37 +106,37 @@ start()
|
|||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
# Don't tweak the hardware clock on LiveCD halt.
|
# Don't tweak the hardware clock on LiveCD halt.
|
||||||
[ -n "${CDBOOT}" ] && return 0
|
[ -n "$CDBOOT" ] && return 0
|
||||||
yesno ${clock_systohc} || return 0
|
yesno $clock_systohc || return 0
|
||||||
|
|
||||||
local retval=0 errstr=""
|
local retval=0 errstr=""
|
||||||
setupopts
|
setupopts
|
||||||
|
|
||||||
[ -z "${utc_cmd}" ] && return 0
|
[ -z "$utc_cmd" ] && return 0
|
||||||
|
|
||||||
ebegin "Setting hardware clock using the system clock" "[${utc}]"
|
ebegin "Setting hardware clock using the system clock" "[$utc]"
|
||||||
|
|
||||||
if ! yesno "${clock_adjfile}"; then
|
if ! yesno $clock_adjfile; then
|
||||||
# Some implementations don't handle adjustments
|
# Some implementations don't handle adjustments
|
||||||
if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then
|
if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then
|
||||||
utc_cmd="${utc_cmd} --noadjfile"
|
utc_cmd="$utc_cmd --noadjfile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_hwclock --systohc ${utc_cmd} ${clock_args}
|
_hwclock --systohc $utc_cmd $clock_args
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
eend ${retval} "Failed to sync clocks"
|
eend $retval "Failed to sync clocks"
|
||||||
}
|
}
|
||||||
|
|
||||||
save()
|
save()
|
||||||
{
|
{
|
||||||
clock_systohc="yes"
|
clock_systohc=yes
|
||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
show()
|
show()
|
||||||
{
|
{
|
||||||
setupopts
|
setupopts
|
||||||
hwclock --show "${utc_cmd}" ${clock_args}
|
hwclock --show "$utc_cmd" $clock_args
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
# This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD
|
# This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD
|
||||||
@ -95,24 +95,24 @@ start() {
|
|||||||
|
|
||||||
# Add permits for this workstations published services below
|
# Add permits for this workstations published services below
|
||||||
# Only IPs and nets in firewall_allowservices is allowed in.
|
# Only IPs and nets in firewall_allowservices is allowed in.
|
||||||
for i in ${ipfw_ip_in}; do
|
for i in $ipfw_ip_in; do
|
||||||
for p in ${ipfw_ports_in}; do
|
for p in $ipfw_ports_in; do
|
||||||
ipfw add pass tcp from ${i} to me ${p}
|
ipfw add pass tcp from $i to me $p
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# Allow all connections from trusted IPs.
|
# Allow all connections from trusted IPs.
|
||||||
# Playing with the content of firewall_trusted could seriously
|
# Playing with the content of firewall_trusted could seriously
|
||||||
# degrade the level of protection provided by the firewall.
|
# degrade the level of protection provided by the firewall.
|
||||||
for i in ${ipfw_ip_trust}; do
|
for i in $ipfw_ip_trust; do
|
||||||
ipfw add pass ip from ${i} to me
|
ipfw add pass ip from $i to me
|
||||||
done
|
done
|
||||||
|
|
||||||
ipfw add 65000 count ip from any to any
|
ipfw add 65000 count ip from any to any
|
||||||
|
|
||||||
# Drop packets to ports where we don't want logging
|
# Drop packets to ports where we don't want logging
|
||||||
for p in ${ipfw_ports_nolog}; do
|
for p in $ipfw_ports_nolog; do
|
||||||
ipfw add deny { tcp or udp } from any to any ${p} in
|
ipfw add deny { tcp or udp } from any to any $p in
|
||||||
done
|
done
|
||||||
|
|
||||||
# Broadcasts and muticasts
|
# Broadcasts and muticasts
|
||||||
@ -129,10 +129,10 @@ start() {
|
|||||||
|
|
||||||
# Deny and (if wanted) log the rest unconditionally.
|
# Deny and (if wanted) log the rest unconditionally.
|
||||||
if yesno ${ipfw_log_deny:-no}; then
|
if yesno ${ipfw_log_deny:-no}; then
|
||||||
log="log"
|
log=log
|
||||||
sysctl net.inet.ip.fw.verbose=1 >/dev/null
|
sysctl net.inet.ip.fw.verbose=1 >/dev/null
|
||||||
fi
|
fi
|
||||||
ipfw add deny ${log} ip from any to any
|
ipfw add deny $log ip from any to any
|
||||||
|
|
||||||
eend 0
|
eend 0
|
||||||
}
|
}
|
||||||
|
@ -4,23 +4,24 @@
|
|||||||
|
|
||||||
description="Applies a keymap for the consoles."
|
description="Applies a keymap for the consoles."
|
||||||
|
|
||||||
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
|
||||||
unicode=${unicode:-${UNICODE}}
|
|
||||||
keymap=${keymap:-${KEYMAP}}
|
|
||||||
extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}}
|
|
||||||
windowkeys=${windowkeys:-${SET_WINDOWSKEYS}}
|
|
||||||
fix_euro=${fix_euro:-${FIX_EURO}}
|
|
||||||
dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}}
|
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
need localmount termencoding
|
need localmount termencoding
|
||||||
|
after bootmisc
|
||||||
keyword noopenvz noprefix nouml novserver noxenu
|
keyword noopenvz noprefix nouml novserver noxenu
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
if [ -z "${keymap}" ]; then
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||||
|
: ${unicode:=$UNICODE}
|
||||||
|
: =${keymap:=$KEYMAP}
|
||||||
|
: ${extended_keymaps:=$EXTENDED_KEYMAPS}
|
||||||
|
: ${windowkeys:=$SET_WINDOWSKEYS}
|
||||||
|
: ${fix_euro:=$FIX_EURO}
|
||||||
|
: ${dumpkeys_charset:=${DUMPKEYS_CHARSET}}
|
||||||
|
|
||||||
|
if [ -z "$keymap" ]; then
|
||||||
eerror "You need to setup keymap in /etc/conf.d/keymaps first"
|
eerror "You need to setup keymap in /etc/conf.d/keymaps first"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -33,18 +34,18 @@ start()
|
|||||||
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Loading key mappings [${keymap}]"
|
ebegin "Loading key mappings [$keymap]"
|
||||||
local loadkeys_uni= wkeys= kmode="-a" msg="ASCII"
|
local loadkeys_uni= wkeys= kmode="-a" msg="ASCII"
|
||||||
if yesno ${unicode}; then
|
if yesno $unicode; then
|
||||||
loadkeys_uni="--unicode"
|
loadkeys_uni="--unicode"
|
||||||
kmode="-u"
|
kmode="-u"
|
||||||
msg="UTF-8"
|
msg="UTF-8"
|
||||||
fi
|
fi
|
||||||
yesno ${windowkeys} && wkeys="windowkeys"
|
yesno $windowkeys && wkeys="windowkeys"
|
||||||
loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps}
|
loadkeys -q $loadkeys_uni $wkeys $keymap $extended_keymaps
|
||||||
eend $? "Error loading key mappings" || return $?
|
eend $? "Error loading key mappings" || return $?
|
||||||
|
|
||||||
if yesno ${fix_euro}; then
|
if yesno $fix_euro; then
|
||||||
ebegin "Fixing font for euro symbol"
|
ebegin "Fixing font for euro symbol"
|
||||||
# Fix some fonts displaying the Euro, #173528.
|
# Fix some fonts displaying the Euro, #173528.
|
||||||
echo "altgr keycode 18 = U+20AC" | loadkeys -q
|
echo "altgr keycode 18 = U+20AC" | loadkeys -q
|
||||||
@ -53,21 +54,21 @@ start()
|
|||||||
|
|
||||||
# Set terminal encoding to either ASCII or UNICODE.
|
# Set terminal encoding to either ASCII or UNICODE.
|
||||||
# See utf-8(7) for more information.
|
# See utf-8(7) for more information.
|
||||||
ebegin "Setting keyboard mode [${msg}]"
|
ebegin "Setting keyboard mode [$msg]"
|
||||||
if yesno ${unicode}; then
|
if yesno $unicode; then
|
||||||
dumpkeys ${dumpkeys_charset:+-c} \
|
dumpkeys ${dumpkeys_charset:+-c} \
|
||||||
${dumpkeys_charset} | loadkeys --unicode
|
$dumpkeys_charset | loadkeys --unicode
|
||||||
fi
|
fi
|
||||||
n=1
|
n=1
|
||||||
while [ ${n} -le "${ttyn}" ]; do
|
while [ $n -le $ttyn ]; do
|
||||||
kbd_mode "${kmode}" -C "${ttydev}${n}"
|
kbd_mode $kmode -C $ttydev$n
|
||||||
n=$((${n} + 1))
|
n=$(($n + 1))
|
||||||
done
|
done
|
||||||
eend 0
|
eend 0
|
||||||
|
|
||||||
# Save the keymapping for use immediately at boot
|
# Save the keymapping for use immediately at boot
|
||||||
if [ -w "${RC_LIBDIR}" ]; then
|
if [ -w "$RC_LIBDIR" ]; then
|
||||||
mkdir -p "${RC_LIBDIR}"/console
|
mkdir -p "$RC_LIBDIR"/console
|
||||||
dumpkeys >"${RC_LIBDIR}"/console/keymap
|
dumpkeys >"$RC_LIBDIR"/console/keymap
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Mounts disks and swap according to /etc/fstab."
|
description="Mounts disks and swap according to /etc/fstab."
|
||||||
@ -15,12 +15,12 @@ start()
|
|||||||
{
|
{
|
||||||
# Mount local filesystems in /etc/fstab.
|
# Mount local filesystems in /etc/fstab.
|
||||||
local types="noproc" x=
|
local types="noproc" x=
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
types="${types},${x}"
|
types="${types},${x}"
|
||||||
done
|
done
|
||||||
|
|
||||||
ebegin "Mounting local filesystems"
|
ebegin "Mounting local filesystems"
|
||||||
mount -at "${types}"
|
mount -at "$types"
|
||||||
eend $? "Some local filesystem failed to mount"
|
eend $? "Some local filesystem failed to mount"
|
||||||
|
|
||||||
# Always return 0 - some local mounts may not be critical for boot
|
# Always return 0 - some local mounts may not be critical for boot
|
||||||
@ -33,31 +33,31 @@ stop()
|
|||||||
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
|
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
|
||||||
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
|
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
|
||||||
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
OIFS=${IFS} SIFS=${IFS-y}
|
OIFS=$IFS SIFS=${IFS-y}
|
||||||
IFS=$IFS:
|
IFS=$IFS:
|
||||||
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
for x in $no_umounts $RC_NO_UMOUNTS; do
|
||||||
no_umounts_r="${no_umounts_r}|${x}"
|
no_umounts_r="$no_umounts_r|$x"
|
||||||
done
|
done
|
||||||
if [ "${SIFS}" = "y" ]; then
|
if [ "$SIFS" = y ]; then
|
||||||
IFS=$OIFS
|
IFS=$OIFS
|
||||||
else
|
else
|
||||||
unset IFS
|
unset IFS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
|
no_umounts_r="$no_umounts_r|/proc|/proc/.*|/sys|/sys/.*"
|
||||||
fi
|
fi
|
||||||
no_umounts_r="^(${no_umounts_r})$"
|
no_umounts_r="^($no_umounts_r)$"
|
||||||
|
|
||||||
# Flush all pending disk writes now
|
# Flush all pending disk writes now
|
||||||
sync; sync
|
sync; sync
|
||||||
|
|
||||||
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||||
|
|
||||||
# Umount loopback devices
|
# Umount loopback devices
|
||||||
einfo "Unmounting loopback devices"
|
einfo "Unmounting loopback devices"
|
||||||
eindent
|
eindent
|
||||||
do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \
|
do_unmount "umount -d" --skip-point-regex "$no_umounts_r" \
|
||||||
--node-regex "^/dev/loop"
|
--node-regex "^/dev/loop"
|
||||||
eoutdent
|
eoutdent
|
||||||
|
|
||||||
@ -66,12 +66,12 @@ stop()
|
|||||||
einfo "Unmounting filesystems"
|
einfo "Unmounting filesystems"
|
||||||
eindent
|
eindent
|
||||||
local fs=
|
local fs=
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
fs="${fs}${fs:+|}${x}"
|
fs="$fs${fs:+|}$x"
|
||||||
done
|
done
|
||||||
[ -n "${fs}" ] && fs="^(${fs})$"
|
[ -n "$fs" ] && fs="^($fs)$"
|
||||||
do_unmount "umount" --skip-point-regex "${no_umounts_r}" \
|
do_unmount umount --skip-point-regex "$no_umounts_r" \
|
||||||
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
${fs:+--skip-fstype-regex} $fs --nonetdev
|
||||||
eoutdent
|
eoutdent
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -17,8 +17,8 @@ restore()
|
|||||||
eindent
|
eindent
|
||||||
for mixer in /dev/mixer*; do
|
for mixer in /dev/mixer*; do
|
||||||
if [ -r "/var/db/${mixer#/dev/}-state" ]; then
|
if [ -r "/var/db/${mixer#/dev/}-state" ]; then
|
||||||
vebegin "${mixer}"
|
vebegin "$mixer"
|
||||||
mixer -f "${mixer}" \
|
mixer -f "$mixer" \
|
||||||
$(cat "/var/db/${mixer#/dev/}-state") >/dev/null
|
$(cat "/var/db/${mixer#/dev/}-state") >/dev/null
|
||||||
veend $?
|
veend $?
|
||||||
: $((retval += $?))
|
: $((retval += $?))
|
||||||
@ -37,11 +37,11 @@ stop()
|
|||||||
ebegin "Saving mixer settings"
|
ebegin "Saving mixer settings"
|
||||||
eindent
|
eindent
|
||||||
for mixer in /dev/mixer*; do
|
for mixer in /dev/mixer*; do
|
||||||
vebegin "${mixer}"
|
vebegin "$mixer"
|
||||||
mixer -f "${mixer}" -s >/var/db/"${mixer#/dev/}"-state
|
mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state
|
||||||
veend $?
|
veend $?
|
||||||
: $((retval += $?))
|
: $((retval += $?))
|
||||||
done
|
done
|
||||||
eoutdent
|
eoutdent
|
||||||
eend ${retval}
|
eend $retval
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Loads a user defined list of kernel modules."
|
description="Loads a user defined list of kernel modules."
|
||||||
@ -24,40 +24,40 @@ start()
|
|||||||
local KV_MICRO=${x%%-*}
|
local KV_MICRO=${x%%-*}
|
||||||
|
|
||||||
local list= x= xx= y= args= mpargs= cnt=0 a=
|
local list= x= xx= y= args= mpargs= cnt=0 a=
|
||||||
for x in "${KV}" \
|
for x in "$KV" \
|
||||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
$KV_MAJOR.$KV_MINOR.$KV_MICRO \
|
||||||
${KV_MAJOR}.${KV_MINOR} \
|
$KV_MAJOR.$KV_MINOR \
|
||||||
; do
|
; do
|
||||||
eval list=\$modules_$(shell_var "${x}")
|
eval list=\$modules_$(shell_var "$x")
|
||||||
[ -n "${list}" ] && break
|
[ -n "$list" ] && break
|
||||||
done
|
done
|
||||||
[ -z "${list}" ] && list=${modules}
|
[ -z "$list" ] && list=$modules
|
||||||
|
|
||||||
for x in ${list}; do
|
for x in $list; do
|
||||||
a=${x#*:}
|
a=${x#*:}
|
||||||
if [ "${a}" = "${x}" ]; then
|
if [ "$a" = "$x" ]; then
|
||||||
unset mpargs
|
unset mpargs
|
||||||
ebegin "Loading module ${x}"
|
ebegin "Loading module $x"
|
||||||
else
|
else
|
||||||
x=${x%%:*}
|
x=${x%%:*}
|
||||||
mpargs="-o ${a}"
|
mpargs="-o $a"
|
||||||
ebegin "Loading module ${x} as ${a}"
|
ebegin "Loading module $x as $a"
|
||||||
fi
|
fi
|
||||||
aa=$(shell_var "${a}")
|
aa=$(shell_var "$a")
|
||||||
xx=$(shell_var "${x}")
|
xx=$(shell_var "$x")
|
||||||
for y in "${KV}" \
|
for y in "$KV" \
|
||||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
$KV_MAJOR.$KV_MINOR.$KV_MICRO \
|
||||||
${KV_MAJOR}.${KV_MINOR} \
|
$KV_MAJOR.$KV_MINOR \
|
||||||
; do
|
; do
|
||||||
eval args=\$module_${aa}_args_$(shell_var "${y}")
|
eval args=\$module_${aa}_args_$(shell_var "$y")
|
||||||
[ -n "${args}" ] && break
|
[ -n "${args}" ] && break
|
||||||
eval args=\$module_${xx}_args_$(shell_var "${y}")
|
eval args=\$module_${xx}_args_$(shell_var "$y")
|
||||||
[ -n "${args}" ] && break
|
[ -n "${args}" ] && break
|
||||||
done
|
done
|
||||||
[ -z "${args}" ] && eval args=\$module_${aa}_args
|
[ -z "$args" ] && eval args=\$module_${aa}_args
|
||||||
[ -z "${args}" ] && eval args=\$module_${xx}_args
|
[ -z "$args" ] && eval args=\$module_${xx}_args
|
||||||
eval modprobe -q "${mpargs}" "${x}" "${args}"
|
eval modprobe -q "$mpargs" "$x" "$args"
|
||||||
eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1))
|
eend $? "Failed to load $x" && cnt=$(($cnt + 1))
|
||||||
done
|
done
|
||||||
einfo "Autoloaded ${cnt} module(s)"
|
einfo "Autoloaded $cnt module(s)"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Re-mount filesytems read-only for a clean reboot."
|
description="Re-mount filesytems read-only for a clean reboot."
|
||||||
@ -17,30 +17,30 @@ start()
|
|||||||
|
|
||||||
ebegin "Remounting remaining filesystems read-only"
|
ebegin "Remounting remaining filesystems read-only"
|
||||||
# We need the do_unmount function
|
# We need the do_unmount function
|
||||||
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||||
eindent
|
eindent
|
||||||
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
||||||
m="${m}|/bin|/sbin|/lib|/libexec"
|
m="$m|/bin|/sbin|/lib|/libexec"
|
||||||
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
|
local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
|
||||||
IFS=$IFS:
|
IFS=$IFS:
|
||||||
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
for x in $no_umounts $RC_NO_UMOUNTS; do
|
||||||
m="${m}|${x}"
|
m="$m|$x"
|
||||||
done
|
done
|
||||||
if [ "${SIFS}" = y ]; then
|
if [ "$SIFS" = y ]; then
|
||||||
IFS=$OIFS
|
IFS=$OIFS
|
||||||
else
|
else
|
||||||
unset IFS
|
unset IFS
|
||||||
fi
|
fi
|
||||||
m="^(${m})$"
|
m="^($m)$"
|
||||||
fs=
|
fs=
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
fs="${fs}${fs:+|}${x}"
|
fs="$fs${fs:+|}$x"
|
||||||
done
|
done
|
||||||
[ -n "${fs}" ] && fs="^(${fs})$"
|
[ -n "$fs" ] && fs="^($fs)$"
|
||||||
do_unmount "umount -r" \
|
do_unmount "umount -r" \
|
||||||
--skip-point-regex "${m}" \
|
--skip-point-regex "$m" \
|
||||||
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
${fs:+--skip-fstype-regex} $fs --nonetdev
|
||||||
eoutdent
|
eoutdent
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
mouse=${RC_SVCNAME##*.}
|
mouse=${RC_SVCNAME##*.}
|
||||||
if [ -n "${name}" -a "${mouse}" != "moused" ]; then
|
if [ -n "$mouse" -a "$mouse" != "moused" ]; then
|
||||||
moused_device=/dev/"${mouse}"
|
moused_device=/dev/"$mouse"
|
||||||
pidfile=/var/run/moused-"${mouse}".pid
|
pidfile=/var/run/moused-"$mouse".pid
|
||||||
else
|
else
|
||||||
pidfile=/var/run/moused.pid
|
pidfile=/var/run/moused.pid
|
||||||
fi
|
fi
|
||||||
name="Console Mouse Daemon"
|
name="Console Mouse Daemon"
|
||||||
[ -n "${moused_device}" ] && name="${name} (${moused_device})"
|
[ -n "$moused_device" ] && name="$name ($moused_device)"
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
@ -21,42 +21,42 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Starting ${name}"
|
ebegin "Starting $name"
|
||||||
|
|
||||||
if [ -z "${moused_device}" ]; then
|
if [ -z "$moused_device" ]; then
|
||||||
local dev=
|
local dev=
|
||||||
for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do
|
for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do
|
||||||
[ -c "${dev}" ] || continue
|
[ -c "$dev" ] || continue
|
||||||
[ -e /var/run/moused-"${dev##*/}".pid ] && continue
|
[ -e /var/run/moused-"${dev##*/}".pid ] && continue
|
||||||
moused_device=${dev}
|
moused_device=$dev
|
||||||
eindent
|
eindent
|
||||||
einfo "Using mouse on ${moused_device}"
|
einfo "Using mouse on $moused_device"
|
||||||
eoutdent
|
eoutdent
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${moused_device}" ]; then
|
if [ -z "$moused_device" ]; then
|
||||||
eend 1 "No mouse device found"
|
eend 1 "No mouse device found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local args=
|
local args=
|
||||||
eval args=\$moused_args_${moused_device##*/}
|
eval args=\$moused_args_${moused_device##*/}
|
||||||
[ -z "${args}" ] && args=${moused_args}
|
[ -z "$args" ] && args=$moused_args
|
||||||
|
|
||||||
start-stop-daemon --start --exec /usr/sbin/moused \
|
start-stop-daemon --start --exec /usr/sbin/moused \
|
||||||
--pidfile "${pidfile}" \
|
--pidfile "$pidfile" \
|
||||||
-- ${args} -p "${moused_device}" -I "${pidfile}"
|
-- $args -p "$moused_device" -I "$pidfile"
|
||||||
local retval=$?
|
local retval=$?
|
||||||
|
|
||||||
if [ ${retval} = 0 ]; then
|
if [ $retval = 0 ]; then
|
||||||
local ttyv=
|
local ttyv=
|
||||||
for ttyv in /dev/ttyv*; do
|
for ttyv in /dev/ttyv*; do
|
||||||
vidcontrol < "${ttyv}" -m on
|
vidcontrol < "$ttyv" -m on
|
||||||
: $((retval+= $?))
|
: $((retval+= $?))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eend ${retval} "Failed to start moused"
|
eend $retval "Failed to start moused"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Mounts network shares according to /etc/fstab."
|
description="Mounts network shares according to /etc/fstab."
|
||||||
@ -11,7 +11,7 @@ need_portmap()
|
|||||||
"
|
"
|
||||||
set -- $(fstabinfo --options --fstype nfs,nfs4)
|
set -- $(fstabinfo --options --fstype nfs,nfs4)
|
||||||
for opts; do
|
for opts; do
|
||||||
case ,${opts}, in
|
case ,$opts, in
|
||||||
*,noauto,*|*,nolock,*);;
|
*,noauto,*|*,nolock,*);;
|
||||||
*) return 0;;
|
*) return 0;;
|
||||||
esac
|
esac
|
||||||
@ -27,12 +27,12 @@ depend()
|
|||||||
if need_portmap; then
|
if need_portmap; then
|
||||||
pmap="rpc.statd"
|
pmap="rpc.statd"
|
||||||
[ -x @SYSCONFDIR@/init.d/rpcbind ] \
|
[ -x @SYSCONFDIR@/init.d/rpcbind ] \
|
||||||
&& pmap="${pmap} rpcbind" \
|
&& pmap="$pmap rpcbind" \
|
||||||
|| pmap="${pmap} portmap"
|
|| pmap="$pmap portmap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config /etc/fstab
|
config /etc/fstab
|
||||||
need net ${pmap}
|
need net $pmap
|
||||||
use afc-client amd autofs openvpn
|
use afc-client amd autofs openvpn
|
||||||
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
|
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
|
||||||
keyword nojail noprefix novserver
|
keyword nojail noprefix novserver
|
||||||
@ -44,8 +44,8 @@ start()
|
|||||||
[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
|
[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
|
||||||
|
|
||||||
local x= fs=
|
local x= fs=
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
case "${x}" in
|
case "$x" in
|
||||||
nfs|nfs4)
|
nfs|nfs4)
|
||||||
# If the nfsmount script took care of the nfs
|
# If the nfsmount script took care of the nfs
|
||||||
# filesystems, then there's no point in trying
|
# filesystems, then there's no point in trying
|
||||||
@ -55,16 +55,16 @@ start()
|
|||||||
# Only try to mount NFS filesystems if portmap was
|
# Only try to mount NFS filesystems if portmap was
|
||||||
# started. This is to fix "hang" problems for new
|
# started. This is to fix "hang" problems for new
|
||||||
# users who do not add portmap to the default runlevel.
|
# users who do not add portmap to the default runlevel.
|
||||||
if need_portmap && ! service_started "${pmap}"; then
|
if need_portmap && ! service_started "$pmap"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fs="${fs}${fs:+,}${x}"
|
fs="$fs${fs:+,}$x"
|
||||||
done
|
done
|
||||||
|
|
||||||
ebegin "Mounting network filesystems"
|
ebegin "Mounting network filesystems"
|
||||||
mount -at ${fs}
|
mount -at $fs
|
||||||
ewend $? "Could not mount all network filesystems"
|
ewend $? "Could not mount all network filesystems"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -74,24 +74,24 @@ stop()
|
|||||||
local x= fs=
|
local x= fs=
|
||||||
|
|
||||||
ebegin "Unmounting network filesystems"
|
ebegin "Unmounting network filesystems"
|
||||||
. "${RC_LIBDIR}/sh/rc-mount.sh"
|
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||||
|
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
fs="${fs}${fs:+,}${x}"
|
fs="$fs${fs:+,}$x"
|
||||||
done
|
done
|
||||||
if [ -n "${fs}" ]; then
|
if [ -n "$fs" ]; then
|
||||||
umount -at ${fs} || eerror "Failed to simply unmount filesystems"
|
umount -at $fs || eerror "Failed to simply unmount filesystems"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eindent
|
eindent
|
||||||
fs=
|
fs=
|
||||||
for x in ${net_fs_list}; do
|
for x in $net_fs_list; do
|
||||||
fs="${fs}${fs:+|}${x}"
|
fs="$fs${fs:+|}$x"
|
||||||
done
|
done
|
||||||
[ -n "${fs}" ] && fs="^(${fs})$"
|
[ -n "$fs" ] && fs="^($fs)$"
|
||||||
do_unmount "umount" ${fs:+--fstype-regex} ${fs} --netdev
|
do_unmount umount ${fs:+--fstype-regex} $fs --netdev
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
eoutdent
|
eoutdent
|
||||||
eend ${retval} "Failed to unmount network filesystems"
|
eend $retval "Failed to unmount network filesystems"
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ start()
|
|||||||
intv=$(shell_var "$int")
|
intv=$(shell_var "$int")
|
||||||
eval upcmd=\$ifup_$intv
|
eval upcmd=\$ifup_$intv
|
||||||
for func in ip ifconfig; do
|
for func in ip ifconfig; do
|
||||||
eval cmd=\$${func}_${intv}
|
eval cmd=\$${func}_$intv
|
||||||
if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then
|
if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then
|
||||||
cf=/etc/"$func.$int"
|
cf=/etc/"$func.$int"
|
||||||
break
|
break
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
required_files="/etc/newsyslog.conf"
|
required_files="/etc/newsyslog.conf"
|
||||||
@ -13,6 +13,6 @@ depend()
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Creating and/or trimming log files"
|
ebegin "Creating and/or trimming log files"
|
||||||
newsyslog -s ${newsyslog_args}
|
newsyslog -s $newsyslog_args
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/usr/sbin/nscd
|
command=/usr/sbin/nscd
|
||||||
command_args="${nscd_args}"
|
command_args=$nscd_args
|
||||||
pidfile=/var/run/nscd.pid
|
pidfile=/var/run/nscd.pid
|
||||||
name="Name Service Cache Daemon"
|
name="Name Service Cache Daemon"
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ depend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
flush() {
|
flush() {
|
||||||
ebegin "Flushing ${name}"
|
ebegin "Flushing $name"
|
||||||
nscd -I all >/dev/null
|
nscd -I all >/dev/null
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Turns numlock on for the consoles."
|
description="Turns numlock on for the consoles."
|
||||||
@ -19,12 +19,12 @@ _setleds()
|
|||||||
local dev=/dev/tty t= i=1 retval=0
|
local dev=/dev/tty t= i=1 retval=0
|
||||||
[ -d /dev/vc ] && dev=/dev/vc/
|
[ -d /dev/vc ] && dev=/dev/vc/
|
||||||
|
|
||||||
while [ ${i} -le ${ttyn} ]; do
|
while [ $i -le $ttyn ]; do
|
||||||
setleds -D "$1"num < ${dev}${i} || retval=1
|
setleds -D "$1"num < $dev$i || retval=1
|
||||||
i=$((${i} + 1))
|
i=$(($i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
return ${retval}
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
22
init.d/pf.in
22
init.d/pf.in
@ -1,10 +1,10 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
name="Packet Filter"
|
name="Packet Filter"
|
||||||
pf_conf=${pf_conf:-${pf_rules:-/etc/pf.conf}}
|
: ${pf_conf:=${pf_rules:-/etc/pf.conf}}
|
||||||
required_files=${pf_conf}
|
required_files=$pf_conf
|
||||||
|
|
||||||
extra_commands="checkconfig showstatus"
|
extra_commands="checkconfig showstatus"
|
||||||
extra_started_commands="reload"
|
extra_started_commands="reload"
|
||||||
@ -16,39 +16,39 @@ depend() {
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Starting ${name}"
|
ebegin "Starting $name"
|
||||||
if type kldload >/dev/null 2>&1; then
|
if type kldload >/dev/null 2>&1; then
|
||||||
kldload pf 2>/dev/null
|
kldload pf 2>/dev/null
|
||||||
fi
|
fi
|
||||||
pfctl -q -F all
|
pfctl -q -F all
|
||||||
pfctl -q -f "${pf_conf}" ${pf_args}
|
pfctl -q -f "$pf_conf" $pf_args
|
||||||
pfctl -q -e
|
pfctl -q -e
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
ebegin "Stopping ${name}"
|
ebegin "Stopping $name"
|
||||||
pfctl -q -d
|
pfctl -q -d
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
checkconfig()
|
checkconfig()
|
||||||
{
|
{
|
||||||
ebegin "Checking ${name} configuration"
|
ebegin "Checking $name configuration"
|
||||||
pfctl -n -f "${pf_conf}"
|
pfctl -n -f "$pf_conf"
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
reload()
|
reload()
|
||||||
{
|
{
|
||||||
ebegin "Reloading ${name} rules."
|
ebegin "Reloading $name rules."
|
||||||
pfctl -q -n -f "${pf_conf}" && \
|
pfctl -q -n -f "$pf_conf" && \
|
||||||
{
|
{
|
||||||
# Flush everything but existing state entries that way when
|
# Flush everything but existing state entries that way when
|
||||||
# rules are read in, it doesn't break established connections.
|
# rules are read in, it doesn't break established connections.
|
||||||
pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp
|
pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp
|
||||||
pfctl -q -f "${pf_conf}" ${pf_args}
|
pfctl -q -f "$pf_conf" $pf_args
|
||||||
}
|
}
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/usr/sbin/powerd
|
command=/usr/sbin/powerd
|
||||||
command_args=${powerd_args}
|
command_args=$powerd_args
|
||||||
pidfile=/var/run/powerd.pid
|
pidfile=/var/run/powerd.pid
|
||||||
name="Power Control Daemon"
|
name="Power Control Daemon"
|
||||||
|
|
||||||
@ -17,11 +17,11 @@ depend()
|
|||||||
|
|
||||||
start_pre()
|
start_pre()
|
||||||
{
|
{
|
||||||
if [ -n "${powerd_battery_mode}" ]; then
|
if [ -n "$powerd_battery_mode" ]; then
|
||||||
command_args="${command_args} -b ${powerd_battery_mode}"
|
command_args="$command_args -b $powerd_battery_mode"
|
||||||
fi
|
fi
|
||||||
if [ -n "${powerd_ac_mode}" ]; then
|
if [ -n "${powerd_ac_mode}" ]; then
|
||||||
command_args="${command_args} -a ${powerd_ac_mode}"
|
command_args="$command_args -a $powerd_ac_mode"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ stop_post()
|
|||||||
{
|
{
|
||||||
local level=$(sysctl -n dev.cpu.0.freq_levels |
|
local level=$(sysctl -n dev.cpu.0.freq_levels |
|
||||||
sed -e 's:/.*::')
|
sed -e 's:/.*::')
|
||||||
if [ -n "${level}" ]; then
|
if [ -n "$level" ]; then
|
||||||
sysctl dev.cpu.0.freq="${level}" >/dev/null
|
sysctl dev.cpu.0.freq="$level" >/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Mounts misc filesystems in /proc."
|
description="Mounts misc filesystems in /proc."
|
||||||
@ -26,12 +26,12 @@ start()
|
|||||||
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
|
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
|
||||||
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
|
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
|
||||||
grep -Fow usbdevfs /proc/filesystems)
|
grep -Fow usbdevfs /proc/filesystems)
|
||||||
if [ -n "${usbfs}" ]; then
|
if [ -n "$usbfs" ]; then
|
||||||
ebegin "Mounting USB device filesystem [${usbfs}]"
|
ebegin "Mounting USB device filesystem [$usbfs]"
|
||||||
local usbgid="$(getent group usb | \
|
local usbgid="$(getent group usb | \
|
||||||
sed -e 's/.*:.*:\(.*\):.*/\1/')"
|
sed -e 's/.*:.*:\(.*\):.*/\1/')"
|
||||||
mount -t ${usbfs} \
|
mount -t $usbfs \
|
||||||
-o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \
|
-o ${usbgid:+devmode=0664,devgid=$usbgid,}noexec,nosuid \
|
||||||
usbfs /proc/bus/usb
|
usbfs /proc/bus/usb
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
@ -48,7 +48,8 @@ start()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup Kernel Support for miscellaneous Binary Formats
|
# Setup Kernel Support for miscellaneous Binary Formats
|
||||||
if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc; then
|
if [ -d /proc/sys/fs/binfmt_misc ] \
|
||||||
|
&& ! mountinfo -q /proc/sys/fs/binfmt_misc; then
|
||||||
if grep -qs binfmt_misc /proc/filesystems; then
|
if grep -qs binfmt_misc /proc/filesystems; then
|
||||||
ebegin "Mounting misc binary format filesystem"
|
ebegin "Mounting misc binary format filesystem"
|
||||||
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
||||||
|
@ -3,26 +3,21 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/usr/sbin/rarpd
|
command=/usr/sbin/rarpd
|
||||||
command_args="-f ${rarpd_args}"
|
command_args="-f $rarpd_args"
|
||||||
pidfile=/var/run/rarpd.pid
|
pidfile=/var/run/rarpd.pid
|
||||||
name="Reverse ARP Daemon"
|
name="Reverse ARP Daemon"
|
||||||
required_files="/etc/ethers"
|
required_files=/etc/ethers
|
||||||
|
|
||||||
if [ -z "${rarpd_interface}" ]; then
|
if [ -z "$rarpd_interface" ]; then
|
||||||
command_args="${command_args} -a"
|
command_args="$command_args -a"
|
||||||
else
|
else
|
||||||
command_args="${command_args} ${rarpd_interface}"
|
command_args="$command_args $rarpd_interface"
|
||||||
fi
|
fi
|
||||||
command_background="YES"
|
command_background=YES
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
need localmount
|
need localmount
|
||||||
after bootmisc
|
after bootmisc
|
||||||
|
|
||||||
if [ -z "${rarpd_interface}" ]; then
|
|
||||||
need net
|
need net
|
||||||
else
|
|
||||||
net net."${rarpd_interface}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@ -20,21 +20,21 @@ start()
|
|||||||
|
|
||||||
# Skip these services
|
# Skip these services
|
||||||
for s in cleartmp moused; do
|
for s in cleartmp moused; do
|
||||||
[ "${s}" = "${service}" ] && continue 2
|
[ "$s" = "$service" ] && continue 2
|
||||||
done
|
done
|
||||||
|
|
||||||
# If we have an init script for this service, continue
|
# If we have an init script for this service, continue
|
||||||
rc-service --exists "${service}" && continue
|
rc-service --exists "$service" && continue
|
||||||
|
|
||||||
# Ensure that the users rc.conf will start us - ignore the defaults
|
# Ensure that the users rc.conf will start us - ignore the defaults
|
||||||
eval enabled=\$${svc##*/}_enable
|
eval enabled=\$${svc##*/}_enable
|
||||||
yesno ${enabled} || yesno ${svc##*/} || continue
|
yesno $enabled || yesno ${svc##*/} || continue
|
||||||
|
|
||||||
# Good to go!
|
# Good to go!
|
||||||
"$svc" start && started="${started} ${svc}"
|
"$svc" start && started="$started $svc"
|
||||||
: $((retval += $?))
|
: $((retval += $?))
|
||||||
done
|
done
|
||||||
service_set_value started "${started}"
|
service_set_value started "$started"
|
||||||
eend $retval "Some local rc services failed to start"
|
eend $retval "Some local rc services failed to start"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ stop()
|
|||||||
ebegin "Stopping local rc services"
|
ebegin "Stopping local rc services"
|
||||||
local svc= retval=0
|
local svc= retval=0
|
||||||
for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
|
for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
|
||||||
"${svc}" stop
|
"$svc" stop
|
||||||
: $((retval += $?))
|
: $((retval += $?))
|
||||||
done
|
done
|
||||||
eend $retval "Some local rc services failed to stop"
|
eend $retval "Some local rc services failed to stop"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Mount the root fs read/write"
|
description="Mount the root fs read/write"
|
||||||
@ -22,7 +22,7 @@ start()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Remounting root filesystem read/write"
|
ebegin "Remounting root filesystem read/write"
|
||||||
case "${RC_UNAME}" in
|
case "$RC_UNAME" in
|
||||||
Linux) mount -n -o remount,rw /;;
|
Linux) mount -n -o remount,rw /;;
|
||||||
*) mount -u -o rw /;;
|
*) mount -u -o rw /;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/usr/sbin/rpcbind
|
command=/usr/sbin/rpcbind
|
||||||
command_args=${rpcbind_args}
|
command_args=$rpcbind_args
|
||||||
name="RPC program number mapper"
|
name="RPC program number mapper"
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
|
@ -6,7 +6,7 @@ description="Saves the caches OpenRC uses to non volatile storage"
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
if [ -e "${RC_SVCDIR}"/clock-skewed ]; then
|
if [ -e "$RC_SVCDIR"/clock-skewed ]; then
|
||||||
ewarn "WARNING: clock skew detected!"
|
ewarn "WARNING: clock skew detected!"
|
||||||
if ! yesno "savecache_skewed"; then
|
if ! yesno "savecache_skewed"; then
|
||||||
eerror "Not saving deptree cache"
|
eerror "Not saving deptree cache"
|
||||||
@ -14,19 +14,19 @@ start()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ebegin "Saving dependency cache"
|
ebegin "Saving dependency cache"
|
||||||
if [ ! -d "${RC_LIBDIR}"/cache ]; then
|
if [ ! -d "$RC_LIBDIR"/cache ]; then
|
||||||
rm -rf "${RC_LIBDIR}"/cache
|
rm -rf "$RC_LIBDIR"/cache
|
||||||
if ! mkdir "${RC_LIBDIR}"/cache; then
|
if ! mkdir "$RC_LIBDIR"/cache; then
|
||||||
eend $?
|
eend $?
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
local save=
|
local save=
|
||||||
for x in deptree depconfig softlevel nettree rc.log; do
|
for x in deptree depconfig softlevel nettree rc.log; do
|
||||||
[ -e "${RC_SVCDIR}/${x}" ] && save="${save} ${RC_SVCDIR}/${x}"
|
[ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x"
|
||||||
done
|
done
|
||||||
if [ -n "${save}" ]; then
|
if [ -n "$save" ]; then
|
||||||
cp -p ${save} "${RC_LIBDIR}"/cache 2>/dev/null
|
cp -p $save "$RC_LIBDIR"/cache 2>/dev/null
|
||||||
fi
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Saves a kernel dump."
|
description="Saves a kernel dump."
|
||||||
@ -12,25 +12,25 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local dump_dir=${dump_dir:-/var/crash}
|
: ${dump_dir:=/var/crash}
|
||||||
if ! [ -d "${dump_dir}" ]; then
|
if ! [ -d "$dump_dir" ]; then
|
||||||
mkdir -p "${dump_dir}"
|
mkdir -p "$dump_dir"
|
||||||
chmod 700 "${dump_dir}"
|
chmod 700 "$dump_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${RC_UNAME}" = "FreeBSD" ]; then
|
if [ "$RC_UNAME" = FreeBSD ]; then
|
||||||
# Don't quote ${dump_device}, so that if it's unset,
|
# Don't quote ${dump_device}, so that if it's unset,
|
||||||
# savecore will check on the partitions listed in fstab
|
# savecore will check on the partitions listed in fstab
|
||||||
# without errors in the output
|
# without errors in the output
|
||||||
savecore -C "${dump_dir}" ${dump_device} >/dev/null
|
savecore -C "$dump_dir" $dump_device >/dev/null
|
||||||
else
|
else
|
||||||
ls "${dump_dir}"/bsd* > /dev/null 2>&1
|
ls "$dump_dir"/bsd* > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
[ $? = 0 ] || return 0
|
[ $? = 0 ] || return 0
|
||||||
|
|
||||||
local sopts="${dump_dir} ${dump_device}"
|
local sopts="$dump_dir $dump_device"
|
||||||
yesno ${dump_compress} && sopts="-z ${sopts}"
|
yesno $dump_compress && sopts="-z $sopts"
|
||||||
ebegin "Saving kernel core dump in ${dump_dir}"
|
ebegin "Saving kernel core dump in $dump_dir"
|
||||||
savecore ${sopts} >/dev/null
|
savecore $sopts >/dev/null
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@ -11,7 +11,7 @@ depend()
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Activating swap devices"
|
ebegin "Activating swap devices"
|
||||||
case "${RC_UNAME}" in
|
case "$RC_UNAME" in
|
||||||
NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;;
|
NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;;
|
||||||
*) swapon -a >/dev/null;;
|
*) swapon -a >/dev/null;;
|
||||||
esac
|
esac
|
||||||
@ -24,10 +24,10 @@ stop()
|
|||||||
|
|
||||||
# Try to unmount all tmpfs filesystems not in use, else a deadlock may
|
# Try to unmount all tmpfs filesystems not in use, else a deadlock may
|
||||||
# occure. As $RC_SVCDIR may also be tmpfs we cd to it to lock it
|
# occure. As $RC_SVCDIR may also be tmpfs we cd to it to lock it
|
||||||
cd "${RC_SVCDIR}"
|
cd "$RC_SVCDIR"
|
||||||
umount -a -t tmpfs 2>/dev/null
|
umount -a -t tmpfs 2>/dev/null
|
||||||
|
|
||||||
case "${RC_UNAME}" in
|
case "$RC_UNAME" in
|
||||||
NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;;
|
NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;;
|
||||||
*) swapoff -a >/dev/null;;
|
*) swapoff -a >/dev/null;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
@ -8,29 +8,29 @@ depend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if [ -n "${allscreen_flags}" ]; then
|
if [ -n "$allscreen_flags" ]; then
|
||||||
ebegin "Setting mode to ${allscreen_flags} for all screens"
|
ebegin "Setting mode to $allscreen_flags for all screens"
|
||||||
for v in /dev/ttyv*; do
|
for v in /dev/ttyv*; do
|
||||||
vidcontrol ${allscreen_flags} <"${v}"
|
vidcontrol $allscreen_flags <$v
|
||||||
done
|
done
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${keymap}" ]; then
|
if [ -n "$keymap" ]; then
|
||||||
ebegin "Setting keymap to ${keymap}"
|
ebegin "Setting keymap to $keymap"
|
||||||
kbdcontrol -l ${keymap} </dev/console
|
kbdcontrol -l $keymap </dev/console
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${keyrate}" ]; then
|
if [ -n "$keyrate" ]; then
|
||||||
ebegin "Setting keyrate to ${keyrate}"
|
ebegin "Setting keyrate to $keyrate"
|
||||||
kbdcontrol -r ${keyrate} </dev/console
|
kbdcontrol -r $keyrate </dev/console
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${keychange}" ]; then
|
if [ -n "$keychange" ]; then
|
||||||
ebegin "Changing function keys"
|
ebegin "Changing function keys"
|
||||||
eval set -- "${keychange}"
|
eval set -- "$keychange"
|
||||||
eindent
|
eindent
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
veinfo "F$1 -> \`$2'"
|
veinfo "F$1 -> \`$2'"
|
||||||
@ -41,40 +41,40 @@ start() {
|
|||||||
eoutdent
|
eoutdent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${cursor}" ]; then
|
if [ -n "$cursor" ]; then
|
||||||
ebegin "Setting cursor"
|
ebegin "Setting cursor"
|
||||||
vidcontrol -c ${cursor}
|
vidcontrol -c $cursor
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local v= f=
|
local v= f=
|
||||||
for v in font8x16 font8x14 font8x8; do
|
for v in font8x16 font8x14 font8x8; do
|
||||||
eval f=\$${v}
|
eval f=\$$v
|
||||||
if [ -n "${f}" ]; then
|
if [ -n "$f" ]; then
|
||||||
ebegin "Setting font ${f}"
|
ebegin "Setting font $f"
|
||||||
vidcontrol -f ${v##font} ${f}
|
vidcontrol -f ${v##font} $f
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${blanktime}" ]; then
|
if [ -n "$blanktime" ]; then
|
||||||
ebegin "Setting blanktime"
|
ebegin "Setting blanktime"
|
||||||
vidcontrol -t ${blanktime}
|
vidcontrol -t $blanktime
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${saver}" ]; then
|
if [ -n "$saver" ]; then
|
||||||
local i=
|
local i=
|
||||||
for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do
|
for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do
|
||||||
kldunload "${i}"
|
kldunload "$i"
|
||||||
done
|
done
|
||||||
kldstat -v | grep -q _saver || kldload ${saver}_saver
|
kldstat -v | grep -q _saver || kldload ${saver}_saver
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${kbdflags}" ]; then
|
if [ -n "$kbdflags" ]; then
|
||||||
ebegin "Setting keyboard flags for all screens"
|
ebegin "Setting keyboard flags for all screens"
|
||||||
for v in /dev/ttyv*; do
|
for v in /dev/ttyv*; do
|
||||||
kbdcontrol ${kbdflags} <${v}
|
kbdcontrol $kbdflags <$v
|
||||||
done
|
done
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@ -15,10 +15,10 @@ start()
|
|||||||
local retval=0 var= comments=
|
local retval=0 var= comments=
|
||||||
ebegin "Configuring kernel parameters"
|
ebegin "Configuring kernel parameters"
|
||||||
while read var comments; do
|
while read var comments; do
|
||||||
case "${var}" in
|
case "$var" in
|
||||||
""|"#"*) continue;;
|
""|"#"*) continue;;
|
||||||
esac
|
esac
|
||||||
sysctl -w "${var}" >/dev/null || retval=1
|
sysctl -w "$var" >/dev/null || retval=1
|
||||||
done < /etc/sysctl.conf
|
done < /etc/sysctl.conf
|
||||||
eend ${retval} "Some errors were encountered"
|
eend $retval "Some errors were encountered"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Mount the sys filesystem."
|
description="Mount the sys filesystem."
|
||||||
@ -31,7 +31,8 @@ mount_sys()
|
|||||||
mount_misc()
|
mount_misc()
|
||||||
{
|
{
|
||||||
# Setup Kernel Support for securityfs
|
# Setup Kernel Support for securityfs
|
||||||
if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then
|
if [ -d /sys/kernel/security ] && \
|
||||||
|
! mountinfo -q /sys/kernel/security; then
|
||||||
if grep -qs securityfs /proc/filesystems; then
|
if grep -qs securityfs /proc/filesystems; then
|
||||||
ebegin "Mounting security filesystem"
|
ebegin "Mounting security filesystem"
|
||||||
mount -n -t securityfs -o nodev,noexec,nosuid \
|
mount -n -t securityfs -o nodev,noexec,nosuid \
|
||||||
@ -56,8 +57,8 @@ start()
|
|||||||
local retval
|
local retval
|
||||||
mount_sys
|
mount_sys
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ ${retval} -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
mount_misc
|
mount_misc
|
||||||
fi
|
fi
|
||||||
return ${retval}
|
return $retval
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
command=/usr/sbin/syslogd
|
command=/usr/sbin/syslogd
|
||||||
command_args=${syslogd_args}
|
command_args=$syslogd_args
|
||||||
case "${RC_UNAME}" in
|
case "$RC_UNAME" in
|
||||||
FreeBSD|DragonFly) pidfile=/var/run/syslog.pid;;
|
FreeBSD|DragonFly) pidfile=/var/run/syslog.pid;;
|
||||||
*) pidfile=/var/run/syslogd.pid;;
|
*) pidfile=/var/run/syslogd.pid;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Configures terminal encoding."
|
description="Configures terminal encoding."
|
||||||
|
|
||||||
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||||
unicode=${unicode:-${UNICODE}}
|
: ${unicode:=${UNICODE}}
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
@ -25,11 +25,11 @@ start()
|
|||||||
termmsg="UTF-8"
|
termmsg="UTF-8"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Setting terminal encoding [${termmsg}]"
|
ebegin "Setting terminal encoding [$termmsg]"
|
||||||
n=1
|
n=1
|
||||||
while [ ${n} -le "${ttyn}" ]; do
|
while [ ${n} -le "$ttyn" ]; do
|
||||||
printf "\033%s" "${termencoding}" >"${ttydev}${n}"
|
printf "\033%s" "$termencoding" >$ttydev$n
|
||||||
n=$((${n} + 1))
|
n=$(($n + 1))
|
||||||
done
|
done
|
||||||
eend 0
|
eend 0
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
urandom_seed=${urandom_seed:-${URANDOM_SEED:-/var/run/random-seed}}
|
: ${urandom_seed:=${URANDOM_SEED:-/var/run/random-seed}}
|
||||||
|
|
||||||
description="Initializes the random number generator."
|
description="Initializes the random number generator."
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@ -22,19 +21,19 @@ save_seed()
|
|||||||
|
|
||||||
( # sub shell to prevent umask pollution
|
( # sub shell to prevent umask pollution
|
||||||
umask 077
|
umask 077
|
||||||
dd if=/dev/urandom of="${urandom_seed}" count=${psz} 2>/dev/null
|
dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
[ -c /dev/urandom ] || return
|
[ -c /dev/urandom ] || return
|
||||||
if [ -f "${urandom_seed}" ]; then
|
if [ -f "$urandom_seed" ]; then
|
||||||
ebegin "Initializing random number generator"
|
ebegin "Initializing random number generator"
|
||||||
cat "${urandom_seed}" > /dev/urandom
|
cat "$urandom_seed" > /dev/urandom
|
||||||
eend $? "Error initializing random number generator"
|
eend $? "Error initializing random number generator"
|
||||||
fi
|
fi
|
||||||
rm -f "${urandom_seed}" && save_seed
|
rm -f "$urandom_seed" && save_seed
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!@PREFIX@/sbin/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008-2009 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@ -19,82 +19,82 @@ start()
|
|||||||
# screen idx scr emul
|
# screen idx scr emul
|
||||||
# font name width height enc file
|
# font name width height enc file
|
||||||
while read type arg1 arg2 arg3 arg4 arg5; do
|
while read type arg1 arg2 arg3 arg4 arg5; do
|
||||||
case "${type}" in
|
case "$type" in
|
||||||
\#*|"")
|
\#*|"")
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
|
||||||
font)
|
font)
|
||||||
cmd=${wsfld}
|
cmd=$wsfld
|
||||||
[ "${arg2}" != "-" ] && cmd="${cmd} -w ${arg2}"
|
[ "$arg2" != "-" ] && cmd="$cmd -w $arg2"
|
||||||
[ "${arg3}" != "-" ] && cmd="${cmd} -h ${arg3}"
|
[ "$arg3" != "-" ] && cmd="$cmd -h $arg3"
|
||||||
[ "${arg4}" != "-" ] && cmd="${cmd} -e ${arg4}"
|
[ "$arg4" != "-" ] && cmd="$cmd -e $arg4"
|
||||||
cmd="${cmd} -N ${arg1} ${arg5}"
|
cmd="$cmd -N $arg1 $arg5"
|
||||||
eval "${cmd}"
|
eval "$cmd"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
screen)
|
screen)
|
||||||
cmd=${wscfg}
|
cmd=$wscfg
|
||||||
[ "${arg2}" != "-" ] && cmd="${cmd} -t ${arg2}"
|
[ "$arg2" != "-" ] && cmd="$cmd -t $arg2"
|
||||||
[ "${arg3}" != "-" ] && cmd="${cmd} -e ${arg3}"
|
[ "$arg3" != "-" ] && cmd="$cmd -e $arg3"
|
||||||
cmd="${cmd} ${arg1}"
|
cmd="$cmd $arg1"
|
||||||
eval "${cmd}"
|
eval "$cmd"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
keyboard)
|
keyboard)
|
||||||
cmd=${wscfg}
|
cmd=$wscfg
|
||||||
case "${arg1}" in
|
case "$arg1" in
|
||||||
-|auto)
|
-|auto)
|
||||||
cmd="${cmd} -k"
|
cmd="$cmd -k"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cmd="${cmd} -k ${arg1}"
|
cmd="$cmd -k $arg1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
${cmd}
|
$cmd
|
||||||
;;
|
;;
|
||||||
|
|
||||||
encoding)
|
encoding)
|
||||||
eval ${wsctl} -w "\"encoding=${arg1}\""
|
eval $wsctl -w "\"encoding=$arg1\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
mapfile)
|
mapfile)
|
||||||
local entry=
|
local entry=
|
||||||
while read entry; do
|
while read entry; do
|
||||||
case "${entry}" in
|
case "$entry" in
|
||||||
\#*|"")
|
\#*|"")
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cmd="${wsctl} -w \"map+=${entry}\""
|
cmd="$wsctl -w \"map+=$entry\""
|
||||||
eval "${cmd} >/dev/null"
|
eval "$cmd >/dev/null"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < "${arg1}"
|
done < "$arg1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
mux)
|
mux)
|
||||||
eval "${wscfg} -m ${arg1}"
|
eval "$wscfg -m $arg1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
setvar)
|
setvar)
|
||||||
case "${arg1}" in
|
case "$arg1" in
|
||||||
keyboard)
|
keyboard)
|
||||||
cmd="${wsctl} -kw ${arg2}"
|
cmd="$wsctl -kw $arg2"
|
||||||
;;
|
;;
|
||||||
display)
|
display)
|
||||||
cmd="${wsctl} -dw ${arg2}"
|
cmd="$wsctl -dw $arg2"
|
||||||
;;
|
;;
|
||||||
mouse)
|
mouse)
|
||||||
cmd="${wsctl} -mw ${arg2}"
|
cmd="$wsctl -mw $arg2"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cmd="${wsctl} -w ${arg1}"
|
cmd="$wsctl -w $arg1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
eval "${cmd}"
|
eval "$cmd"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done < "${config}"
|
done < "$config"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user