Updated initscripts to match Arch Linux upstream

This commit is contained in:
Mike Staszel 2011-05-25 23:45:00 -05:00
parent 3c9459026d
commit 307fdd11e0
16 changed files with 768 additions and 688 deletions

21
core/initscripts/Makefile Normal file
View file

@ -0,0 +1,21 @@
VER := $(shell git describe)
DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin
minilogd: minilogd.o
installdirs:
install -dm755 $(foreach DIR, $(DIRS), $(DESTDIR)$(DIR))
install: minilogd installdirs
install -m644 -t $(DESTDIR)/etc inittab rc.conf
install -m644 -t $(DESTDIR)/etc/rc.d functions
install -m755 -t $(DESTDIR)/etc rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit
install -m755 -t $(DESTDIR)/etc/cron.hourly adjtime
install -m755 -t $(DESTDIR)/etc/rc.d functions hwclock network netfs
install -m755 -t $(DESTDIR)/sbin minilogd rc.d
clean:
rm -f minilogd minilogd.o
release:
git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz

98
core/initscripts/PKGBUILD Executable file → Normal file
View file

@ -1,69 +1,67 @@
# Maintainer: Mike Staszel <mikestaszel@plugboxlinux.org>
# Maintainer: Mike Staszel <mikestaszel@plugapps.com>
# PlugApps changes: inittab has a line for ttyS0 at 115200, 2 ttys
# for armv5te, 6 for armv7
# rc.shutdown has an LED turn-off line
# rc.conf is different
# rc.sysinit has our copyright info
# 2011.03-1: Kevin Mihelich <kevin@plugapps.com>
# - fixed LED turn-off, missing ;
# rc.shutdown has an LED turn-off line
# rc.conf is different
# rc.sysinit has our copyright info
pkgname=initscripts
pkgver=2011.04
pkgver=2011.05.2
pkgrel=1
plugrel=1
pkgdesc="System initialization/bootup scripts"
plugrel=1
arch=('arm' 'armv7')
url="http://www.plugapps.com"
license=('GPL')
url="http://www.archlinuxarm.org"
license=('GPL2')
groups=('base')
backup=(etc/inittab etc/rc.conf etc/rc.local etc/rc.local.shutdown etc/conf.d/wireless)
depends=('glibc' 'bash' 'awk' 'grep' 'coreutils' 'sed' 'udev>=139-1'
depends=('bash' 'grep' 'coreutils' 'udev>=167'
'net-tools' 'ncurses' 'kbd' 'findutils' 'sysvinit')
optdepends=('bridge-utils: Network bridging support'
'dhcpcd: DHCP network configuration'
'wireless_tools: Wireless networking')
install=initscripts.install
source=(adjtime.cron
functions
inittab
inittab.armv7
install.sh
minilogd
minilogd.c
netfs
network
rc.conf
rc.local
rc.local.shutdown
rc.multi
rc.shutdown
rc.single
rc.sysinit
wireless.conf.d)
source=(adjtime
functions
hwclock
inittab
inittab.armv7
Makefile
minilogd.c
netfs
network
rc.conf
rc.d
rc.local
rc.local.shutdown
rc.multi
rc.shutdown
rc.single
rc.sysinit
wireless.conf.d)
md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
'1aad77c872e7d3b3f9f4c3ba79b515c3'
'16fa1f14f10fc8c1daf04f4b5edb9cab'
'ac7be5551669fc867e330440e0151067'
'c6ceb8c7d4820a37b8bf0c827a6916ec'
'366e82ff2faeee4bd72a0b578963235d'
'2c2dcc7ce7586f27fc5e6887f8ec74b8'
'565f1f24c5dc765831a58622f65844af'
'b2469f09d0ae5143b91c182b1d802194'
'0559c8a54a1a2720c53f8974143f246d'
'66f90c041410bcf72b5c2747677d7780'
'bd236a57bc00aa4727b98c5ae401c457'
'669ce6d766dd9deb86686219f3763fe4'
'986ca9250756b12f0cb5f517ccb8bc47'
'bdec56c7d6964875c3b3ecaf3bbe58dd'
'6d77bdeeb65958171881fe15589d8c6a'
'bac8777077243c0cfefa093621370071'
'027576534885b8d5dded9be546057b12')
md5sums=('c03a4a5be5e2579b59e0dcd6a21d310b'
'5a09834b409f579d02b22cd603bc4ea5'
'b32105ebf07f86dc354b85bcf4c8b7b7'
'd73d9303e5aae968b6e1c300f4a4fb0f'
'3fb0b6e945065ba1d283f136d17d612e'
'505290bcaaffe1b3198d0e978a5aeab2'
'2c2dcc7ce7586f27fc5e6887f8ec74b8'
'96fdb70f95844d95a9941ee319601e8d'
'faecfa79b6a19e4f947cb1e1c683f7f2'
'1333ae4ecdbe879b9731a5cd9f165ff6'
'bd236a57bc00aa4727b98c5ae401c457'
'669ce6d766dd9deb86686219f3763fe4'
'3dfa8c33cf3fac7b1721e280225498b9'
'd6daba243a961cbd2ab7a352694138ff'
'230b25d02b0c2f99b9d1053ebcb9694f'
'467a7cfaa0f7c0c94cff7c5900264de8'
'027576534885b8d5dded9be546057b12')
build() {
cd ${srcdir}/
DESTDIR=${pkgdir} ./install.sh
package() {
cd ${srcdir}/${pkgname}-${pkgver}
make DESTDIR=${pkgdir} install
install -D -m644 ${srcdir}/wireless.conf.d ${pkgdir}/etc/conf.d/wireless
# On the armv7 boards, all ttys are enabled in this inittab file

15
core/initscripts/adjtime Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# Update our hwclock for system drift
. /etc/rc.conf
HWCLOCK_PARAMS="--adjust"
case $HARDWARECLOCK in
UTC) HWCLOCK_PARAMS+=" --utc";;
localtime) HWCLOCK_PARAMS+=" --localtime";;
*) HWCLOCK_PARAMS="";;
esac
if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then
/sbin/hwclock $HWCLOCK_PARAMS
fi

View file

@ -1,30 +1,25 @@
#
#!/bin/bash
# initscripts functions
#
# width:
STAT_COL=80
if [ ! -t 1 ]; then
USECOLOR=""
# stty will fail when stdin isn't a terminal
elif [ -t 0 ]; then
STAT_COL="$(/bin/stty size)"
# stty gives "rows cols"; strip the rows number, we just want columns
STAT_COL="${STAT_COL##* }"
else
# is /usr/share/terminfo already mounted, and TERM recognized?
/bin/tput cols &>/dev/null
if [ $? -eq 0 ]; then
STAT_COL=$(/bin/tput cols)
fi
if [[ ! -t 1 ]]; then
USECOLOR=""
elif [[ -t 0 ]]; then
# stty will fail when stdin isn't a terminal
STAT_COL="$(/bin/stty size)"
# stty gives "rows cols"; strip the rows number, we just want columns
STAT_COL="${STAT_COL##* }"
elif /bin/tput cols &>/dev/null; then
# is /usr/share/terminfo already mounted, and TERM recognized?
STAT_COL=$(/bin/tput cols)
fi
if [ "0$STAT_COL" -eq 0 ]; then
# if output was 0 (serial console), set default width to 80
STAT_COL=80
USECOLOR=""
if ((STAT_COL==0)); then
# if output was 0 (serial console), set default width to 80
STAT_COL=80
USECOLOR=""
fi
# we use 13 characters for our own stuff
@ -32,28 +27,32 @@ STAT_COL=$(($STAT_COL - 13))
# disable colors on broken terminals
TERM_COLORS="$(/bin/tput colors 2>/dev/null)"
if [ $? = 3 ]; then
TERM_COLORS=8
elif [ -n "${TERM_COLORS}" ]; then
case "${TERM_COLORS}" in
*[!0-9]*)
USECOLOR=""
;;
*)
[ "${TERM_COLORS}" -lt 8 ] && USECOLOR=""
;;
if (($? != 3)); then
case $TERM_COLORS in
*[!0-9]*) USECOLOR="";;
[0-7]) USECOLOR="";;
'') USECOLOR="";;
esac
else
USECOLOR=""
fi
unset TERM_COLORS
# clear the TZ envvar, so daemons always respect /etc/localtime
unset TZ
# sanitize the locale settins
unset LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
if [[ $DAEMON_LOCALE =~ yes|YES && -n $LOCALE ]]; then
export LANG="${LOCALE}"
else
export LANG=C
fi
# colors:
if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then
C_MAIN="\033[1;37;40m" # main text
C_OTHER="\033[1;34;40m" # prefix & brackets
C_SEPARATOR="\033[1;30;40m" # separator
@ -68,7 +67,7 @@ if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
C_CLEAR="\033[1;0m"
fi
if [ -t 1 ]; then
if [[ -t 1 ]]; then
SAVE_POSITION="\033[s"
RESTORE_POSITION="\033[u"
DEL_TEXT="\033[$(($STAT_COL+4))G"
@ -127,23 +126,19 @@ stat_fail() {
}
stat_die() {
retval=1
[ "$1" = "" ] || retval=$1
stat_fail
exit $retval
exit ${1:-1}
}
status() {
stat_busy "$1"
shift
$* >/dev/null 2>&1
if [ $? -eq 0 ]; then
if "$@" >/dev/null 2>&1; then
stat_done
return 0
else
stat_fail
return 1
fi
stat_fail
return 1
}
# usage : in_array( $needle, $haystack )
@ -151,74 +146,149 @@ status() {
# 1 - not found
# Copied from makepkg
in_array() {
local needle=$1; shift
[ -z "$1" ] && return 1 # Not Found
local item
for item in "$@"; do
local c="${item:0:1}"
if [ "x$c" = "x@" ]; then
item="${item:1}"
fi
[ "$item" = "$needle" ] && return 0 # Found
done
return 1 # Not Found
[[ $2 ]] || return 1
local needle=$1; shift
local item
for item in "$@"; do
[[ ${item#@} = $needle ]] && return 0
done
return 1 # Not Found
}
# daemons:
add_daemon() {
[ -d /var/run/daemons ] || /bin/mkdir -p /var/run/daemons
/bin/touch /var/run/daemons/$1
[[ -d /run/daemons ]] || /bin/mkdir -p /run/daemons
> /run/daemons/"$1"
}
rm_daemon() {
/bin/rm -f /var/run/daemons/$1
/bin/rm -f /run/daemons/"$1"
}
ck_daemon() {
[ -f /var/run/daemons/$1 ] && return 1
[[ ! -f /run/daemons/$1 ]]
}
# Check if $1 is a valid daemon name
have_daemon() {
[[ -f /etc/rc.d/$1 && -x /etc/rc.d/$1 ]]
}
# Check if $1 is started at boot
ck_autostart() {
local d
for d in "${DAEMONS[@]}"; do
[[ "$1" = ${d#@} ]] && return 1
done
return 0
}
ck_depends() {
for daemon in $@; do
if ck_daemon $daemon; then
/etc/rc.d/$daemon start
fi
done
start_daemon() {
have_daemon "$1" && /etc/rc.d/"$1" start
}
start_daemon() {
/etc/rc.d/$1 start
ck_depends() {
for daemon in "$@"; do
ck_daemon "$daemon" && start_daemon "$daemon"
done
}
start_daemon_bkgd() {
stat_bkgd "Starting $1"
(/etc/rc.d/$1 start) &>/dev/null &
have_daemon "$1" && (start_daemon "$1") &>/dev/null &
}
stop_daemon() {
/etc/rc.d/$1 stop
have_daemon "$1" && /etc/rc.d/"$1" stop
}
# Status functions
status_started() {
deltext
echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR "
deltext
echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR "
}
status_stopped() {
deltext
echo -ne "$C_OTHER[${C_STRT}STOPPED$C_OTHER]$C_CLEAR "
deltext
echo -ne "$C_OTHER[${C_STRT}STOPPED$C_OTHER]$C_CLEAR "
}
ck_status() {
ck_daemon $1
if [ $? -eq 1 ]; then
status_started
else
status_stopped
fi
if ! ck_daemon "$1"; then
status_started
else
status_stopped
fi
}
kill_everything() {
# $1 = where we are being called from.
# This is used to determine which hooks to run.
# Find daemons NOT in the DAEMONS array. Shut these down first
for daemon in /run/daemons/*; do
[[ -f $daemon ]] || continue
daemon=${daemon##*/}
in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
done
# Shutdown daemons in reverse order
for ((i=${#DAEMONS[@]}-1; i>=0; i--)); do
[[ ${DAEMONS[$i]:0:1} = '!' ]] && continue
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
done
# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
run_hook "$1_prekillall"
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done
stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done
run_hook "$1_postkillall"
}
activate_vgs() {
[[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]] || return
# Kernel 2.6.x, LVM2 groups
/sbin/modprobe -q dm-mod 2>/dev/null
stat_busy "Activating LVM2 groups"
if /sbin/vgchange --sysinit -a y >/dev/null; then
stat_done
else
stat_fail
fi
}
# Arch cryptsetup packages traditionally contained the binaries
# /usr/sbin/cryptsetup
# /sbin/cryptsetup.static
# By default, initscripts used the /sbin/cryptsetup.static.
# Newer packages will only have /sbin/cryptsetup and no static binary
# This ensures maximal compatibility with the old and new layout
for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
/sbin/cryptsetup.static ''; do
[[ -x $CS ]] && break
done
read_crypttab() {
# $1 = function to call with the split out line from the crypttab
local line nspo failed=0
while read line; do
[[ $line && ${line:0:1} != '#' ]] || continue
eval nspo=("${line%#*}")
if $1 "${nspo[0]}" "${nspo[1]}" "${nspo[2]}" "${nspo[*]:3}"; then
crypto_unlocked=1
else
failed=1
fi
done < /etc/crypttab
return $failed
}
###############################
@ -253,56 +323,55 @@ ck_status() {
# single_postkillall: after all processes have been killed in rc.single
# shutdown_poweroff: directly before powering off in rc.shutdown
#
# Make sure to never override the add_hook and run_hook functions via functions.d
# Declare add_hook and run_hook as read-only to prevent overwriting them.
# Too bad we cannot do the same thing with hook_funcs
declare -A hook_funcs
if [[ $RC_FUNCTIONS_HOOK_FUNCS_DEFINED -ne 1 ]]; then
declare -A hook_funcs
add_hook() {
[ -z "$1" -o -z "$2" ] && return 1
hook_funcs["$1"]="${hook_funcs["$1"]} $2"
}
add_hook() {
[[ $1 && $2 ]] || return 1
hook_funcs["$1"]+=" $2"
}
run_hook() {
local func
run_hook() {
[[ $1 ]] || return 1
local func
for func in ${hook_funcs["$1"]}; do
"${func}"
done
}
[ -z "$1" ] && return 1
for func in ${hook_funcs["$1"]}; do
${func}
done
}
declare -fr add_hook run_hook
declare -r RC_FUNCTIONS_HOOK_FUNCS_DEFINED=1
fi
# Function for setting console font if required
set_consolefont() {
if [ -n "$CONSOLEFONT" ]; then
[[ $CONSOLEFONT ]] || return 0
stat_busy "Loading Console Font: $CONSOLEFONT"
#CONSOLEMAP in UTF-8 shouldn't be used
if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then
CONSOLEMAP=""
fi
[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
for i in /dev/tty[0-9]*; do
if [ -n "$CONSOLEMAP" ]; then
/usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C ${i} >/dev/null 2>&1
else
/usr/bin/setfont $CONSOLEFONT -C ${i} >/dev/null 2>&1
fi
/usr/bin/setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
$CONSOLEFONT -C ${i} >/dev/null 2>&1
done
if [ $? -ne 0 ]; then
if (($? != 0)); then
stat_fail
elif [[ $CONSOLEMAP ]]; then
cat <<"EOF" >>/etc/profile.d/locale.sh
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi
EOF
stat_done
else
if [ -n "$CONSOLEMAP" ]; then
echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi' >>/etc/profile.d/locale.sh
fi
stat_done
fi
fi
}
# Source additional functions at the end to allow overrides
for f in /etc/rc.d/functions.d/*; do
if [ -e $f ]; then
. $f
fi
[[ -e $f ]] && . "$f"
done
# End of file
# vim: set ft=sh sw=2 ts=2 et:
# vim: set ts=2 sw=2 noet:

39
core/initscripts/hwclock Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case $HARDWARECLOCK in
UTC) HWCLOCK_PARAMS="--utc";;
localtime) HWCLOCK_PARAMS="--localtime";;
*) HWCLOCK_PARAMS="";;
esac
case "$1" in
start)
if [[ $HWCLOCK_PARAMS ]]; then
status "Adjusting Hardware Clock" \
/sbin/hwclock --adjust
stat_busy "Setting System Clock"
/sbin/hwclock --hctosys $HWCLOCK_PARAMS || stat_die
stat_done
# Note: This also enables /etc/cron.hourly/adjtime
add_daemon hwclock
fi
;;
stop)
if [[ $HWCLOCK_PARAMS ]]; then
stat_busy "Saving System Clock"
/sbin/hwclock --systohc $HWCLOCK_PARAMS || stat_die
stat_done
fi
rm_daemon hwclock
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac

0
core/initscripts/initscripts.install Executable file → Normal file
View file

View file

@ -32,6 +32,9 @@ c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
#c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
# Serial Virtual Console for KVM and others VMs
#s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux
# Hypervisor Virtual Console for Xen and KVM
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
@ -41,6 +44,6 @@ ca::ctrlaltdel:/sbin/shutdown -t3 -r now
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
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
# End of file

View file

@ -32,6 +32,9 @@ 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
# Serial Virtual Console for KVM and others VMs
#s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux
# Hypervisor Virtual Console for Xen and KVM
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
@ -41,6 +44,6 @@ ca::ctrlaltdel:/sbin/shutdown -t3 -r now
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
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
# End of file

View file

@ -9,11 +9,10 @@ rc=0
case "$1" in
start)
stat_busy "Mounting Network Filesystems"
/bin/mount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs
/bin/mount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
rc=$?
/bin/mount -a -O _netdev
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
if ((rc + $? > 0)); then
stat_fail
else
add_daemon netfs
@ -24,9 +23,8 @@ case "$1" in
stat_busy "Unmounting Network Filesystems"
/bin/umount -a -O _netdev
rc=$?
/bin/umount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
/bin/umount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
if ((rc + $? > 0)); then
stat_fail
else
rm_daemon netfs

View file

@ -3,28 +3,21 @@
. /etc/rc.conf
. /etc/rc.d/functions
# wireless settings
[ -f /etc/conf.d/wireless ] && . /etc/conf.d/wireless
# ethernet bonding settings
[ -f /etc/conf.d/bonding ] && . /etc/conf.d/bonding
# bridge settings
[ -f /etc/conf.d/bridges ] && . /etc/conf.d/bridges
# dhcpcd settings
[ -f /etc/conf.d/dhcpcd ] && . /etc/conf.d/dhcpcd
for s in wireless bonding bridges dhcpcd; do
[[ -f /etc/conf.d/$s ]] && . "/etc/conf.d/$s"
done
ifup()
{
if [ "$1" = "" ]; then
ifup() {
local ifcfg=${!1}
if [[ ! $1 ]]; then
echo "usage: $0 ifup <interface_name>"
return 1
fi
eval ifcfg="\$${1}"
# Get the name of the interface from the first token in the string
if [ "$ifcfg" = "dhcp" ]; then
ifname="$1"
if [[ $ifcfg = dhcp ]]; then
ifname=$1
else
ifname=${ifcfg%% *}
fi
@ -33,7 +26,7 @@ ifup()
wi_up $1 || return 1
if [ "$ifcfg" = "dhcp" ]; then
if [[ $ifcfg = dhcp ]]; then
# remove the .pid file if it exists
/bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
/bin/rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
@ -41,140 +34,130 @@ ifup()
else
/sbin/ifconfig $ifcfg
fi
return $?
}
wi_up()
{
eval iwcfg="\$wlan_${1}"
[ "$iwcfg" = "" ] && return 0
wi_up() {
local iwcfg=wlan_$1
/usr/sbin/iwconfig $iwcfg
[[ -z "$WIRELESS_TIMEOUT" ]] && WIRELESS_TIMEOUT=2
[[ ${!iwcfg} ]] || return 0
/usr/sbin/iwconfig ${!iwcfg}
[[ $WIRELESS_TIMEOUT ]] || WIRELESS_TIMEOUT=2
sleep $WIRELESS_TIMEOUT
bssid=`iwgetid $1 -ra`
if [[ "$bssid" = "00:00:00:00:00:00" ]]; then
bssid=$(iwgetid $1 -ra)
if [[ $bssid = 00:00:00:00:00:00 ]]; then
printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security"
return 1
fi
return 0
}
ifdown()
{
if [ "$1" = "" ]; then
ifdown() {
local ifcfg=${!1}
if [[ ! $1 ]]; then
echo "usage: $0 ifdown <interface_name>"
return 1
fi
eval ifcfg="\$${1}"
if [ "$ifcfg" = "dhcp" ]; then
if [ -f /var/run/dhcpcd-${1}.pid ]; then
/bin/kill $(cat /var/run/dhcpcd-${1}.pid)
fi
if [[ $ifcfg = dhcp && -f /var/run/dhcpcd-${1}.pid ]]; then
/sbin/dhcpcd -k ${1} >/dev/null 2>&1
fi
# Always bring the interface itself down
/sbin/ifconfig ${1} down >/dev/null 2>&1
return $?
}
iflist()
{
iflist() {
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
if [[ $ifline = ${ifline#!} ]]; then
printf " $ifline:\t"
else
printf "$ifline:\t"
fi
eval real_ifline=\$${ifline#!}
echo $real_ifline
echo ${!ifline#!}
done
}
rtup()
{
if [ "$1" = "" ]; then
rtup() {
local routecfg=${!1}
if [[ ! $1 ]]; then
echo "usage: $0 rtup <route_name>"
return 1
fi
eval routecfg="\$${1}"
if grep -q :: <<< $routecfg; then
/sbin/route -A inet6 add $routecfg
if [[ $routecfg =~ :: ]]; then
/sbin/route -A inet6 add $routecfg
else
/sbin/route add $routecfg
/sbin/route add $routecfg
fi
return $?
}
rtdown()
{
if [ "$1" = "" ]; then
rtdown() {
local routecfg=${!1}
if [[ ! $1 ]]; then
echo "usage: $0 rtdown <route_name>"
return 1
fi
eval routecfg="\$${1}"
if grep -q :: <<< $routecfg; then
/sbin/route -A inet6 del $routecfg
if [[ $routecfg =~ :: ]]; then
/sbin/route -A inet6 del $routecfg
else
/sbin/route del $routecfg
/sbin/route del $routecfg
fi
return $?
}
rtlist()
{
rtlist() {
for rtline in ${ROUTES[@]}; do
if [ "$rtline" = "${rtline#!}" ]; then
if [[ $rtline = ${rtline#!} ]]; then
printf " $rtline:\t"
else
printf "$rtline:\t"
fi
eval real_rtline=\$${rtline#!}
echo $real_rtline
echo ${!rtline#!}
done
}
bond_up()
{
bond_up() {
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
if [ -n "${bondcfg}" ]; then
/sbin/ifenslave $ifline $bondcfg || error=1
if [[ $ifline = ${ifline#!} ]]; then
bondcfg="bond_$ifline"
if [[ ${!bondcfg} ]]; then
/sbin/ifenslave $ifline ${!bondcfg} || error=1
fi
fi
done
}
bond_down()
{
bond_down() {
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
/sbin/ifenslave -d $ifline $bondcfg || error=1
if [[ $ifline = ${ifline#!} ]]; then
bondcfg="bond_$ifline"
/sbin/ifenslave -d $ifline ${!bondcfg} || error=1
fi
done
}
bridge_up()
{
bridge_up() {
for br in ${BRIDGE_INTERFACES[@]}; do
if [ "$br" = "${br#!}" ]; then
if [[ $br = ${br#!} ]]; then
# if the bridge already exists, remove it
if [ "$(/sbin/ifconfig $br 2>/dev/null)" ]; then
if [[ $(/sbin/ifconfig $br 2>/dev/null) ]]; then
/sbin/ifconfig $br down
/usr/sbin/brctl delbr $br
fi
/usr/sbin/brctl addbr $br
eval brifs="\$bridge_${br}"
for brif in $brifs; do
if [ "$brif" = "${brif#!}" ]; then
brifs="bridge_$br"
for brif in ${!brifs}; do
if [[ $brif = ${brif#!} ]]; then
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$brif" = "$ifline" ] && [ "$ifline" = "${ifline#!}" ]; then
if [[ $brif = $ifline && $ifline = ${ifline#!} ]]; then
ifup $ifline
eval bondcfg="\$bond_${ifline}"
/sbin/ifenslave $ifline $bondcfg || error=1
unset bond_${ifline}
bondcfg="bond_$ifline"
/sbin/ifenslave $ifline ${!bondcfg} || error=1
unset bond_$ifline
fi
done
@ -185,10 +168,9 @@ bridge_up()
done
}
bridge_down()
{
bridge_down() {
for br in ${BRIDGE_INTERFACES[@]}; do
if [ "$br" = "${br#!}" ]; then
if [[ $br = ${br#!} ]]; then
/usr/sbin/brctl delbr $br
fi
done
@ -208,7 +190,7 @@ case "$1" in
bridge_up
# bring up ethernet interfaces
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
if [[ $ifline = ${ifline#!} ]]; then
ifup $ifline || error=1
fi
done
@ -220,7 +202,7 @@ case "$1" in
rtup $rtline || error=1
fi
done
if [ $error -eq 0 ]; then
if ((error == 0)); then
add_daemon network
stat_done
else
@ -233,7 +215,7 @@ case "$1" in
# exit
#fi
if [ "${NETWORK_PERSIST}" = "yes" -o "${NETWORK_PERSIST}" = "YES" ]; then
if [[ $NETWORK_PERSIST =~ yes|YES && $RUNLEVEL == [06] ]]; then
status "Skipping Network Shutdown" true
exit 0
fi
@ -242,20 +224,20 @@ case "$1" in
rm_daemon network
error=0
for rtline in "${ROUTES[@]}"; do
if [ "$rtline" = "${rtline#!}" ]; then
if [[ $rtline = ${rtline#!} ]]; then
rtdown $rtline || error=1
fi
done
# bring down bond interfaces
bond_down
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
if [[ $ifline = ${ifline#!} ]]; then
ifdown $ifline || error=1
fi
done
# bring down bridge interfaces
bridge_down
if [ $error -eq 0 ]; then
if ((error == 0)); then
stat_done
else
stat_fail
@ -270,8 +252,8 @@ case "$1" in
$1 $2
;;
*)
echo "usage: $0 {start|stop|restart}"
echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}"
echo "usage: $0 {start|stop|restart}"
echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}";;
esac
# vim: set ts=2 noet:
# vim: set ts=2 sw=2 noet:

View file

@ -1,33 +1,53 @@
#
# /etc/rc.conf - Plugbox Linux Main Configuration
# /etc/rc.conf - Main Configuration for Arch Linux ARM
#
# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
# DAEMON_LOCALE: If set to 'yes', use $LOCALE as the locale during daemon
# startup and during the boot process. If set to 'no', the C locale is used.
# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
# in the hardware clock being left untouched (useful for virtualization)
# Note: Using "localtime" is discouraged.
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
# VERBOSE: Verbose level (from 1 to 8). man 3 syslog for level info
#
LOCALE="en_US.UTF-8"
HARDWARECLOCK="localtime"
DAEMON_LOCALE="no"
HARDWARECLOCK="UTC"
TIMEZONE="America/Chicago"
KEYMAP="us"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"
VERBOSE="3"
# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
# MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed
# MOD_BLACKLIST: Prevent udev from loading these modules
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
#
# NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
#
MOD_AUTOLOAD="yes"
#MOD_BLACKLIST=() #deprecated
MODULES=()
# Udev settle timeout (default to 30)
UDEV_TIMEOUT=30
# Scan for FakeRAID (dmraid) Volumes at startup
USEDMRAID="no"
# Scan for BTRFS volumes at startup
USEBTRFS="no"
# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"
@ -37,7 +57,7 @@ USELVM="no"
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="PlugApps"
HOSTNAME="alarm"
# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
@ -61,7 +81,7 @@ INTERFACES=(eth0)
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"
@ -85,4 +105,7 @@ NETWORK_PERSIST="no"
# - prefix a daemon with a ! to disable it
# - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng network netfs crond sshd)
# If something other takes care of your hardware clock (ntpd, dual-boot...)
# you should disable 'hwclock' here.
#
DAEMONS=(hwclock syslog-ng network netfs crond sshd)

61
core/initscripts/rc.d Executable file
View file

@ -0,0 +1,61 @@
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
usage() {
local name=${0##*/}
cat >&2 << EOF
usage: $name action daemon ...
e.g: $name list
$name help
$name start sshd gpm
EOF
exit 1
}
(( $# < 1 )) && usage
declare -i ret=0
case $1 in
help)
usage
;;
list)
cd /etc/rc.d/
for d in *; do
have_daemon "$d" || continue
# print running / stopped satus
if ! ck_daemon "$d"; then
printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
else
printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
fi
# print auto / manual status
if ! ck_autostart "$d"; then
printf "${C_OTHER}[${C_DONE}AUTO${C_OTHER}]"
else
printf "${C_OTHER}[${C_FAIL} ${C_OTHER}]"
fi
printf " ${C_CLEAR}$d\n"
done
;;
*)
action=$1
shift
# set same environment variables as init
runlevel=$(/sbin/runlevel)
ENV="PATH='/bin:/usr/bin:/sbin:/usr/sbin'"
ENV+=" PREVLEVEL='${runlevel:0:1}'"
ENV+=" RUNLEVEL='${runlevel:2:1}'"
ENV+=" CONSOLE='${CONSOLE:-/dev/console}'"
for i; do
[[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action"
(( ret += !! $? )) # clamp exit value to 0/1
done
esac
exit $ret
# vim: set ts=2 sw=2 noet:

View file

@ -9,23 +9,25 @@
run_hook multi_start
# Load sysctl variables if sysctl.conf is present
[ -r /etc/sysctl.conf ] && /sbin/sysctl -q -p &>/dev/null
[[ -r /etc/sysctl.conf ]] && /sbin/sysctl -q -p &>/dev/null
# Start daemons
for daemon in "${DAEMONS[@]}"; do
if [ "$daemon" = "${daemon#!}" ]; then
if [ "$daemon" = "${daemon#@}" ]; then
start_daemon $daemon
else
start_daemon_bkgd ${daemon:1}
fi
fi
case ${daemon:0:1} in
'!') continue;; # Skip this daemon.
'@') start_daemon_bkgd "${daemon#@}";;
*) start_daemon "$daemon";;
esac
done
if [ -x /etc/rc.local ]; then
if [[ -x /etc/rc.local ]]; then
/etc/rc.local
fi
run_hook multi_end
# vim: set ts=2 noet:
/bin/touch /var/log/boot
kill `/bin/cat /run/bootlogd.pid`
/bin/rm /run/bootlogd.pid
# vim: set ts=2 sw=2 noet:

View file

@ -15,156 +15,91 @@ echo " "
printhl "Initiating Shutdown..."
echo " "
# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname
if [ -x /bin/domainname ]; then
/bin/domainname ""
fi
[[ -x /etc/rc.local.shutdown ]] && /etc/rc.local.shutdown
if [ -x /etc/rc.local.shutdown ]; then
/etc/rc.local.shutdown
fi
# Find daemons NOT in the DAEMONS array. Shut these down first
if [ -d /var/run/daemons ]; then
for daemon in $(/bin/ls -1t /var/run/daemons); do
if ! in_array $daemon ${DAEMONS[@]}; then
stop_daemon $daemon
fi
done
fi
# Shutdown daemons in reverse order
let i=${#DAEMONS[@]}-1
while [ $i -ge 0 ]; do
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
fi
let i=i-1
done
# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
run_hook shutdown_prekillall
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done
stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done
run_hook shutdown_postkillall
kill_everything shutdown
stat_busy "Saving Random Seed"
RANDOM_SEED=/var/lib/misc/random-seed
[ -d $(dirname $RANDOM_SEED) ] || mkdir -p $(dirname $RANDOM_SEED)
[[ -d ${RANDOM_SEED%/*} ]] || mkdir -p ${RANDOM_SEED%/*}
: > $RANDOM_SEED
/bin/chmod 0600 $RANDOM_SEED
POOL_FILE=/proc/sys/kernel/random/poolsize
if [ -r $POOL_FILE ]; then
POOL_SIZE=$(/bin/cat $POOL_FILE)
if [[ -r $POOL_FILE ]]; then
read POOL_SIZE <$POOL_FILE
else
POOL_SIZE=512
fi
/bin/dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &> /dev/null
stat_done
stat_busy "Saving System Clock"
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
/bin/rm -f /etc/localtime
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
status "Saving Time Zone" \
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi
HWCLOCK_PARAMS="--systohc"
if [ "$HARDWARECLOCK" = "UTC" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
elif [ "$HARDWARECLOCK" = "localtime" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
else
HWCLOCK_PARAMS=""
fi
if [ -n "$HWCLOCK_PARAMS" ]; then
/sbin/hwclock $HWCLOCK_PARAMS
fi
stat_done
# removing psmouse module to fix some reboot issues on newer laptops
/sbin/modprobe -r psmouse >/dev/null 2>&1
# Write to wtmp file before unmounting
/sbin/halt -w
stat_busy "Deactivating Swap"
/sbin/swapoff -a
stat_done
status "Deactivating Swap" /sbin/swapoff -a
# stop monitoring of lvm2 groups before unmounting filesystems
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
status "Deactivating monitoring of LVM2 groups" \
/sbin/vgchange --monitor n >/dev/null 2>&1
fi
stat_busy "Unmounting Filesystems"
/bin/umount -a -r -t noramfs,notmpfs,nosysfs,noproc,nodevtmpfs -O no_netdev
if /bin/grep -q devtmpfs /proc/filesystems &>/dev/null; then
/bin/umount -a -r -t nosysfs,noproc,nodevtmpfs,nodevpts -O no_netdev
else
# if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
/bin/umount -a -r -t notmpfs,nosysfs,noproc,nodevpts -O no_netdev
fi
stat_done
# Kill non-root encrypted partition mappings
if [ -f /etc/crypttab -a -n "$(/bin/grep -v ^# /etc/crypttab | /bin/grep -v ^$)" ]; then
if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
stat_busy "Deactivating encrypted volumes:"
# Arch cryptsetup packages traditionally contained the binaries
# /usr/sbin/cryptsetup
# /sbin/cryptsetup.static
# By default, initscripts used the /sbin/cryptsetup.static.
# Newer packages will only have /sbin/cryptsetup and no static binary
# This ensures maximal compatibility with the old and new layout
if [ -x /sbin/cryptsetup ]; then
CS=/sbin/cryptsetup
elif [ -x /usr/sbin/cryptsetup ]; then
CS=/usr/sbin/cryptsetup
else
CS=/sbin/cryptsetup.static
# Maybe someone has LVM on an encrypted block device
# executing an extra vgchange is errorless
if [[ $USELVM =~ yes|YES ]]; then
/sbin/vgchange --sysinit -a n >/dev/null 2>&1
fi
do_uncrypt() {
if [ $# -ge 3 ]; then
if [ -b /dev/mapper/$1 ] ;then
stat_append "${1}.."
$CS remove $1 >/dev/null 2>&1
if [ $? -ne 0 ]; then
stat_append "failed "
else
stat_append "ok "
fi
fi
do_lock() {
stat_append "${1}.."
if $CS remove "$1" >/dev/null 2>&1; then
stat_append "ok "
else
stat_append "failed "
fi
}
while read line; do
eval do_uncrypt "$line"
done </etc/crypttab
read_crypttab do_lock
stat_done
fi
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -x /sbin/lvm -a -d /sys/block ]; then
stat_busy "Deactivating LVM2 groups"
/sbin/lvm vgchange --ignorelockingfailure -an >/dev/null 2>&1
stat_done
fi
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
status "Deactivating LVM2 groups" /sbin/vgchange --sysinit -a n >/dev/null 2>&1
fi
stat_busy "Remounting Root Filesystem Read-only"
/bin/mount -n -o remount,ro /
stat_done
status "Remounting Root Filesystem Read-only" /bin/mount -n -o remount,ro /
run_hook shutdown_poweroff
# Turn LEDs off
# PlugApps: Turn LEDs off
/usr/bin/find /sys/ -path *led* -name *trigger* -exec sh -c '/bin/echo none > {}' \;
# Power off or reboot
if [ "$RUNLEVEL" = "0" ]; then
printsep
printsep
if [[ $RUNLEVEL = 0 ]]; then
printhl "${C_H2}POWER OFF"
/sbin/poweroff -d -f -h -i
else
printsep
printhl "${C_H2}REBOOTING"
# if kexec is installed and a kernel is loaded, use it
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1
[[ -x /sbin/kexec ]] && /sbin/kexec -e > /dev/null 2>&1
/sbin/reboot -d -f -i
fi

View file

@ -8,81 +8,49 @@
run_hook single_start
if [ "$PREVLEVEL" != "N" ]; then
# Find daemons NOT in the DAEMONS array. Shut these down first
if [ -d /var/run/daemons ]; then
for daemon in $(/bin/ls -1t /var/run/daemons); do
if ! in_array $daemon ${DAEMONS[@]}; then
stop_daemon $daemon
fi
done
fi
# Shutdown daemons in reverse order
let i=${#DAEMONS[@]}-1
while [ $i -ge 0 ]; do
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
fi
let i=i-1
done
# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
run_hook single_prekillall
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done
stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done
run_hook single_postkillall
stat_busy "Starting UDev Daemon"
/sbin/udevd --daemon
stat_done
if [[ $PREVLEVEL != N ]]; then
kill_everything single
status "Starting UDev Daemon" /sbin/udevd --daemon
run_hook single_udevlaunched
# Trigger udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Triggering UDev uevents"
/sbin/udevadm control --property=STARTUP=1
/sbin/udevadm trigger --action=add
stat_done
stat_busy "Triggering UDev uevents"
/sbin/udevadm trigger --action=add --type=subsystems
/sbin/udevadm trigger --action=add --type=devices
stat_done
fi
# Wait for udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Waiting for UDev uevents to be processed"
/sbin/udevadm settle
/sbin/udevadm control --property=STARTUP=
stat_done
status "Waiting for UDev uevents to be processed" \
/sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
fi
run_hook single_udevsettled
# try syslog-NG first, then fall back to good ol' syslogd
if [ -x /etc/rc.d/syslog-ng ]; then
if [[ -x /etc/rc.d/syslog-ng ]]; then
/etc/rc.d/syslog-ng start
elif [ -x /etc/rc.d/syslogd ]; then
elif [[ -x /etc/rc.d/syslogd ]]; then
/etc/rc.d/syslogd start
[ -x /etc/rc.d/klogd ] && /etc/rc.d/klogd start
[[ -x /etc/rc.d/klogd ]] && /etc/rc.d/klogd start
fi
fi
run_hook single_end
if [ "$RUNLEVEL" = "1" ]; then
if [[ $RUNLEVEL = 1 ]]; then
printsep
printhl "Entering single-user mode..."
# make sure /dev/initctl is in place
/bin/kill -HUP 1
kill -HUP 1
exec /sbin/init -t1 S
fi
/bin/touch /var/log/boot
kill `/bin/cat /run/bootlogd.pid`
/bin/rm /run/bootlogd.pid
# End of file
# vim: set ts=2 noet:
# vim: set ts=2 sw=2 noet:

View file

@ -7,68 +7,67 @@
. /etc/rc.d/functions
echo " "
printhl "PlugApps Linux\n"
printhl "${C_H2}http://www.plugapps.com"
printhl "Copyright 2009-2011 Mike Staszel"
printhl "Distributed under the GNU General Public License (GPL)"
printhl "Arch Linux ARM\n"
printhl "${C_H2}http://www.archlinuxarm.org"
printsep
run_hook sysinit_start
# mount /proc, /sys and our RAM /dev
if ! /bin/mountpoint -q /proc; then
/bin/mount -n -t proc none /proc
fi
if ! /bin/mountpoint -q /sys; then
/bin/mount -n -t sysfs none /sys
fi
if ! /bin/mountpoint -q /dev; then
if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
else
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
fi
fi
# export standard PATH (will be overridden later when /etc/profile is sourced, but is usefull for UDev)
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Copy static device nodes to /dev
/bin/cp -a /lib/udev/devices/* /dev/
# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
/bin/mountpoint -q /sys || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
/bin/mountpoint -q /run || /bin/mount -n -t tmpfs tmpfs /run -o mode=755,size=10M,nosuid,noexec,nodev
if ! /bin/mountpoint -q /dev; then
if /bin/grep -q devtmpfs /proc/filesystems &>/dev/null; then
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
else
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
fi
fi
/bin/mkdir -p /run/lock /dev/{pts,shm}
/bin/chmod 1777 /run/lock
/bin/mountpoint -q /dev/pts || /bin/mount /dev/pts &> /dev/null \
|| /bin/mount -n -t devpts devpts /dev/pts -o mode=620,gid=5,nosuid,noexec
/bin/mountpoint -q /dev/shm || /bin/mount /dev/shm &> /dev/null \
|| /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
# remount root ro to allow for fsck later on, we remount now to
# make sure nothing can open files rw on root which would block a remount
/bin/findmnt / --options ro &>/dev/null || \
status "Mounting Root Read-Only" /bin/mount -n -o remount,ro /
# start up our mini logger until syslog takes over
/sbin/minilogd
/sbin/bootlogd -p /run/bootlogd.pid
# anything more serious than KERN_WARNING goes to the console
# 'verbose' cmdline parameter enables more messages
if /bin/grep -q " verbose" /proc/cmdline; then
/bin/dmesg -n 8
else
/bin/dmesg -n 3
fi
# Set console verbosity
for cmdarg in $(< /proc/cmdline); do
[[ "$cmdarg" == verbose ]] && VERBOSE=8 && break
[[ "$cmdarg" =~ verbose=[1-8] ]] && VERBOSE=${BASH_REMATCH[0]-8} && break
done
/bin/dmesg -n ${VERBOSE:-3}
HWCLOCK_PARAMS="--hctosys"
if [ "$HARDWARECLOCK" = "UTC" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
elif [ "$HARDWARECLOCK" = "localtime" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
else
HWCLOCK_PARAMS=""
fi
case $HARDWARECLOCK in
UTC) HWCLOCK_PARAMS+=" --utc";;
localtime) HWCLOCK_PARAMS+=" --localtime";;
*) HWCLOCK_PARAMS="";;
esac
if [ -n "$HWCLOCK_PARAMS" ]; then
if [[ $HWCLOCK_PARAMS ]]; then
# enable rtc access
/sbin/modprobe -q rtc-cmos
# some custom kernels use rtc/genrtc, try to load those too
/sbin/modprobe -q rtc
/sbin/modprobe -q genrtc
/sbin/modprobe -q -a rtc-cmos rtc genrtc
# If devtmpfs is used, the required RTC device already exists now
# Otherwise, create whatever device is available
if [ ! -c /dev/rtc -a ! -c /dev/rtc0 ]; then
if [ -f /sys/class/rtc/rtc0/dev ]; then
IFS=: read -r major minor < /sys/class/rtc/rtc0/dev
/bin/mknod /dev/rtc0 c $major $minor
elif [ -f /sys/class/misc/rtc/dev ]; then
IFS=: read -r major minor < /sys/class/misc/rtc/dev
if ! [[ -c /dev/rtc || -c /dev/rtc0 ]]; then
for dev in /sys/class/rtc/rtc0/dev /sys/class/misc/rtc/dev; do
[[ -e $dev ]] || continue
IFS=: read -r major minor < "$dev"
/bin/mknod /dev/rtc c $major $minor
fi
done
fi
# Do a clock set here for a few reasons:
@ -78,194 +77,177 @@ if [ -n "$HWCLOCK_PARAMS" ]; then
# configured timezone. Any new timezone put in rc.conf is copied over at
# a later time.
# This does *NOT* take into account a time adjustment file as /var may not be
# mounted yet. A second set occurs later to match rc.conf.
if [ -f /etc/localtime ]; then
# mounted yet. A second set may occur in rc.d/hwclock to match rc.conf.
if [[ -f /etc/localtime ]]; then
/sbin/hwclock $HWCLOCK_PARAMS --noadjfile
fi
fi
echo > /proc/sys/kernel/hotplug
stat_busy "Starting UDev Daemon"
/sbin/udevd --daemon
stat_done
status "Starting UDev Daemon" /sbin/udevd --daemon
run_hook sysinit_udevlaunched
# Trigger udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Triggering UDev uevents"
/sbin/udevadm control --property=STARTUP=1
/sbin/udevadm trigger --action=add
stat_done
if /bin/pidof /sbin/udevd &>/dev/null; then
stat_busy "Triggering UDev uevents"
/sbin/udevadm trigger --action=add --type=subsystems
/sbin/udevadm trigger --action=add --type=devices
stat_done
fi
# Load modules from the MODULES array defined in rc.conf
if ! [ "$load_modules" = "off" ]; then
if [ -f /proc/modules ]; then
stat_busy "Loading Modules"
for mod in "${MODULES[@]}"; do
if [ "$mod" = "${mod#!}" ]; then
/sbin/modprobe $mod
fi
done
stat_done
fi
mods=${MODULES[@]/!*/}
if [[ $load_modules != off && -f /proc/modules && $mods ]]; then
status "Loading Modules" /sbin/modprobe --all $mods
fi
unset mods
# Wait for udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Waiting for UDev uevents to be processed"
/sbin/udevadm settle
/sbin/udevadm control --property=STARTUP=
stat_done
if /bin/pidof /sbin/udevd &>/dev/null; then
status "Waiting for UDev uevents to be processed" \
/sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
fi
run_hook sysinit_udevsettled
# bring up the loopback interface
if [ -d /sys/class/net/lo ]; then
stat_busy "Bringing up loopback interface"
/sbin/ifconfig lo 127.0.0.1 up
if [ $? -ne 0 ]; then
stat_fail
else
stat_done
fi
[[ -d /sys/class/net/lo ]] && \
status "Bringing up loopback interface" /sbin/ifconfig lo 127.0.0.1 up
# FakeRAID devices detection
if [[ $USEDMRAID =~ yes|YES && -x /sbin/dmraid ]]; then
status "Activating FakeRAID arrays" /sbin/dmraid -i -ay
fi
# If necessary, find md devices and manually assemble RAID arrays
if [ -f /etc/mdadm.conf -a "$(/bin/grep ^ARRAY /etc/mdadm.conf 2>/dev/null)" ]; then
status "Activating RAID arrays" /sbin/mdadm --assemble --scan
# BTRFS devices detection
if [[ $USEBTRFS =~ yes|YES && -x /sbin/btrfs ]]; then
status "Activating BTRFS volumes" /sbin/btrfs device scan
fi
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -x /sbin/lvm -a -d /sys/block ]; then
# Kernel 2.6.x, LVM2 groups
/sbin/modprobe -q dm-mod 2>/dev/null
stat_busy "Activating LVM2 groups"
/sbin/lvm vgchange --ignorelockingfailure -a y >/dev/null
if [ $? -ne 0 ]; then
stat_fail
else
stat_done
fi
fi
fi
activate_vgs
# Set up non-root encrypted partition mappings
if [ -f /etc/crypttab -a -n "$(/bin/grep -v ^# /etc/crypttab | /bin/grep -v ^$)" ]; then
/sbin/modprobe -q dm-mod 2>/dev/null
if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
/sbin/modprobe -q dm-crypt 2>/dev/null
stat_busy "Unlocking encrypted volumes:"
csfailed=0
# Arch cryptsetup packages traditionally contained the binaries
# /usr/sbin/cryptsetup
# /sbin/cryptsetup.static
# By default, initscripts used the /sbin/cryptsetup.static.
# Newer packages will only have /sbin/cryptsetup and no static binary
# This ensures maximal compatibility with the old and new layout
if [ -x /sbin/cryptsetup ]; then
CS=/sbin/cryptsetup
elif [ -x /usr/sbin/cryptsetup ]; then
CS=/usr/sbin/cryptsetup
else
CS=/sbin/cryptsetup.static
fi
do_crypt() {
if [ $# -ge 3 ]; then
cname="$1"
csrc="$2"
cpass="$3"
shift 3
copts="$*"
stat_append "${cname}.."
# For some fun reason, the parameter ordering varies for
# LUKS and non-LUKS devices. Joy.
if [ "${cpass}" = "SWAP" ]; then
# This is DANGEROUS! The only possible safety check
# is to not proceed in case we find a LUKS device
# This may cause dataloss if it is not used carefully
if $CS isLuks $csrc 2>/dev/null; then
false
else
$CS -d /dev/urandom $copts create $cname $csrc >/dev/null
if [ $? -eq 0 ]; then
stat_append "creating swapspace.."
/sbin/mkswap -f -L $cname /dev/mapper/$cname >/dev/null
fi
fi
elif [ "${cpass}" = "ASK" ]; then
printf "\nOpening '${cname}' volume:\n"
if $CS isLuks $csrc 2>/dev/null; then
$CS $copts luksOpen $csrc $cname < /dev/console
else
$CS $copts create $cname $csrc < /dev/console
fi
elif [ "${cpass:0:1}" != "/" ]; then
if $CS isLuks $csrc 2>/dev/null; then
echo "$cpass" | $CS $copts luksOpen $csrc $cname >/dev/null
else
echo "$cpass" | $CS $copts create $cname $csrc >/dev/null
fi
else
if $CS isLuks $csrc 2>/dev/null; then
$CS -d $cpass $copts luksOpen $csrc $cname >/dev/null
else
$CS -d $cpass $copts create $cname $csrc >/dev/null
fi
do_unlock() {
# $1 = requested name
# $2 = source device
# $3 = password
# $4 = options
stat_append "${1}.."
local open=create a="$1" b="$2" failed=0
# Ordering of options is different if you are using LUKS vs. not.
# Use ugly swizzling to deal with it.
# isLuks only gives an exit code but no output to stdout or stderr.
if $CS isLuks "$2" 2>/dev/null; then
open=luksOpen
a="$2"
b="$1"
fi
if [ $? -ne 0 ]; then
csfailed=1
case $3 in
SWAP)
local _overwriteokay=0
if [[ -b $2 && -r $2 ]]; then
# This is DANGEROUS! If there is any known file system,
# partition table, RAID or LVM volume on the device
# we don't overwrite it.
#
# 'blkid' returns 2 if no valid signature has been found.
# Only in this case we should allow overwriting the device.
#
# This sanity check _should_ be sufficient, but it might not.
# This may cause dataloss if it is not used carefully.
/sbin/blkid -p "$2" &>/dev/null
if [[ $? -eq 2 ]]; then
_overwriteokay=1
fi
fi
if [[ $_overwriteokay -eq 0 ]]; then
false
elif $CS -d /dev/urandom $4 $open "$a" "$b" >/dev/null; then
stat_append "creating swapspace.."
/sbin/mkswap -f -L $1 /dev/mapper/$1 >/dev/null
fi;;
ASK)
printf "\nOpening '$1' volume:\n"
$CS $4 $open "$a" "$b" < /dev/console;;
/dev*)
ckdev=${3%%:*}
cka=${3#*:}
ckb=${cka#*:}
cka=${cka%:*}
ckfile=/dev/ckfile
ckdir=/dev/ckdir
case ${cka} in
*[!0-9]*)
# Use a file on the device
# cka is not numeric: cka=filesystem, ckb=path
/bin/mkdir ${ckdir}
/bin/mount -r -t ${cka} ${ckdev} ${ckdir}
/bin/dd if=${ckdir}/${ckb} of=${ckfile} >/dev/null 2>&1
/bin/umount ${ckdir}
/bin/rmdir ${ckdir};;
*)
# Read raw data from the block device
# cka is numeric: cka=offset, ckb=length
/bin/dd if=${ckdev} of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
esac
$CS -d ${ckfile} $4 $open "$a" "$b" >/dev/null
/bin/dd if=/dev/urandom of=${ckfile} bs=1 count=`stat -c %s ${ckfile}` conv=notrunc >/dev/null 2>&1
rm ${ckfile};;
/*)
$CS -d "$3" $4 $open "$a" "$b" >/dev/null;;
*)
echo "$3" | $CS $4 $open "$a" "$b" >/dev/null;;
esac
if (($? != 0)); then
failed=1
stat_append "failed "
else
stat_append "ok "
fi
fi
}
while read line; do
eval do_crypt "$line"
done </etc/crypttab
if [ $csfailed -eq 0 ]; then
return $failed
}
crypto_unlocked=0
if read_crypttab do_unlock; then
stat_done
else
stat_fail
fi
# Maybe someone has LVM on an encrypted block device
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -x /sbin/lvm -a -d /sys/block ]; then
/sbin/lvm vgchange --ignorelockingfailure -a y >/dev/null
fi
if [[ ${crypto_unlocked} -eq 1 ]]; then
# Maybe someone has LVM on an encrypted block device
activate_vgs
fi
fi
status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs"
FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"
fsck_reboot() {
echo "Automatic reboot in progress..."
/bin/umount -a
/bin/mount -n -o remount,ro /
/sbin/reboot -f
exit 0
}
if [ -x /sbin/fsck ]; then
if [[ -x /sbin/fsck ]]; then
stat_busy "Checking Filesystems"
fsck_reboot() {
echo "Automatic reboot in progress..."
/bin/umount -a
/bin/mount -n -o remount,ro /
/sbin/reboot -f
exit 0
}
FSCK_OUT=/dev/stdout
FSCK_ERR=/dev/stdout
FSCK_FD=
FORCEFSCK=
[[ -f /forcefsck ]] && FORCEFSCK="-- -f"
for cmdarg in $(< /proc/cmdline); do
[[ "$cmdarg" == forcefsck ]] && FORCEFSCK="-- -f" && break
done
run_hook sysinit_prefsck
/sbin/fsck -A -T -C$FSCK_FD -a -t "$NETFS,noopts=_netdev" $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR
fsckret=$?
if [ ${fsckret} -gt 1 ]; then
if ((fsckret > 1)); then
stat_fail
fi
run_hook sysinit_postfsck
if [ $((${fsckret}&2)) -eq 2 ]; then
if (( ( fsckret & 2) == 2)); then
echo
echo "********************** REBOOT REQUIRED *********************"
echo "* *"
@ -275,8 +257,7 @@ if [ -x /sbin/fsck ]; then
echo
/bin/sleep 15
fsck_reboot
fi
if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then
elif ((fsckret > 1 && fsckret != 32)); then
echo
echo "***************** FILESYSTEM CHECK FAILED ****************"
echo "* *"
@ -294,87 +275,78 @@ if [ -x /sbin/fsck ]; then
stat_done
fi
stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
if [ -x /bin/findmnt -a -e /proc/self/mountinfo ]; then
status "Mounting Local Filesystems" /bin/mount -n -o remount,rw /
# don't touch /etc/mtab if it is a symlink to /proc/self/mounts
if [[ -L /etc/mtab ]]; then
:
elif [[ -x /bin/findmnt && -e /proc/self/mountinfo ]]; then
/bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab
else
cat /proc/mounts >| /etc/mtab
fi
run_hook sysinit_premount
# now mount all the local filesystems
/bin/mount -a -t $NETFS -O no_netdev
stat_done
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
status "Activating monitoring of LVM2 groups" \
/sbin/vgchange --monitor y >/dev/null
fi
status "Activating Swap" /sbin/swapon -a
stat_busy "Configuring System Clock"
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
/bin/rm -f /etc/localtime
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
status "Configuring Time Zone" \
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi
clock_pid=""
if [ -n "$HWCLOCK_PARAMS" ]; then
# This time, we set the clock for real. Use the adjustment file now that
# /var will definitely be available, and then set the system clock once
# the hardware clock has been adjusted accordingly. The backgrounding magic
# is due to the fact that the second call to hwclock will almost always
# take ~1 second because of the clock granularity, and we might as well
# stay busy.
(
/sbin/hwclock --adjust
/sbin/hwclock $HWCLOCK_PARAMS
) &
clock_pid=$!
fi
stat_done
RANDOM_SEED=/var/lib/misc/random-seed
if [ -f $RANDOM_SEED ]; then
stat_busy "Initializing Random Seed"
/bin/cat $RANDOM_SEED > /dev/urandom
stat_done
if [[ -f $RANDOM_SEED ]]; then
status "Initializing Random Seed" \
/bin/cat $RANDOM_SEED > /dev/urandom
fi
stat_busy "Removing Leftover Files"
/bin/rm -f /etc/nologin &>/dev/null
/bin/rm -f /etc/shutdownpid &>/dev/null
/bin/rm -f /var/lock/* &>/dev/null
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
/bin/rm -f /forcefsck &>/dev/null
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )
/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
/bin/mountpoint -q /tmp || /bin/rm -rf /tmp/* /tmp/.* &>/dev/null
[[ ! -L /var/lock ]] && /bin/rm -rf /var/lock/*
[[ ! -L /var/run && -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
[[ ! -L /var/run && ! -L /var/run/daemons ]] && /bin/rm -rf /var/run/daemons \
&& /bin/ln -s /run/daemons /var/run/daemons
: >| /var/run/utmp
/bin/chmod 0664 /var/run/utmp
/bin/chown root:utmp /var/run/utmp
# Keep {x,k,g}dm happy with xorg
/bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix
/bin/mkdir /tmp/.X11-unix && /bin/chmod 1777 /tmp/.X11-unix
/bin/mkdir -m1777 /tmp/.{X11,ICE}-unix
stat_done
#status "Updating Shared Library Links" /sbin/ldconfig
if [ "$HOSTNAME" != "" ]; then
status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME
if [[ $HOSTNAME ]]; then
status "Setting Hostname: $HOSTNAME" /bin/hostname "$HOSTNAME"
fi
# Set the NIS domain name, if necessary
[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname
if [ "$NISDOMAINNAME" != "" ]; then
status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME
[[ -f /etc/conf.d/nisdomainname ]] && . /etc/conf.d/nisdomainname
if [[ $NISDOMAINNAME ]]; then
status "Setting NIS Domain Name: $NISDOMAINNAME" \
/bin/nisdomainname "$NISDOMAINNAME"
fi
status "Updating Module Dependencies" /sbin/depmod -A
stat_busy "Setting Locale: ${LOCALE:=en_US}"
# Flush old locale settings
: >| /etc/profile.d/locale.sh
/bin/chmod 755 /etc/profile.d/locale.sh
# Set user defined locale
[ -z "$LOCALE" ] && LOCALE="en_US"
stat_busy "Setting Locale: $LOCALE"
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
stat_done
if echo "$LOCALE" | /bin/grep -qi utf ; then
if [[ ${LOCALE,,} =~ utf ]]; then
stat_busy "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,
@ -383,10 +355,9 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then
/usr/bin/kbd_mode -u < ${i}
printf "\033%%G" > ${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%G"; fi' >>/etc/profile.d/locale.sh
echo 1 > /sys/module/vt/parameters/default_utf8
stat_done
[ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
else
stat_busy "Setting Consoles to legacy mode"
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
@ -394,34 +365,26 @@ else
/usr/bin/kbd_mode -a < ${i}
printf "\033%%@" > ${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%@"; fi' >>/etc/profile.d/locale.sh
echo 0 > /sys/module/vt/parameters/default_utf8
stat_done
[ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
fi
# Set console font if required
set_consolefont
# Adding persistent network/cdrom generated rules
if [ -f "/dev/.udev/tmp-rules--70-persistent-cd.rules" ]; then
stat_busy "Adding persistent cdrom udev rules"
/bin/cat /dev/.udev/tmp-rules--70-persistent-cd.rules >> /etc/udev/rules.d/70-persistent-cd.rules
stat_done
fi
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then
stat_busy "Adding persistent network udev rules"
/bin/cat /dev/.udev/tmp-rules--70-persistent-net.rules >> /etc/udev/rules.d/70-persistent-net.rules
stat_done
fi
# When the rules are generated before /etc is mounted rw they are saved to /run,
# we therefore need to copy this from /run to /etc. This functionality is going away one day.
for f in cd net; do
[[ -f /run/udev/tmp-rules--70-persistent-$f.rules ]] || continue
stat_busy "Adding persistent $f udev rules"
/bin/cat "/run/udev/tmp-rules--70-persistent-$f.rules" >> "/etc/udev/rules.d/70-persistent-$f.rules"
stat_done
done
/bin/dmesg >| /var/log/dmesg.log
# final hwclock setting needs to be done at this point
if [ -n "$clock_pid" ]; then
wait $clock_pid
fi
run_hook sysinit_end
# End of file