Added initscripts-2009.01 template.
This package contains all files required for booting the lsXL linux system built through xbps. Currently it uses the NetBSD rc.d(8) system, sysvinit and modified BSD style scripts modified from Arch linux. --HG-- extra : convert_revision : 4584be26dd672ba33f9b1d76534a22d4715664ea
This commit is contained in:
parent
d5426651e8
commit
ed07259681
27 changed files with 1671 additions and 0 deletions
10
templates/initscripts/files/rc.d/DAEMON
Executable file
10
templates/initscripts/files/rc.d/DAEMON
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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.
|
10
templates/initscripts/files/rc.d/LOGIN
Executable file
10
templates/initscripts/files/rc.d/LOGIN
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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.
|
9
templates/initscripts/files/rc.d/NETWORKING
Executable file
9
templates/initscripts/files/rc.d/NETWORKING
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/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.
|
10
templates/initscripts/files/rc.d/SERVERS
Executable file
10
templates/initscripts/files/rc.d/SERVERS
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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.
|
66
templates/initscripts/files/rc.d/checkfs
Executable file
66
templates/initscripts/files/rc.d/checkfs
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/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,nofuse,nofuseblk"
|
||||
|
||||
checkfs_start()
|
||||
{
|
||||
echo -n "=> Mounting root read-only... "
|
||||
mount -n -o remount,ro /
|
||||
show_rval
|
||||
|
||||
FORCEFSCK=
|
||||
[ -f /forcefsck ] && FORCEFSCK="-- -f"
|
||||
|
||||
echo -n "=> Checking filesystems... "
|
||||
if grep -qw quiet /proc/cmdline; then
|
||||
fsck -A -T -C -a -t $NETFS $FORCEFSCK >/dev/null 2>&1
|
||||
else
|
||||
fsck -A -T -C -a -t $NETFS $FORCEFSCK 2>/dev/null
|
||||
fi
|
||||
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 in 15 seconds. *"
|
||||
echo "* *"
|
||||
echo "************************************************************"
|
||||
echo
|
||||
sleep 15
|
||||
else
|
||||
echo
|
||||
echo "***************** FILESYSTEM CHECK FAILED ****************"
|
||||
echo "* *"
|
||||
echo "* Please repair manually and reboot. Note that the root *"
|
||||
echo "* file system is currently mounted read-only. To remount *"
|
||||
echo "* it read-write type: mount -n -o remount,rw / *"
|
||||
echo "* When you exit the maintenance shell the system will *"
|
||||
echo "* 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
|
||||
show_rval
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
29
templates/initscripts/files/rc.d/cleartmp
Executable file
29
templates/initscripts/files/rc.d/cleartmp
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/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 -n "=> 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
|
||||
show_rval
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
21
templates/initscripts/files/rc.d/dmesg
Executable file
21
templates/initscripts/files/rc.d/dmesg
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/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"
|
118
templates/initscripts/files/rc.d/locale
Executable file
118
templates/initscripts/files/rc.d/locale
Executable file
|
@ -0,0 +1,118 @@
|
|||
#!/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 ! $(localedef --list-archive|grep -q $LOCALE); then
|
||||
[ ! -d /usr/lib/locale ] && mkdir -p /usr/lib/locale
|
||||
echo -n "=> Building locale: $LOCALE... "
|
||||
localedef -i ${LOCALE%.*} -f UTF-8 ${LOCALE}
|
||||
show_rval
|
||||
fi
|
||||
|
||||
# Set user defined locale
|
||||
[ -z "$LOCALE" ] && LOCALE="en_US"
|
||||
echo -n "=> Setting locale: $LOCALE... "
|
||||
echo "export LANG=$LOCALE" >> /etc/profile.d/locale.sh
|
||||
show_rval
|
||||
|
||||
if echo "$LOCALE" | grep -qi utf ; then
|
||||
echo -n "=> Setting consoles to UTF-8 mode... "
|
||||
# UTF-8 consoles are default since 2.6.24 kernel
|
||||
# this code is needed not only for older kernels,
|
||||
# but also when user has set vt.default_utf8=0 but LOCALE
|
||||
# is *.UTF-8.
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
kbd_mode -u < /dev/tty${i}
|
||||
printf "\e%%G" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running scripts
|
||||
# from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e%%G"
|
||||
fi
|
||||
_EOF
|
||||
show_rval
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo -n "=> Loading keyboard map: $KEYMAP... "
|
||||
loadkeys -q -u $KEYMAP
|
||||
show_rval
|
||||
fi
|
||||
else
|
||||
echo -n "=> Setting consoles to legacy mode... "
|
||||
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
kbd_mode -a < /dev/tty${i}
|
||||
printf "\e%%@" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running scripts
|
||||
# from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ -z "$CONSOLE" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e%%@"
|
||||
fi
|
||||
_EOF
|
||||
show_rval
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo -n "=> Loading keyboard map: $KEYMAP... "
|
||||
loadkeys -q $KEYMAP
|
||||
show_rval
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$CONSOLEFONT" ]; then
|
||||
echo -n "=> 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
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed!"
|
||||
else
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
printf "\e(K" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running
|
||||
# scripts from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e(K"
|
||||
fi
|
||||
_EOF
|
||||
echo "done."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
33
templates/initscripts/files/rc.d/mountfs
Executable file
33
templates/initscripts/files/rc.d/mountfs
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/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,noshfs,nofuse,nofuseblk"
|
||||
|
||||
mountfs_start()
|
||||
{
|
||||
echo -n "=> 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
|
||||
echo "done."
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
23
templates/initscripts/files/rc.d/net_loopback
Executable file
23
templates/initscripts/files/rc.d/net_loopback
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: net_loopback
|
||||
# REQUIRE: SERVERS
|
||||
# BEFORE: checkfs
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="net_loopback"
|
||||
start_cmd="loopback_start"
|
||||
stop_cmd=":"
|
||||
|
||||
loopback_start()
|
||||
{
|
||||
if [ -d /sys/class/net/lo ]; then
|
||||
echo -n "=> Bringing up loopback interface... "
|
||||
ifconfig lo 127.0.0.1 up
|
||||
show_rval
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
31
templates/initscripts/files/rc.d/persistent_rules
Executable file
31
templates/initscripts/files/rc.d/persistent_rules
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/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 -n "=> Adding persistent cdrom udev rules... "
|
||||
cat /dev/.udev/tmp-rules--70-persistent-cd.rules \
|
||||
>> /etc/udev/rules.d/70-persistent-cd.rules
|
||||
show_rval
|
||||
fi
|
||||
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then
|
||||
echo -n "=> Adding persistent network udev rules... "
|
||||
cat /dev/.udev/tmp-rules--70-persistent-net.rules \
|
||||
>> /etc/udev/rules.d/70-persistent-net.rules
|
||||
show_rval
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
22
templates/initscripts/files/rc.d/random_seed
Executable file
22
templates/initscripts/files/rc.d/random_seed
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/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 -n "=> Initializing random seed... "
|
||||
cat /var/run/random-seed >/dev/urandom
|
||||
show_rval
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
20
templates/initscripts/files/rc.d/swap
Executable file
20
templates/initscripts/files/rc.d/swap
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: swap
|
||||
# REQUIRE: SERVERS mountfs
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="swap"
|
||||
start_cmd="swap_start"
|
||||
stop_cmd=":"
|
||||
|
||||
swap_start()
|
||||
{
|
||||
echo -n "=> Activating swap... "
|
||||
swapon -a
|
||||
show_rval
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
29
templates/initscripts/files/rc.d/sysclock
Executable file
29
templates/initscripts/files/rc.d/sysclock
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: sysclock
|
||||
# REQUIRE: SERVERS swap
|
||||
|
||||
$_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="sysclock"
|
||||
start_cmd="sysclock_start"
|
||||
stop_cmd=":"
|
||||
|
||||
sysclock_start()
|
||||
{
|
||||
echo -n "=> 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
|
||||
show_rval
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
21
templates/initscripts/files/rc.d/udev_events
Executable file
21
templates/initscripts/files/rc.d/udev_events
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/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 -n "=> Waiting for udev uevents... "
|
||||
udevadm trigger
|
||||
udevadm settle
|
||||
echo "done."
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
24
templates/initscripts/files/rc.d/udevd
Executable file
24
templates/initscripts/files/rc.d/udevd
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/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"
|
Loading…
Add table
Add a link
Reference in a new issue