Remove initscripts, this won't be necessary anymore.
--HG-- extra : convert_revision : 295187a075acfdb1938f8b2ad0a91db58ff7f9e1
This commit is contained in:
parent
46672bf253
commit
b809e67701
27 changed files with 0 additions and 1820 deletions
|
@ -1,15 +0,0 @@
|
|||
udevd=yes
|
||||
udev_events=yes
|
||||
checkfs=yes
|
||||
mountfs=yes
|
||||
swap=yes
|
||||
sysclock=yes
|
||||
random_seed=yes
|
||||
auto_ifconfig=no
|
||||
dhcpcd_flags="-L"
|
||||
network=yes
|
||||
cleartmp=yes
|
||||
locale=yes
|
||||
persistent_rules=yes
|
||||
dmesg=yes
|
||||
metalog=yes
|
|
@ -1,42 +0,0 @@
|
|||
#
|
||||
# /etc/inittab
|
||||
#
|
||||
|
||||
# Runlevels:
|
||||
# 0 Halt
|
||||
# 1(S) Single-user
|
||||
# 2 Not used
|
||||
# 3 Multi-user
|
||||
# 4 Not used
|
||||
# 5 X11
|
||||
# 6 Reboot
|
||||
|
||||
## Only one of the following two lines can be uncommented!
|
||||
# Boot to console
|
||||
id:3:initdefault:
|
||||
# Boot to X11
|
||||
#id:5:initdefault:
|
||||
|
||||
rc::sysinit:/etc/rc.sysinit
|
||||
rs:S1:wait:/etc/rc.single
|
||||
rm:2345:wait:/etc/rc.multi
|
||||
rh:06:wait:/etc/rc.shutdown
|
||||
su:S:wait:/sbin/sulogin -p
|
||||
|
||||
# -8 options fixes umlauts problem on login
|
||||
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
|
||||
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
|
||||
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
|
||||
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
|
||||
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
|
||||
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
|
||||
|
||||
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
|
||||
|
||||
# Example lines for starting a login manager
|
||||
x:5:respawn:/usr/bin/xdm -nodaemon
|
||||
#x:5:respawn:/usr/sbin/gdm -nodaemon
|
||||
#x:5:respawn:/usr/bin/kdm -nodaemon
|
||||
#x:5:respawn:/usr/bin/slim >& /dev/null
|
||||
|
||||
# End of file
|
|
@ -1,50 +0,0 @@
|
|||
#
|
||||
# /etc/rc.conf - Main Configuration.
|
||||
#
|
||||
if [ -r /etc/defaults/rc.conf ]; then
|
||||
. /etc/defaults/rc.conf
|
||||
fi
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
# LOCALIZATION
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
# LOCALE: available languages can be listed with the 'locale -a' command
|
||||
# HARDWARECLOCK: set to "UTC" or "localtime"
|
||||
# TIMEZONE: timezones are found in /usr/share/zoneinfo
|
||||
# KEYMAP: keymaps are found in /lib/kbd/keymaps
|
||||
# CONSOLEFONT: found in /lib/kbd/consolefonts (only needed for non-US)
|
||||
# CONSOLEMAP: found in /lib/kbd/consoletrans
|
||||
#
|
||||
LOCALE="es_ES.utf-8"
|
||||
HARDWARECLOCK="localtime"
|
||||
TIMEZONE="Europe/Madrid"
|
||||
KEYMAP="es"
|
||||
CONSOLEFONT=
|
||||
CONSOLEMAP=
|
||||
|
||||
#
|
||||
# Services and daemons.
|
||||
#
|
||||
hostname="xbps"
|
||||
syslogd=yes
|
||||
klogd=yes
|
||||
|
||||
#
|
||||
# Networking.
|
||||
#
|
||||
# To manually configure an interface:
|
||||
#
|
||||
# net_interfaces="eth0"
|
||||
# ifconfig_eth0="192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
|
||||
# defaultroute="192.168.0.1"
|
||||
#
|
||||
# /etc/ifconfig.<iface> can also be used intead of ifconfig_<iface> var.
|
||||
# /etc/mygate can also be used instead of defaultroute var.
|
||||
#
|
||||
# To use dhcp (through dhcpcd):
|
||||
#
|
||||
# ifconfig_eth0="dhcp"
|
||||
# dhcpcd_flags="..." for additional arguments passed to dhcpcd.
|
||||
#
|
||||
# END
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: DAEMON
|
||||
# REQUIRE: NETWORKING SERVERS
|
||||
|
||||
# This is a dummy dependency, to ensure that general purpose daemons
|
||||
# are run _after_ the above are.
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: LOGIN
|
||||
# REQUIRE: DAEMON
|
||||
|
||||
# This is a dummy dependency to ensure user services such as xdm,
|
||||
# inetd, cron and kerberos are started after everything else.
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: NETWORKING NETWORK
|
||||
|
||||
# This is a dummy dependency, for services which require networking
|
||||
# to be operational before starting.
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: SERVERS
|
||||
# REQUIRE: udevd
|
||||
|
||||
# This is a dummy dependency, for early-start servers relying on
|
||||
# some basic configuration.
|
|
@ -1,65 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: checkfs
|
||||
# REQUIRE: SERVERS
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="checkfs"
|
||||
start_cmd="checkfs_start"
|
||||
stop_cmd=":"
|
||||
|
||||
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs"
|
||||
NETFS="$NETFS,nofuse,nofuseblk"
|
||||
|
||||
checkfs_start()
|
||||
{
|
||||
echo "Mounting root read-only."
|
||||
mount -n -o remount,ro /
|
||||
|
||||
FORCEFSCK=
|
||||
[ -f /forcefsck ] && FORCEFSCK="-- -f"
|
||||
|
||||
echo "Checking local filesystems..."
|
||||
fsck -A -T -C -a -t $NETFS $FORCEFSCK 2>/dev/null
|
||||
fsckret=$?
|
||||
if [ ${fsckret} -gt 1 ]; then
|
||||
echo "failed!"
|
||||
if [ $((${fsckret}&2)) -eq 2 ]; then
|
||||
echo
|
||||
echo "************** REBOOT REQUIRED *************"
|
||||
echo
|
||||
echo " The system will be rebooted automatically"
|
||||
echo " in 5 seconds."
|
||||
echo
|
||||
echo "********************************************"
|
||||
echo
|
||||
sleep 5
|
||||
else
|
||||
echo
|
||||
echo "********* FILESYSTEM CHECK FAILED ************"
|
||||
echo
|
||||
echo " Please repair manually and reboot. Note that"
|
||||
echo " the root filesystem is currently mounted"
|
||||
echo " read-only. To remount it read-write type:"
|
||||
echo
|
||||
echo " mount -n -o remount,rw /"
|
||||
echo
|
||||
echo " When you exit the maintenance shell the system"
|
||||
echo " will reboot automatically."
|
||||
echo
|
||||
echo "************************************************"
|
||||
echo
|
||||
sulogin -p
|
||||
fi
|
||||
echo "Automatic reboot in progress..."
|
||||
umount -a
|
||||
mount -n -o remount,ro /
|
||||
reboot -f
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: cleartmp
|
||||
# REQUIRE: SERVERS random_seed
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="cleartmp"
|
||||
start_cmd="cleartmp_start"
|
||||
stop_cmd=":"
|
||||
|
||||
cleartmp_start()
|
||||
{
|
||||
echo "Clearing temporary files."
|
||||
|
||||
rm -f /etc/nologin &>/dev/null
|
||||
rm -f /etc/shutdownpid &>/dev/null
|
||||
rm -f /var/lock/* &>/dev/null
|
||||
rm -rf /tmp/* &>/dev/null
|
||||
rm -f /forcefsck &>/dev/null
|
||||
(cd /var/run && find . ! -type d -exec rm -f -- {} \; )
|
||||
: > /var/run/utmp
|
||||
chmod 0664 /var/run/utmp
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: dmesg
|
||||
# REQUIRE: SERVERS persistent_rules
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="dmesg"
|
||||
start_cmd="dmesg_start"
|
||||
stop_cmd=":"
|
||||
|
||||
dmesg_start()
|
||||
{
|
||||
if [ -f /var/log/dmesg.log ]; then
|
||||
rm -f /var/log/dmesg.log
|
||||
fi
|
||||
dmesg > /var/log/dmesg.log
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,65 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: locale
|
||||
# REQUIRE: cleartmp
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="locale"
|
||||
start_cmd="locale_start"
|
||||
stop_cmd=":"
|
||||
|
||||
locale_start()
|
||||
{
|
||||
# Flush old locale settings
|
||||
[ ! -d /etc/profile.d ] && mkdir -p /etc/profile.d
|
||||
|
||||
: >/etc/profile.d/locale.sh
|
||||
chmod 755 /etc/profile.d/locale.sh
|
||||
|
||||
# Check if requested locale was already created
|
||||
if ! $(locale -a|grep -q $LOCALE.utf8); then
|
||||
[ ! -d /usr/lib/locale ] && mkdir -p /usr/lib/locale
|
||||
echo "Building locale: $LOCALE."
|
||||
localedef -i ${LOCALE} -f UTF-8 ${LOCALE}
|
||||
fi
|
||||
|
||||
# Set user defined locale
|
||||
[ -z "$LOCALE" ] && LOCALE="en_US"
|
||||
echo "Setting locale: $LOCALE."
|
||||
echo "export LANG=$LOCALE" >> /etc/profile.d/locale.sh
|
||||
|
||||
if echo "$LOCALE" | grep -qi utf ; then
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo "Loading keyboard map: $KEYMAP."
|
||||
loadkeys -q -u $KEYMAP
|
||||
fi
|
||||
else
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo "Loading keyboard map: $KEYMAP."
|
||||
loadkeys -q $KEYMAP
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$CONSOLEFONT" ]; then
|
||||
echo "Loading console font: $CONSOLEFONT."
|
||||
# CONSOLEMAP in UTF-8 shouldn't be used
|
||||
if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | grep -qi utf ; then
|
||||
CONSOLEMAP=""
|
||||
fi
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
if [ -n "$CONSOLEMAP" ]; then
|
||||
setfont -m $CONSOLEMAP $CONSOLEFONT -C \
|
||||
/dev/tty${i} >/dev/null 2>&1
|
||||
else
|
||||
setfont $CONSOLEFONT -C /dev/tty${i} \
|
||||
>/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: mountfs
|
||||
# REQUIRE: SERVERS checkfs
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="mountfs"
|
||||
start_cmd="mountfs_start"
|
||||
stop_cmd=":"
|
||||
|
||||
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs"
|
||||
NETFS="$NETFS,noshfs,nofuse,nofuseblk"
|
||||
|
||||
mountfs_start()
|
||||
{
|
||||
echo "Mounting local filesystems."
|
||||
mount -n -o remount,rw /
|
||||
rm -f /etc/mtab*
|
||||
# make sure / gets written to /etc/mtab
|
||||
mount -o remount,rw /
|
||||
# Write /proc, /sys and /dev to /etc/mtab
|
||||
if [ -e /proc/mounts ]; then
|
||||
grep -e "/proc " -e "/sys " -e "/dev " /proc/mounts \
|
||||
>> /etc/mtab
|
||||
fi
|
||||
# now mount all the local filesystems
|
||||
mount -a -t $NETFS
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,224 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: network,v 1.57 2008/10/11 17:28:03 christos Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: network
|
||||
# REQUIRE: mountfs sysclock
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="network"
|
||||
start_cmd="network_start"
|
||||
stop_cmd="network_stop"
|
||||
required_dirs="/sys/class/net/lo"
|
||||
|
||||
nl='
|
||||
' # a newline
|
||||
|
||||
network_start()
|
||||
{
|
||||
# set hostname, turn on network
|
||||
#
|
||||
echo "Starting network."
|
||||
|
||||
# If $hostname is set, use it for my Internet name,
|
||||
# otherwise use /etc/myname
|
||||
#
|
||||
if [ -z "$hostname" ] && [ -f /etc/myname ]; then
|
||||
hostname=$(cat /etc/myname)
|
||||
fi
|
||||
if [ -n "$hostname" ]; then
|
||||
echo "Setting hostname: $hostname."
|
||||
hostname $hostname
|
||||
fi
|
||||
|
||||
# Set the address for the first loopback interface, so that the
|
||||
# auto-route from a newly configured interface's address to lo0
|
||||
# works correctly.
|
||||
#
|
||||
# NOTE: obscure networking problems will occur if lo0 isn't configured.
|
||||
#
|
||||
ifconfig lo 127.0.0.1 up
|
||||
|
||||
# Configure all of the network interfaces listed in $net_interfaces;
|
||||
# if $auto_ifconfig is YES, grab all interfaces from ifconfig.
|
||||
# In the following, "xxN" stands in for interface names, like "le0".
|
||||
#
|
||||
# For any interfaces that has an $ifconfig_xxN variable
|
||||
# associated, we break it into lines using ';' as a separator,
|
||||
# then process it just like the contents of an /etc/ifconfig.xxN
|
||||
# file.
|
||||
#
|
||||
# For each line from the $ifconfig_xxN variable or the
|
||||
# /etc/ifconfig.xxN file, we ignore comments and blank lines,
|
||||
# treat lines beginning with "!" as commands to execute, treat
|
||||
# "dhcp" as a special case to invoke dhcpcd, and for any other
|
||||
# line we run "ifconfig xxN", using each line of the file as the
|
||||
# arguments for a separate "ifconfig" invocation.
|
||||
#
|
||||
# In order to configure an interface reasonably, you at the very least
|
||||
# need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"),
|
||||
# and probably a netmask (as in "netmask 0xffffffe0"). You will
|
||||
# frequently need to specify a media type, as in "media UTP", for
|
||||
# interface cards with multiple media connections that do not
|
||||
# autoconfigure. See the ifconfig manual page for details.
|
||||
#
|
||||
# Note that /etc/ifconfig.xxN takes multiple lines. The following
|
||||
# configuration is possible:
|
||||
# inet 10.1.1.1 netmask 0xffffff00
|
||||
# inet 10.1.1.2 netmask 0xffffff00 alias
|
||||
# inet6 2001:db8::1 prefixlen 64 alias
|
||||
#
|
||||
# You can put shell script fragment into /etc/ifconfig.xxN by
|
||||
# starting a line with "!". Refer to ifconfig.if(5) for details.
|
||||
#
|
||||
if [ "$net_interfaces" != NO ]; then
|
||||
if checkyesno auto_ifconfig; then
|
||||
tmp=$(/sbin/ifconfig -l)
|
||||
for cloner in $(ls /sys/class/net/eth* 2>/dev/null); do
|
||||
for int in /etc/ifconfig.${cloner}[0-9]*; do
|
||||
[ ! -f $int ] && break
|
||||
tmp="$tmp ${int##*.}"
|
||||
done
|
||||
done
|
||||
else
|
||||
tmp="$net_interfaces"
|
||||
fi
|
||||
|
||||
echo 'Configuring network interfaces.'
|
||||
for int in ${tmp}; do
|
||||
eval argslist=\$ifconfig_$int
|
||||
|
||||
# Skip interfaces that do not have explicit
|
||||
# configuration information. If auto_ifconfig is
|
||||
# false then also warn about such interfaces.
|
||||
#
|
||||
if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ]
|
||||
then
|
||||
if ! checkyesno auto_ifconfig; then
|
||||
echo
|
||||
warn \
|
||||
"/etc/ifconfig.$int missing and ifconfig_$int not set;"
|
||||
warn "interface $int not configured."
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# If $ifconfig_xxN is empty, then use
|
||||
# /etc/ifconfig.xxN, which we know exists due to
|
||||
# an earlier test.
|
||||
#
|
||||
# If $ifconfig_xxN is non-empty and contains a
|
||||
# newline, then just use it as is. (This allows
|
||||
# semicolons through unmolested.)
|
||||
#
|
||||
# If $ifconfig_xxN is non-empty and does not
|
||||
# contain a newline, then convert all semicolons
|
||||
# to newlines.
|
||||
#
|
||||
case "$argslist" in
|
||||
'')
|
||||
cat /etc/ifconfig.$int
|
||||
;;
|
||||
*"${nl}"*)
|
||||
echo "$argslist"
|
||||
;;
|
||||
*)
|
||||
(
|
||||
set -o noglob
|
||||
IFS=';'; set -- $argslist
|
||||
#echo >&2 "[$#] [$1] [$2] [$3] [$4]"
|
||||
IFS="$nl"; echo "$*"
|
||||
)
|
||||
;;
|
||||
esac |
|
||||
while read -r args; do
|
||||
case "$args" in
|
||||
''|"#"*|create)
|
||||
;;
|
||||
"!"*)
|
||||
# Run arbitrary command in a subshell.
|
||||
( eval "${args#*!}" )
|
||||
;;
|
||||
dhcp)
|
||||
dhcpcd -n ${dhcpcd_flags} $int
|
||||
;;
|
||||
*)
|
||||
# Pass args to ifconfig. Note
|
||||
# that args may contain embedded
|
||||
# shell metacharacters, such as
|
||||
# "ssid 'foo;*>bar'". We eval
|
||||
# one more time so that things
|
||||
# like ssid "Columbia University" work.
|
||||
(
|
||||
set -o noglob
|
||||
eval set -- $args
|
||||
#echo >&2 "[$#] [$1] [$2] [$3]"
|
||||
ifconfig $int "$@"
|
||||
)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
configured_interfaces="$configured_interfaces $int"
|
||||
done
|
||||
fi
|
||||
|
||||
# Check $defaultroute, then /etc/mygate, for the name or address
|
||||
# of my IPv4 gateway host. If using a name, that name must be in
|
||||
# /etc/hosts.
|
||||
#
|
||||
if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then
|
||||
defaultroute=$(cat /etc/mygate)
|
||||
fi
|
||||
if [ -n "$defaultroute" ]; then
|
||||
route add default gw $defaultroute
|
||||
fi
|
||||
|
||||
# Check $defaultroute6, then /etc/mygate6, for the name or address
|
||||
# of my IPv6 gateway host. If using a name, that name must be in
|
||||
# /etc/hosts. Note that the gateway host address must be a link-local
|
||||
# address if it is not using an stf* interface.
|
||||
#
|
||||
if [ -z "$defaultroute6" ] && [ -f /etc/mygate6 ]; then
|
||||
defaultroute6=$(cat /etc/mygate6)
|
||||
fi
|
||||
if [ -n "$defaultroute6" ]; then
|
||||
if [ "$ip6mode" = "autohost" ]; then
|
||||
echo
|
||||
warn \
|
||||
"ip6mode is set to 'autohost' and a v6 default route is also set."
|
||||
fi
|
||||
route -A inet6 add $defaultroute6
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
network_stop()
|
||||
{
|
||||
echo "Stopping network."
|
||||
|
||||
# down interfaces
|
||||
#
|
||||
echo -n 'Downing network interfaces:'
|
||||
if [ "$net_interfaces" != NO ]; then
|
||||
if checkyesno auto_ifconfig; then
|
||||
tmp=$(ls /sys/class/net/eth*)
|
||||
else
|
||||
tmp="$net_interfaces"
|
||||
fi
|
||||
for int in $tmp; do
|
||||
eval args=\$ifconfig_$int
|
||||
if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
|
||||
echo -n " $int"
|
||||
dhcpcd -k $int 2> /dev/null
|
||||
ifconfig $int down
|
||||
fi
|
||||
done
|
||||
echo "."
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: persistent_rules
|
||||
# REQUIRE: SERVERS locale
|
||||
# BEFORE: NETWORKING
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="persistent_rules"
|
||||
start_cmd="persistent_start"
|
||||
stop_cmd=":"
|
||||
|
||||
persistent_start()
|
||||
{
|
||||
# Adding persistent network/cdrom generated rules
|
||||
if [ -f "/dev/.udev/tmp-rules--70-persistent-cd.rules" ]; then
|
||||
echo "Adding persistent cdrom udev rules."
|
||||
cat /dev/.udev/tmp-rules--70-persistent-cd.rules \
|
||||
>> /etc/udev/rules.d/70-persistent-cd.rules
|
||||
fi
|
||||
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then
|
||||
echo "Adding persistent network udev rules."
|
||||
cat /dev/.udev/tmp-rules--70-persistent-net.rules \
|
||||
>> /etc/udev/rules.d/70-persistent-net.rules
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: random_seed
|
||||
# REQUIRE: SERVERS sysclock
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="random_seed"
|
||||
start_cmd="rseed_start"
|
||||
stop_cmd=":"
|
||||
|
||||
rseed_start()
|
||||
{
|
||||
if [ -f /var/run/random-seed ]; then
|
||||
echo "Initializing random seed."
|
||||
cat /var/run/random-seed >/dev/urandom
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: swap
|
||||
# REQUIRE: SERVERS mountfs
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="swap"
|
||||
start_cmd="swap_start"
|
||||
stop_cmd=":"
|
||||
|
||||
swap_start()
|
||||
{
|
||||
echo "Activating swap."
|
||||
swapon -a
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: sysclock
|
||||
# REQUIRE: SERVERS swap
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="sysclock"
|
||||
start_cmd="sysclock_start"
|
||||
stop_cmd=":"
|
||||
|
||||
sysclock_start()
|
||||
{
|
||||
echo "Configuring system clock."
|
||||
[ ! -d /var/lib/hwclock ] && mkdir -p /var/lib/hwclock
|
||||
if [ ! -f /var/lib/hwclock/adjtime ]; then
|
||||
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime
|
||||
fi
|
||||
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
|
||||
rm -f /etc/localtime
|
||||
cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
fi
|
||||
|
||||
hwclock $HWCLOCK_PARAMS 2>&1 >/dev/null
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: udev_events
|
||||
# REQUIRE: udevd
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="udev_events"
|
||||
start_cmd="udev_events_start"
|
||||
stop_cmd=":"
|
||||
|
||||
udev_events_start()
|
||||
{
|
||||
echo "Waiting for udev uevents."
|
||||
udevadm trigger
|
||||
udevadm settle
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: udevd
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="udevd"
|
||||
rcvar=$name
|
||||
command="/sbin/udevd"
|
||||
command_args="--daemon"
|
||||
start_precmd="udevd_precmd"
|
||||
|
||||
udevd_precmd()
|
||||
{
|
||||
# More initial /dev setup that udev doesn't do
|
||||
[ ! -d /dev/pts ] && /bin/mkdir /dev/pts
|
||||
[ ! -d /dev/shm ] && /bin/mkdir /dev/shm
|
||||
|
||||
echo > /proc/sys/kernel/hotplug
|
||||
echo
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.local: Local multi-user startup script.
|
||||
#
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.local.shutdown: Local shutdown script.
|
||||
#
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This script is called when runlevel 3 (multiuser) is entered.
|
||||
#
|
||||
|
||||
export HOME=/
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
umask 022
|
||||
|
||||
. /etc/rc.subr
|
||||
. /etc/rc.conf
|
||||
_rc_conf_loaded=true
|
||||
|
||||
# Start services
|
||||
files=$(rcorder -s nostart ${rc_rcorder_flags} /etc/rc.d/*)
|
||||
|
||||
for _rc_elem in $files; do
|
||||
run_rc_script $_rc_elem start
|
||||
done
|
||||
|
||||
[ -x /etc/rc.local ] && /etc/rc.local
|
|
@ -1,85 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.shutdown
|
||||
#
|
||||
|
||||
export HOME=/
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /etc/rc.subr
|
||||
. /etc/rc.conf
|
||||
|
||||
[ -x /etc/rc.local.shutdown ] && /etc/rc.local.shutdown
|
||||
|
||||
echo "****************************************************"
|
||||
echo " STOPPING SERVICES "
|
||||
echo "****************************************************"
|
||||
|
||||
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
|
||||
# Shutdown daemons
|
||||
files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} /etc/rc.d/*)
|
||||
|
||||
for _rc_elem in $(reverse_list $files); do
|
||||
run_rc_script $_rc_elem stop
|
||||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*****************************************************"
|
||||
echo " SYSTEM GOING DOWN "
|
||||
echo "*****************************************************"
|
||||
|
||||
# Terminate all processes
|
||||
echo "Sending SIGTERM to processes."
|
||||
killall5 -15 > /dev/null
|
||||
|
||||
echo "Sending SIGKILL to processes."
|
||||
killall5 -9 > /dev/null
|
||||
|
||||
echo "Saving random seed."
|
||||
dd if=/dev/urandom of=/var/run/random-seed count=1 bs=512 2> /dev/null
|
||||
|
||||
echo "Saving system clock."
|
||||
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
|
||||
rm -f /etc/localtime
|
||||
cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
fi
|
||||
|
||||
HWCLOCK_PARAMS="--systohc"
|
||||
if [ "$HARDWARECLOCK" = "UTC" ]; then
|
||||
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
|
||||
else
|
||||
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
|
||||
fi
|
||||
hwclock $HWCLOCK_PARAMS
|
||||
|
||||
# removing psmouse module to fix some reboot issues on newer laptops
|
||||
modprobe -r psmouse >/dev/null 2>&1
|
||||
|
||||
# Write to wtmp file before unmounting
|
||||
halt -w
|
||||
|
||||
echo "Deactivating swap."
|
||||
swapoff -a
|
||||
|
||||
echo "Unmounting filesystems."
|
||||
umount -a -r -t noramfs,notmpfs,nosysfs,noproc
|
||||
|
||||
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
|
||||
if [ -x /sbin/lvm -a -d /sys/block ]; then
|
||||
echo "Deactivating LVM2 groups."
|
||||
lvm vgchange --ignorelockingfailure -an >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Remounting root filesystem read-only."
|
||||
mount -n -o remount,ro /
|
||||
|
||||
# Power off or reboot
|
||||
if [ "$RUNLEVEL" = "0" ]; then
|
||||
poweroff -d -f -h -i
|
||||
else
|
||||
# if kexec is installed and a kernel is loaded, use it
|
||||
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1
|
||||
reboot -d -f -i
|
||||
fi
|
|
@ -1,57 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.single: Single-user startup script.
|
||||
#
|
||||
|
||||
export HOME=/
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
umask 022
|
||||
|
||||
. /etc/rc.subr
|
||||
. /etc/rc.conf
|
||||
_rc_conf_loaded=true
|
||||
|
||||
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
|
||||
# Determine the shutdown order of the /etc/rc.d scripts,
|
||||
# and perform the operation
|
||||
#
|
||||
files=$(rcorder ${rcshutdown_rcorder_flags} /etc/rc.d/*)
|
||||
|
||||
for _rc_elem in $(reverse_list $files); do
|
||||
run_rc_script $_rc_elem stop
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$PREVLEVEL" != "N" ]; then
|
||||
echo -n "=> Sending SIGTERM to processes... "
|
||||
killall5 -15 &> /dev/null
|
||||
sleep 5
|
||||
echo "done."
|
||||
|
||||
echo -n "=> Sending SIGKILL to processes... "
|
||||
killall5 -9
|
||||
sleep 1
|
||||
echo "done."
|
||||
|
||||
if [ -x /sbin/udevadm -a -d /sys/block ]; then
|
||||
/etc/rc.d/udevd start
|
||||
/etc/rc.d/udev_events start
|
||||
else
|
||||
# Static /dev, our last resort
|
||||
echo "=> Using static /dev filesystem"
|
||||
fi
|
||||
|
||||
# Start syslogd.
|
||||
if [ -x /etc/rc.d/syslogd -a -x /etc/rc.d/klogd ]; then
|
||||
/etc/rc.d/klogd start
|
||||
/etc/rc.d/syslogd start
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$RUNLEVEL" = "1" ]; then
|
||||
echo
|
||||
echo "*** Entering single-user mode..."
|
||||
# make sure /dev/initctl is in place
|
||||
kill -HUP 1
|
||||
exec /sbin/init -t1 S
|
||||
fi
|
|
@ -1,827 +0,0 @@
|
|||
# $NetBSD: rc.subr,v 1.74 2008/12/06 23:21:32 salo Exp $
|
||||
#
|
||||
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Luke Mewburn.
|
||||
#
|
||||
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
#
|
||||
# rc.subr
|
||||
# functions used by various rc scripts
|
||||
#
|
||||
|
||||
: ${rcvar_manpage:='rc.conf(5)'}
|
||||
: ${RC_PID:=$$} ; export RC_PID
|
||||
|
||||
#
|
||||
# functions
|
||||
# ---------
|
||||
|
||||
#
|
||||
# checkyesno var
|
||||
# Test $1 variable, and warn if not set to YES or NO.
|
||||
# Return 0 if it's "yes" (et al), nonzero otherwise.
|
||||
#
|
||||
checkyesno()
|
||||
{
|
||||
eval _value=\$${1}
|
||||
case $_value in
|
||||
|
||||
# "yes", "true", "on", or "1"
|
||||
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
|
||||
return 0
|
||||
;;
|
||||
|
||||
# "no", "false", "off", or "0"
|
||||
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
warn "\$${1} is not set properly - see ${rcvar_manpage}."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# reverse_list list
|
||||
# print the list in reverse order
|
||||
#
|
||||
reverse_list()
|
||||
{
|
||||
_revlist=
|
||||
for _revfile; do
|
||||
_revlist="$_revfile $_revlist"
|
||||
done
|
||||
echo $_revlist
|
||||
}
|
||||
|
||||
#
|
||||
# If booting directly to multiuser, send SIGTERM to
|
||||
# the parent (/etc/rc) to abort the boot.
|
||||
# Otherwise just exit.
|
||||
#
|
||||
stop_boot()
|
||||
{
|
||||
if [ "$autoboot" = yes ]; then
|
||||
echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
|
||||
kill -TERM ${RC_PID}
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# check_pidfile pidfile procname [interpreter]
|
||||
# Parses the first line of pidfile for a PID, and ensures
|
||||
# that the process is running and matches procname.
|
||||
# Prints the matching PID upon success, nothing otherwise.
|
||||
# interpreter is optional; see _find_processes() for details.
|
||||
#
|
||||
check_pidfile()
|
||||
{
|
||||
_pidfile=$1
|
||||
_procname=$2
|
||||
_interpreter=$3
|
||||
if [ -z "$_pidfile" -o -z "$_procname" ]; then
|
||||
err 3 'USAGE: check_pidfile pidfile procname [interpreter]'
|
||||
fi
|
||||
if [ ! -f $_pidfile ]; then
|
||||
return
|
||||
fi
|
||||
read _pid _junk < $_pidfile
|
||||
if [ -z "$_pid" ]; then
|
||||
return
|
||||
fi
|
||||
_find_processes $_procname ${_interpreter:-.} '-p '"$_pid"
|
||||
}
|
||||
|
||||
#
|
||||
# check_process procname [interpreter]
|
||||
# Ensures that a process (or processes) named procname is running.
|
||||
# Prints a list of matching PIDs.
|
||||
# interpreter is optional; see _find_processes() for details.
|
||||
#
|
||||
check_process()
|
||||
{
|
||||
_procname=$1
|
||||
_interpreter=$2
|
||||
if [ -z "$_procname" ]; then
|
||||
err 3 'USAGE: check_process procname [interpreter]'
|
||||
fi
|
||||
_find_processes $_procname ${_interpreter:-.} 'ax'
|
||||
}
|
||||
|
||||
#
|
||||
# _find_processes procname interpreter psargs
|
||||
# Search for procname in the output of ps generated by psargs.
|
||||
# Prints the PIDs of any matching processes, space separated.
|
||||
#
|
||||
# If interpreter == ".", check the following variations of procname
|
||||
# against the first word of each command:
|
||||
# procname
|
||||
# `basename procname`
|
||||
# `basename procname` + ":"
|
||||
# "(" + `basename procname` + ")"
|
||||
#
|
||||
# If interpreter != ".", read the first line of procname, remove the
|
||||
# leading #!, normalise whitespace, append procname, and attempt to
|
||||
# match that against each command, either as is, or with extra words
|
||||
# at the end. As an alternative, to deal with interpreted daemons
|
||||
# using perl, the basename of the interpreter plus a colon is also
|
||||
# tried as the prefix to procname.
|
||||
#
|
||||
_find_processes()
|
||||
{
|
||||
if [ $# -ne 3 ]; then
|
||||
err 3 'USAGE: _find_processes procname interpreter psargs'
|
||||
fi
|
||||
_procname=$1
|
||||
_interpreter=$2
|
||||
_psargs=$3
|
||||
|
||||
_pref=
|
||||
_procnamebn=${_procname##*/}
|
||||
if [ $_interpreter != "." ]; then # an interpreted script
|
||||
read _interp < ${_chroot:-}/$_procname # read interpreter name
|
||||
_interp=${_interp#\#!} # strip #!
|
||||
set -- $_interp
|
||||
if [ $_interpreter != $1 ]; then
|
||||
warn "\$command_interpreter $_interpreter != $1"
|
||||
fi
|
||||
_interp="$* $_procname" # cleanup spaces, add _procname
|
||||
_interpbn=${1##*/}
|
||||
_fp_args='_argv'
|
||||
_fp_match='case "$_argv" in
|
||||
$_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")'
|
||||
else # a normal daemon
|
||||
_fp_args='_arg0 _argv'
|
||||
_fp_match='case "$_arg0" in
|
||||
$_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")'
|
||||
fi
|
||||
|
||||
_proccheck='
|
||||
ps -o "pid,command" '"$_psargs"' |
|
||||
while read _npid '"$_fp_args"'; do
|
||||
case "$_npid" in
|
||||
PID)
|
||||
continue ;;
|
||||
esac ; '"$_fp_match"'
|
||||
echo -n "$_pref$_npid" ;
|
||||
_pref=" "
|
||||
;;
|
||||
esac
|
||||
done'
|
||||
|
||||
#echo 1>&2 "proccheck is :$_proccheck:"
|
||||
eval $_proccheck
|
||||
}
|
||||
|
||||
#
|
||||
# wait_for_pids pid [pid ...]
|
||||
# spins until none of the pids exist
|
||||
#
|
||||
wait_for_pids()
|
||||
{
|
||||
_list="$@"
|
||||
if [ -z "$_list" ]; then
|
||||
return
|
||||
fi
|
||||
_prefix=
|
||||
while true; do
|
||||
_nlist="";
|
||||
for _j in $_list; do
|
||||
if kill -0 $_j 2>/dev/null; then
|
||||
_nlist="${_nlist}${_nlist:+ }$_j"
|
||||
fi
|
||||
done
|
||||
if [ -z "$_nlist" ]; then
|
||||
break
|
||||
fi
|
||||
_list=$_nlist
|
||||
echo -n ${_prefix:-"Waiting for PIDS: "}$_list
|
||||
_prefix=", "
|
||||
sleep 2
|
||||
done
|
||||
if [ -n "$_prefix" ]; then
|
||||
echo "."
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# run_rc_command argument
|
||||
# Search for argument in the list of supported commands, which is:
|
||||
# "start stop restart rcvar status poll ${extra_commands}"
|
||||
# If there's a match, run ${argument}_cmd or the default method
|
||||
# (see below).
|
||||
#
|
||||
# If argument has a given prefix, then change the operation as follows:
|
||||
# Prefix Operation
|
||||
# ------ ---------
|
||||
# fast Skip the pid check, and set rc_fast=yes
|
||||
# force Set ${rcvar} to YES, and set rc_force=yes
|
||||
# one Set ${rcvar} to YES
|
||||
#
|
||||
# The following globals are used:
|
||||
#
|
||||
# Name Needed Purpose
|
||||
# ---- ------ -------
|
||||
# name y Name of script.
|
||||
#
|
||||
# command n Full path to command.
|
||||
# Not needed if ${rc_arg}_cmd is set for
|
||||
# each keyword.
|
||||
#
|
||||
# command_args n Optional args/shell directives for command.
|
||||
#
|
||||
# command_interpreter n If not empty, command is interpreted, so
|
||||
# call check_{pidfile,process}() appropriately.
|
||||
#
|
||||
# extra_commands n List of extra commands supported.
|
||||
#
|
||||
# pidfile n If set, use check_pidfile $pidfile $command,
|
||||
# otherwise use check_process $command.
|
||||
# In either case, only check if $command is set.
|
||||
#
|
||||
# procname n Process name to check for instead of $command.
|
||||
#
|
||||
# rcvar n This is checked with checkyesno to determine
|
||||
# if the action should be run.
|
||||
#
|
||||
# ${name}_chroot n Directory to chroot to before running ${command}
|
||||
# Requires /usr to be mounted.
|
||||
#
|
||||
# ${name}_chdir n Directory to cd to before running ${command}
|
||||
# (if not using ${name}_chroot).
|
||||
#
|
||||
# ${name}_flags n Arguments to call ${command} with.
|
||||
# NOTE: $flags from the parent environment
|
||||
# can be used to override this.
|
||||
#
|
||||
# ${name}_env n Additional environment variable settings
|
||||
# for running ${command}
|
||||
#
|
||||
# ${name}_nice n Nice level to run ${command} at.
|
||||
#
|
||||
# ${name}_user n User to run ${command} as, using su(1) if not
|
||||
# using ${name}_chroot.
|
||||
# Requires /usr to be mounted.
|
||||
#
|
||||
# ${name}_group n Group to run chrooted ${command} as.
|
||||
# Requires /usr to be mounted.
|
||||
#
|
||||
# ${name}_groups n Comma separated list of supplementary groups
|
||||
# to run the chrooted ${command} with.
|
||||
# Requires /usr to be mounted.
|
||||
#
|
||||
# ${rc_arg}_cmd n If set, use this as the method when invoked;
|
||||
# Otherwise, use default command (see below)
|
||||
#
|
||||
# ${rc_arg}_precmd n If set, run just before performing the
|
||||
# ${rc_arg}_cmd method in the default
|
||||
# operation (i.e, after checking for required
|
||||
# bits and process (non)existence).
|
||||
# If this completes with a non-zero exit code,
|
||||
# don't run ${rc_arg}_cmd.
|
||||
#
|
||||
# ${rc_arg}_postcmd n If set, run just after performing the
|
||||
# ${rc_arg}_cmd method, if that method
|
||||
# returned a zero exit code.
|
||||
#
|
||||
# required_dirs n If set, check for the existence of the given
|
||||
# directories before running the default
|
||||
# (re)start command.
|
||||
#
|
||||
# required_files n If set, check for the readability of the given
|
||||
# files before running the default (re)start
|
||||
# command.
|
||||
#
|
||||
# required_vars n If set, perform checkyesno on each of the
|
||||
# listed variables before running the default
|
||||
# (re)start command.
|
||||
#
|
||||
# Default behaviour for a given argument, if no override method is
|
||||
# provided:
|
||||
#
|
||||
# Argument Default behaviour
|
||||
# -------- -----------------
|
||||
# start if !running && checkyesno ${rcvar}
|
||||
# ${command}
|
||||
#
|
||||
# stop if ${pidfile}
|
||||
# rc_pid=$(check_pidfile $pidfile $command)
|
||||
# else
|
||||
# rc_pid=$(check_process $command)
|
||||
# kill $sig_stop $rc_pid
|
||||
# wait_for_pids $rc_pid
|
||||
# ($sig_stop defaults to TERM.)
|
||||
#
|
||||
# reload Similar to stop, except use $sig_reload instead,
|
||||
# and doesn't wait_for_pids.
|
||||
# $sig_reload defaults to HUP.
|
||||
#
|
||||
# restart Run `stop' then `start'.
|
||||
#
|
||||
# status Show if ${command} is running, etc.
|
||||
#
|
||||
# poll Wait for ${command} to exit.
|
||||
#
|
||||
# rcvar Display what rc.conf variable is used (if any).
|
||||
#
|
||||
# Variables available to methods, and after run_rc_command() has
|
||||
# completed:
|
||||
#
|
||||
# Variable Purpose
|
||||
# -------- -------
|
||||
# rc_arg Argument to command, after fast/force/one processing
|
||||
# performed
|
||||
#
|
||||
# rc_flags Flags to start the default command with.
|
||||
# Defaults to ${name}_flags, unless overridden
|
||||
# by $flags from the environment.
|
||||
# This variable may be changed by the precmd method.
|
||||
#
|
||||
# rc_pid PID of command (if appropriate)
|
||||
#
|
||||
# rc_fast Not empty if "fast" was provided (q.v.)
|
||||
#
|
||||
# rc_force Not empty if "force" was provided (q.v.)
|
||||
#
|
||||
#
|
||||
run_rc_command()
|
||||
{
|
||||
rc_arg=$1
|
||||
if [ -z "$name" ]; then
|
||||
err 3 'run_rc_command: $name is not set.'
|
||||
fi
|
||||
|
||||
_rc_prefix=
|
||||
case "$rc_arg" in
|
||||
fast*) # "fast" prefix; don't check pid
|
||||
rc_arg=${rc_arg#fast}
|
||||
rc_fast=yes
|
||||
;;
|
||||
force*) # "force" prefix; always run
|
||||
rc_force=yes
|
||||
_rc_prefix=force
|
||||
rc_arg=${rc_arg#${_rc_prefix}}
|
||||
if [ -n "${rcvar}" ]; then
|
||||
eval ${rcvar}=YES
|
||||
fi
|
||||
;;
|
||||
one*) # "one" prefix; set ${rcvar}=yes
|
||||
_rc_prefix=one
|
||||
rc_arg=${rc_arg#${_rc_prefix}}
|
||||
if [ -n "${rcvar}" ]; then
|
||||
eval ${rcvar}=YES
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
_keywords="start stop restart rcvar $extra_commands"
|
||||
rc_pid=
|
||||
_pidcmd=
|
||||
_procname=${procname:-${command}}
|
||||
|
||||
# setup pid check command if not fast
|
||||
if [ -z "$rc_fast" -a -n "$_procname" ]; then
|
||||
if [ -n "$pidfile" ]; then
|
||||
_pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')'
|
||||
else
|
||||
_pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')'
|
||||
fi
|
||||
if [ -n "$_pidcmd" ]; then
|
||||
_keywords="${_keywords} status poll"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$rc_arg" ]; then
|
||||
rc_usage "$_keywords"
|
||||
fi
|
||||
|
||||
if [ -n "$flags" ]; then # allow override from environment
|
||||
rc_flags=$flags
|
||||
else
|
||||
eval rc_flags=\$${name}_flags
|
||||
fi
|
||||
eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
|
||||
_nice=\$${name}_nice _user=\$${name}_user \
|
||||
_group=\$${name}_group _groups=\$${name}_groups \
|
||||
_env=\"\$${name}_env\"
|
||||
|
||||
if [ -n "$_user" ]; then # unset $_user if running as that user
|
||||
if [ "$_user" = "$(id -un)" ]; then
|
||||
unset _user
|
||||
fi
|
||||
fi
|
||||
|
||||
# if ${rcvar} is set, and $1 is not
|
||||
# "rcvar", then run
|
||||
# checkyesno ${rcvar}
|
||||
# and return if that failed or warn
|
||||
# user and exit when interactive
|
||||
#
|
||||
if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then
|
||||
if ! checkyesno ${rcvar}; then
|
||||
# check whether interactive or not
|
||||
if [ -n "$_run_rc_script" ]; then
|
||||
return 0
|
||||
fi
|
||||
for _elem in $_keywords; do
|
||||
if [ "$_elem" = "$rc_arg" ]; then
|
||||
echo 1>&2 "\$${rcvar} is not enabled - see ${rcvar_manpage}."
|
||||
echo 1>&2 "Use the following if you wish to perform the operation:"
|
||||
echo 1>&2 " $0 one${rc_arg}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo 1>&2 "$0: unknown directive '$rc_arg'."
|
||||
rc_usage "$_keywords"
|
||||
fi
|
||||
fi
|
||||
|
||||
eval $_pidcmd # determine the pid if necessary
|
||||
|
||||
for _elem in $_keywords; do
|
||||
if [ "$_elem" != "$rc_arg" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# if there's a custom ${XXX_cmd},
|
||||
# run that instead of the default
|
||||
#
|
||||
eval _cmd=\$${rc_arg}_cmd _precmd=\$${rc_arg}_precmd \
|
||||
_postcmd=\$${rc_arg}_postcmd
|
||||
if [ -n "$_cmd" ]; then
|
||||
# if the precmd failed and force
|
||||
# isn't set, exit
|
||||
#
|
||||
if ! eval $_precmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! eval $_cmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
eval $_postcmd
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "$rc_arg" in # default operations...
|
||||
|
||||
status)
|
||||
if [ -n "$rc_pid" ]; then
|
||||
echo "${name} is running as pid $rc_pid."
|
||||
else
|
||||
echo "${name} is not running."
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
|
||||
start)
|
||||
if [ -n "$rc_pid" ]; then
|
||||
echo 1>&2 "${name} already running? (pid=$rc_pid)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x ${_chroot}${command} ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# check for required variables,
|
||||
# directories, and files
|
||||
#
|
||||
for _f in $required_vars; do
|
||||
if ! checkyesno $_f; then
|
||||
warn "\$${_f} is not enabled."
|
||||
if [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for _f in $required_dirs; do
|
||||
if [ ! -d "${_f}/." ]; then
|
||||
warn "${_f} is not a directory."
|
||||
if [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for _f in $required_files; do
|
||||
if [ ! -r "${_f}" ]; then
|
||||
warn "${_f} is not readable."
|
||||
if [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# if the precmd failed and force
|
||||
# isn't set, exit
|
||||
#
|
||||
if ! eval $_precmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# setup the command to run, and run it
|
||||
#
|
||||
echo "Starting ${name}."
|
||||
if [ -n "$_chroot" ]; then
|
||||
_doit="\
|
||||
${_env:+env $_env }\
|
||||
${_nice:+nice -n $_nice }\
|
||||
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
|
||||
$_chroot $command $rc_flags $command_args"
|
||||
else
|
||||
_doit="\
|
||||
${_chdir:+cd $_chdir; }\
|
||||
${_env:+env $_env }\
|
||||
${_nice:+nice -n $_nice }\
|
||||
$command $rc_flags $command_args"
|
||||
if [ -n "$_user" ]; then
|
||||
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# if the cmd failed and force
|
||||
# isn't set, exit
|
||||
#
|
||||
if ! eval $_doit && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# finally, run postcmd
|
||||
#
|
||||
eval $_postcmd
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ -z "$rc_pid" ]; then
|
||||
if [ -n "$pidfile" ]; then
|
||||
echo 1>&2 \
|
||||
"${name} not running? (check $pidfile)."
|
||||
else
|
||||
echo 1>&2 "${name} not running?"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if the precmd failed and force
|
||||
# isn't set, exit
|
||||
#
|
||||
if ! eval $_precmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# send the signal to stop
|
||||
#
|
||||
echo "Stopping ${name}."
|
||||
_doit="kill -${sig_stop:-TERM} $rc_pid"
|
||||
if [ -n "$_user" ]; then
|
||||
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
|
||||
fi
|
||||
|
||||
# if the stop cmd failed and force
|
||||
# isn't set, exit
|
||||
#
|
||||
if ! eval $_doit && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# wait for the command to exit,
|
||||
# and run postcmd.
|
||||
wait_for_pids $rc_pid
|
||||
eval $_postcmd
|
||||
;;
|
||||
|
||||
reload)
|
||||
if [ -z "$rc_pid" ]; then
|
||||
if [ -n "$pidfile" ]; then
|
||||
echo 1>&2 \
|
||||
"${name} not running? (check $pidfile)."
|
||||
else
|
||||
echo 1>&2 "${name} not running?"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
echo "Reloading ${name} config files."
|
||||
if ! eval $_precmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
_doit="kill -${sig_reload:-HUP} $rc_pid"
|
||||
if [ -n "$_user" ]; then
|
||||
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
|
||||
fi
|
||||
if ! eval $_doit && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
eval $_postcmd
|
||||
;;
|
||||
|
||||
restart)
|
||||
if ! eval $_precmd && [ -z "$rc_force" ]; then
|
||||
return 1
|
||||
fi
|
||||
# prevent restart being called more
|
||||
# than once by any given script
|
||||
#
|
||||
if ${_rc_restart_done:-false}; then
|
||||
return 0
|
||||
fi
|
||||
_rc_restart_done=true
|
||||
|
||||
( $0 ${_rc_prefix}stop )
|
||||
$0 ${_rc_prefix}start
|
||||
|
||||
eval $_postcmd
|
||||
;;
|
||||
|
||||
poll)
|
||||
if [ -n "$rc_pid" ]; then
|
||||
wait_for_pids $rc_pid
|
||||
fi
|
||||
;;
|
||||
|
||||
rcvar)
|
||||
echo "# $name"
|
||||
if [ -n "$rcvar" ]; then
|
||||
if checkyesno ${rcvar}; then
|
||||
echo "\$${rcvar}=YES"
|
||||
else
|
||||
echo "\$${rcvar}=NO"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
rc_usage "$_keywords"
|
||||
;;
|
||||
|
||||
esac
|
||||
return 0
|
||||
done
|
||||
|
||||
echo 1>&2 "$0: unknown directive '$rc_arg'."
|
||||
rc_usage "$_keywords"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# run_rc_script file arg
|
||||
# Start the script `file' with `arg', and correctly handle the
|
||||
# return value from the script. If `file' ends with `.sh', it's
|
||||
# sourced into the current environment. If `file' appears to be
|
||||
# a backup or scratch file, ignore it. Otherwise if it's
|
||||
# executable run as a child process.
|
||||
#
|
||||
run_rc_script()
|
||||
{
|
||||
_file=$1
|
||||
_arg=$2
|
||||
if [ -z "$_file" -o -z "$_arg" ]; then
|
||||
err 3 'USAGE: run_rc_script file arg'
|
||||
fi
|
||||
|
||||
_run_rc_script=true
|
||||
|
||||
unset name command command_args command_interpreter \
|
||||
extra_commands pidfile procname \
|
||||
rcvar required_dirs required_files required_vars
|
||||
eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd
|
||||
|
||||
case "$_file" in
|
||||
*.sh) # run in current shell
|
||||
set $_arg ; . $_file
|
||||
;;
|
||||
*[~#]|*.OLD|*.orig|*,v) # scratch file; skip
|
||||
warn "Ignoring scratch file $_file"
|
||||
;;
|
||||
*) # run in subshell
|
||||
if [ -x $_file ]; then
|
||||
if [ -n "$rc_fast_and_loose" ]; then
|
||||
set $_arg ; . $_file
|
||||
else
|
||||
( set $_arg ; . $_file )
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# load_rc_config command
|
||||
# Source in the configuration file for a given command.
|
||||
#
|
||||
load_rc_config()
|
||||
{
|
||||
_command=$1
|
||||
if [ -z "$_command" ]; then
|
||||
err 3 'USAGE: load_rc_config command'
|
||||
fi
|
||||
|
||||
if ${_rc_conf_loaded:-false}; then
|
||||
:
|
||||
else
|
||||
. /etc/rc.conf
|
||||
_rc_conf_loaded=true
|
||||
fi
|
||||
if [ -f /etc/rc.conf.d/"$_command" ]; then
|
||||
. /etc/rc.conf.d/"$_command"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# load_rc_config_var cmd var
|
||||
# Read the rc.conf(5) var for cmd and set in the
|
||||
# current shell, using load_rc_config in a subshell to prevent
|
||||
# unwanted side effects from other variable assignments.
|
||||
#
|
||||
load_rc_config_var()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
err 3 'USAGE: load_rc_config_var cmd var'
|
||||
fi
|
||||
eval $(eval '(
|
||||
load_rc_config '$1' >/dev/null;
|
||||
if [ -n "${'$2'}" -o "${'$2'-UNSET}" != "UNSET" ]; then
|
||||
echo '$2'=\'\''${'$2'}\'\'';
|
||||
fi
|
||||
)' )
|
||||
}
|
||||
|
||||
#
|
||||
# rc_usage commands
|
||||
# Print a usage string for $0, with `commands' being a list of
|
||||
# valid commands.
|
||||
#
|
||||
rc_usage()
|
||||
{
|
||||
echo -n 1>&2 "Usage: $0 [fast|force|one]("
|
||||
|
||||
_sep=
|
||||
for _elem; do
|
||||
echo -n 1>&2 "$_sep$_elem"
|
||||
_sep="|"
|
||||
done
|
||||
echo 1>&2 ")"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# err exitval message
|
||||
# Display message to stderr and log to the syslog, and exit with exitval.
|
||||
#
|
||||
err()
|
||||
{
|
||||
exitval=$1
|
||||
shift
|
||||
|
||||
if [ -x /bin/logger ]; then
|
||||
logger "$0: ERROR: $*"
|
||||
fi
|
||||
echo 1>&2 "$0: ERROR: $*"
|
||||
exit $exitval
|
||||
}
|
||||
|
||||
#
|
||||
# warn message
|
||||
# Display message to stderr and log to the syslog.
|
||||
#
|
||||
warn()
|
||||
{
|
||||
if [ -x /bin/logger ]; then
|
||||
logger "$0: WARNING: $*"
|
||||
fi
|
||||
echo 1>&2 "$0: WARNING: $*"
|
||||
}
|
||||
|
||||
show_rval()
|
||||
{
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "done."
|
||||
else
|
||||
echo "failed!"
|
||||
fi
|
||||
}
|
||||
|
||||
_rc_subr_loaded=:
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.sysinit
|
||||
#
|
||||
|
||||
export HOME=/
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /etc/rc.subr
|
||||
. /etc/rc.conf
|
||||
|
||||
echo
|
||||
echo "Welcome to the lsXL Linux system."
|
||||
echo
|
||||
|
||||
# Create our default nodes that minilogd may need
|
||||
[ ! -e /dev/null ] && mknod /dev/null c 1 3
|
||||
[ ! -e /dev/zero ] && mknod /dev/zero c 1 5
|
||||
[ ! -e /dev/console ] && mknod /dev/console c 5 1
|
||||
|
||||
# start up our mini logger until syslog takes over
|
||||
minilogd
|
||||
|
||||
# anything more serious than KERN_WARNING goes to the console
|
||||
# 'verbose' cmdline parameter enables more messages
|
||||
if grep -q " verbose" /proc/cmdline; then
|
||||
dmesg -n 8
|
||||
else
|
||||
dmesg -n 3
|
||||
fi
|
||||
|
||||
# enable rtc access
|
||||
modprobe rtc-cmos >/dev/null 2>&1
|
||||
RTC_MAJOR=$(grep -w rtc /proc/devices 2>/dev/null); RTC_MAJOR="${RTC_MAJOR%% *}"
|
||||
if [ -n "$RTC_MAJOR" ]; then
|
||||
mkdir /dev/misc/
|
||||
mknod /dev/misc/rtc0 c $RTC_MAJOR 0
|
||||
ln -s /dev/misc/rtc0 /dev/rtc
|
||||
fi
|
||||
|
||||
HWCLOCK_PARAMS="--hctosys"
|
||||
if [ "$HARDWARECLOCK" = "UTC" ]; then
|
||||
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
|
||||
else
|
||||
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
|
||||
fi
|
||||
|
||||
# Set clock early to fix some bugs with filesystem checks
|
||||
# Clock is set again later to match rc.conf
|
||||
if [ -f /etc/localtime ]; then
|
||||
hwclock $HWCLOCK_PARAMS --noadjfile
|
||||
fi
|
|
@ -1,44 +0,0 @@
|
|||
# Template file for 'initscripts'
|
||||
pkgname=initscripts
|
||||
version=2009.03
|
||||
revision=2
|
||||
build_style=custom-install
|
||||
short_desc="xbps base system init scripts"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
long_desc="
|
||||
This package installs the xbps base init scripts, used for booting
|
||||
the system and starting/stopping services.
|
||||
|
||||
The scripts use the BSD style and contain portions from Arch Linux and
|
||||
from NetBSD."
|
||||
|
||||
noarch=yes
|
||||
conf_files="/etc/inittab /etc/rc.conf /etc/rc.local /etc/rc.local.shutdown"
|
||||
keep_dirs="/etc/rc.d /etc/rc.conf.d"
|
||||
|
||||
Add_dependency full glibc
|
||||
Add_dependency full bash
|
||||
Add_dependency full gawk
|
||||
Add_dependency full grep
|
||||
Add_dependency full coreutils
|
||||
Add_dependency full sed
|
||||
Add_dependency full udev
|
||||
Add_dependency full kbd
|
||||
Add_dependency full findutils
|
||||
Add_dependency full net-tools
|
||||
Add_dependency full rcorder
|
||||
Add_dependency full minilogd
|
||||
Add_dependency full dhcpcd
|
||||
|
||||
do_install()
|
||||
{
|
||||
install -d ${DESTDIR}/etc/rc.d
|
||||
install -d ${DESTDIR}/etc/rc.conf.d
|
||||
install -d ${DESTDIR}/etc/defaults
|
||||
|
||||
for f in inittab rc.*; do
|
||||
install -m755 ${FILESDIR}/${f} ${DESTDIR}/etc
|
||||
done
|
||||
install -m644 ${FILESDIR}/defaults/rc.conf ${DESTDIR}/etc/defaults
|
||||
install -m755 ${FILESDIR}/rc.d/* ${DESTDIR}/etc/rc.d
|
||||
}
|
Loading…
Reference in a new issue