From d1ea3020712322f16030d3f7251fad924804c4e9 Mon Sep 17 00:00:00 2001 From: Mike Staszel Date: Sun, 4 Apr 2010 20:16:29 -0500 Subject: [PATCH] Removed pogo-connector, /core/initscripts updated to 2010.1 --- README | 14 +-- core/initscripts/PKGBUILD | 73 +++++++-------- core/initscripts/adjtime.cron | 0 core/initscripts/functions | 74 ++++++--------- core/initscripts/initscripts.install | 0 core/initscripts/inittab | 17 ++-- core/initscripts/netfs | 0 core/initscripts/network | 13 ++- core/initscripts/rc.conf | 8 +- core/initscripts/rc.local | 0 core/initscripts/rc.local.shutdown | 0 core/initscripts/rc.multi | 4 + core/initscripts/rc.shutdown | 53 ++++++----- core/initscripts/rc.single | 44 ++++++--- core/initscripts/rc.sysinit | 131 +++++++++++++-------------- 15 files changed, 224 insertions(+), 207 deletions(-) mode change 100644 => 100755 core/initscripts/PKGBUILD mode change 100644 => 100755 core/initscripts/adjtime.cron mode change 100644 => 100755 core/initscripts/initscripts.install mode change 100644 => 100755 core/initscripts/netfs mode change 100644 => 100755 core/initscripts/network mode change 100644 => 100755 core/initscripts/rc.local mode change 100644 => 100755 core/initscripts/rc.local.shutdown mode change 100644 => 100755 core/initscripts/rc.multi mode change 100644 => 100755 core/initscripts/rc.shutdown mode change 100644 => 100755 core/initscripts/rc.single mode change 100644 => 100755 core/initscripts/rc.sysinit diff --git a/README b/README index a31a9b21c..ef3995aa4 100644 --- a/README +++ b/README @@ -5,15 +5,5 @@ Marvell Sheevaplug platform (ARM-based). The packages are meant to be built on PlugBox Linux, found at http://plugapps.com/ -============================================================= - -This repository also hosts tools necessary to run the -my.pogoplug.com (XCE) and other files. This is not piracy -for 2 reasons: - -1. XCE and TUN are GPL-licensed. - -2. You cannot run the XCE module on regular u-Boot on other devices, -and need a unique, verified ID and serial number written in the -bootloader. Also, MAC addresses are checked by my.pogoplug.com to -match the Cloud Engines family of plugs. +Also included is the Pogoplug/Dockstar "Advanced" u-Boot +bootloader with USB drive support. diff --git a/core/initscripts/PKGBUILD b/core/initscripts/PKGBUILD old mode 100644 new mode 100755 index 05e8be2ce..9336f8987 --- a/core/initscripts/PKGBUILD +++ b/core/initscripts/PKGBUILD @@ -1,50 +1,51 @@ -# Maintainer: Mike Staszel +# Maintainer: Mike Staszel pkgname=initscripts -pkgver=2009.12 +pkgver=2010.01 pkgrel=1 pkgdesc="System initialization/bootup scripts" -arch=('arm') -url="http://www.archlinux.org" +arch=(arm) +url="http://www.plugboxlinux.org" license=('GPL') -groups=('base' 'small-base') +groups=('base') backup=(etc/inittab etc/rc.conf etc/rc.local etc/rc.local.shutdown) -depends=('glibc' 'bash' 'grep' 'coreutils' 'udev>=139-1' 'sysvinit' 'net-tools') +depends=('glibc' 'bash' 'awk' 'grep' 'coreutils' 'sed' 'udev>=139-1' + 'net-tools' 'ncurses' 'kbd' 'findutils' 'sysvinit') optdepends=('bridge-utils: Network bridging support' 'dhcpcd: DHCP network configuration' 'wireless_tools: Wireless networking') -source=('adjtime.cron' - 'inittab' - 'minilogd.c' - 'network' - 'rc.local' - 'rc.multi' - 'rc.single' - 'functions' - 'install.sh' - 'netfs' - 'rc.conf' - 'rc.local.shutdown' - 'rc.shutdown' - 'rc.sysinit') +install=initscripts.install +source=(adjtime.cron + functions + inittab + install.sh + minilogd.c + netfs + network + rc.conf + rc.local + rc.local.shutdown + rc.multi + rc.shutdown + rc.single + rc.sysinit) md5sums=('c03a4a5be5e2579b59e0dcd6a21d310b' - 'b5872d7ed0f129ebd883b9d26033d4fe' - 'ae343387b55279b8aa872c54b2ac0e50' - 'e3637ea43f2dbabba7b1b44f94b0277d' - 'bd236a57bc00aa4727b98c5ae401c457' - 'b53d6b27bd460edf577f83bb2c968b93' - '827c100136a6a1441c83d9877e36747b' - '6f17f71f8e7f1e06a571669a58534b13' - '3fb0b6e945065ba1d283f136d17d612e' - '96fdb70f95844d95a9941ee319601e8d' - 'bc6439c7165f2cee3b57a9a2dffc40b9' - '669ce6d766dd9deb86686219f3763fe4' - 'd907663acca54bb7d01ca1d8cf21d191' - 'bd2e5ac2054854a8bd88df01d1be39af') + 'd68d3c1a9abe773439fa5fa0000ab6c9' + '5bd94c5ea67521b6b3e94b45ddec808a' + '3fb0b6e945065ba1d283f136d17d612e' + 'ae343387b55279b8aa872c54b2ac0e50' + '96fdb70f95844d95a9941ee319601e8d' + 'fe1a494a0b6f269ce1bcafae85a60a7b' + 'dccf83de27c0884b021219e19291731c' + 'bd236a57bc00aa4727b98c5ae401c457' + '669ce6d766dd9deb86686219f3763fe4' + '8c94c7faaa17f0f4971cff19da047e44' + 'e3eb057da4d46477d1e03925c1c12c03' + '2c4ef098e6ee45cb86272cb3cb28bb47' + '7fb7e4402911a31555041228d03772e0') build() { - cd ${startdir}/src/ - chmod u+x install.sh - DESTDIR=$startdir/pkg ./install.sh + cd ${srcdir}/ + DESTDIR=${pkgdir} ./install.sh } diff --git a/core/initscripts/adjtime.cron b/core/initscripts/adjtime.cron old mode 100644 new mode 100755 diff --git a/core/initscripts/functions b/core/initscripts/functions index 3b291a596..5f2563254 100644 --- a/core/initscripts/functions +++ b/core/initscripts/functions @@ -2,43 +2,27 @@ # initscripts functions # -# width: - STAT_COL=80 -if [ -t 1 ]; then - # stty will fail when stdin isn't a terminal (but we're in this block, so stdout is) - if [ -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 - # tput will fail at boot time if /usr/share/terminfo isn't yet mounted - # or TERM is otherwise unrecognized - STAT_COL="$(/bin/tput cols 2>/dev/null)" - fi - if [ "0$STAT_COL" -eq 0 ]; then - # if output was 0 (serial console), set default width to 80 - USECOLOR="" - STAT_COL=80 - fi -else +if [ ! -t 1 ]; then USECOLOR="" + +elif [ -t 0 ]; then + STAT_COL="$(/bin/stty size)" + STAT_COL="${STAT_COL##* }" + +else + /bin/tput cols &>/dev/null + if [ $? -eq 0 ]; then + STAT_COL=$(/bin/tput cols) + fi +fi +if [ "0$STAT_COL" -eq 0 ]; then STAT_COL=80 + USECOLOR="" fi -if [ -t 1 ]; then - STAT_COL=$(/bin/stty size) - # strip the rows number, we just want columns - STAT_COL=${STAT_COL##* } - if [ "$STAT_COL" = "0" ]; then - # if output was 0 (serial console), set default width to 80 - STAT_COL=80 - fi -fi -# we use 13 characters for our own stuff STAT_COL=$(($STAT_COL - 13)) -# disable colors on broken terminals TERM_COLORS="$(/bin/tput colors 2>/dev/null)" if [ $? = 3 ]; then TERM_COLORS=8 @@ -56,10 +40,8 @@ else fi unset TERM_COLORS -# clear the TZ envvar, so daemons always respect /etc/localtime unset TZ -# colors: if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then C_MAIN="\033[1;37;40m" # main text C_OTHER="\033[1;34;40m" # prefix & brackets @@ -86,13 +68,9 @@ else DEL_TEXT="" fi -# prefixes: - PREFIX_REG="::" PREFIX_HL=" >" -# functions: - deltext() { printf "${DEL_TEXT}" } @@ -154,10 +132,6 @@ status() { fi } -# usage : in_array( $needle, $haystack ) -# return : 0 - found -# 1 - not found -# Copied from makepkg in_array() { local needle=$1; shift [ -z "$1" ] && return 1 # Not Found @@ -172,8 +146,6 @@ in_array() { return 1 # Not Found } -# daemons: - add_daemon() { [ -d /var/run/daemons ] || /bin/mkdir -p /var/run/daemons /bin/touch /var/run/daemons/$1 @@ -209,7 +181,6 @@ stop_daemon() { /etc/rc.d/$1 stop } -# Status functions status_started() { deltext echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR " @@ -229,8 +200,22 @@ ck_status() { fi } +declare -A hook_funcs + +add_hook() { + [ -z "$1" -o -z "$2" ] && return 1 + hook_funcs["$1"]="${hook_funcs["$1"]} $2" +} + +run_hook() { + local func + + [ -z "$1" ] && return 1 + for func in ${hook_funcs["$1"]}; do + ${func} + done +} -#Source additional functions at the end to allow overrides for f in /etc/rc.d/functions.d/*; do if [ -e $f ]; then . $f @@ -238,4 +223,3 @@ for f in /etc/rc.d/functions.d/*; do done # End of file - diff --git a/core/initscripts/initscripts.install b/core/initscripts/initscripts.install old mode 100644 new mode 100755 diff --git a/core/initscripts/inittab b/core/initscripts/inittab index e783cfa7f..3540e2b1d 100644 --- a/core/initscripts/inittab +++ b/core/initscripts/inittab @@ -24,13 +24,16 @@ rh:06:wait:/etc/rc.shutdown su:S:wait:/sbin/sulogin -p # -8 options fixes umlauts problem on login -s0:12345:respawn:/sbin/agetty -8 115200 ttyS0 vt100 -#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 +s0:12345:respawn:/sbin/agetty -8 115200 ttyS0 linux +# 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 + +# Hypervisor Virtual Console for Xen and KVM +#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux ca::ctrlaltdel:/sbin/shutdown -t3 -r now diff --git a/core/initscripts/netfs b/core/initscripts/netfs old mode 100644 new mode 100755 diff --git a/core/initscripts/network b/core/initscripts/network old mode 100644 new mode 100755 index 35982b99b..d23b3a931 --- a/core/initscripts/network +++ b/core/initscripts/network @@ -19,11 +19,20 @@ ifup() return 1 fi - /sbin/ifconfig $1 up + eval ifcfg="\$${1}" + + # Get the name of the interface from the first token in the string + + if [ "$ifcfg" = "dhcp" ]; then + ifname="$1" + else + ifname=${ifcfg%% *} + fi + + /sbin/ifconfig $ifname up wi_up $1 || return 1 - eval ifcfg="\$${1}" if [ "$ifcfg" = "dhcp" ]; then # remove the .pid file if it exists /bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1 diff --git a/core/initscripts/rc.conf b/core/initscripts/rc.conf index 121a6bec4..d05bfb9fe 100644 --- a/core/initscripts/rc.conf +++ b/core/initscripts/rc.conf @@ -33,7 +33,7 @@ USELVM="no" # # HOSTNAME: Hostname of machine. Should also be put in /etc/hosts # -HOSTNAME="plugbox" +HOSTNAME="Plugbox" # Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces. # @@ -46,6 +46,8 @@ HOSTNAME="plugbox" # Wireless: See network profiles below # +#Static IP example +#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" eth0="dhcp" INTERFACES=(eth0) @@ -54,7 +56,7 @@ INTERFACES=(eth0) # - prefix an entry in ROUTES with a ! to disable it # gateway="default gw 192.168.0.1" -ROUTES=(gateway) +ROUTES=(!gateway) # Enable these network profiles at boot-up. These are only useful # if you happen to need multiple network configurations (ie, laptop users) @@ -75,4 +77,4 @@ ROUTES=(gateway) # - prefix a daemon with a ! to disable it # - prefix a daemon with a @ to start it up in the background # -DAEMONS=(network sshd) +DAEMONS=(syslog-ng network netfs crond sshd) diff --git a/core/initscripts/rc.local b/core/initscripts/rc.local old mode 100644 new mode 100755 diff --git a/core/initscripts/rc.local.shutdown b/core/initscripts/rc.local.shutdown old mode 100644 new mode 100755 diff --git a/core/initscripts/rc.multi b/core/initscripts/rc.multi old mode 100644 new mode 100755 index 43177c4e7..8e7fdb5c7 --- a/core/initscripts/rc.multi +++ b/core/initscripts/rc.multi @@ -6,6 +6,8 @@ . /etc/rc.conf . /etc/rc.d/functions +run_hook multi_start + # Load sysctl variables if sysctl.conf is present [ -r /etc/sysctl.conf ] && /sbin/sysctl -q -p &>/dev/null @@ -24,4 +26,6 @@ if [ -x /etc/rc.local ]; then /etc/rc.local fi +run_hook multi_end + # End of file diff --git a/core/initscripts/rc.shutdown b/core/initscripts/rc.shutdown old mode 100644 new mode 100755 index d5c5b2427..736b5208a --- a/core/initscripts/rc.shutdown +++ b/core/initscripts/rc.shutdown @@ -6,6 +6,8 @@ . /etc/rc.conf . /etc/rc.d/functions +run_hook shutdown_start + # avoid staircase effect /bin/stty onlcr @@ -22,36 +24,37 @@ if [ -x /etc/rc.local.shutdown ]; then /etc/rc.local.shutdown fi -if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; 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]#@} +# 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 - let i=i-1 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 "Terminating Processes" +stat_busy "Sending SIGTERM To Processes" +run_hook shutdown_prekillall /sbin/killall5 -15 &> /dev/null /bin/sleep 5 stat_done -stat_busy "Killing Processes" +stat_busy "Sending SIGKILL To Processes" /sbin/killall5 -9 &> /dev/null /bin/sleep 1 stat_done +run_hook shutdown_postkillall + stat_busy "Saving Random Seed" RANDOM_SEED=/var/lib/misc/random-seed [ -d $(dirname $RANDOM_SEED) ] || mkdir -p $(dirname $RANDOM_SEED) @@ -105,12 +108,14 @@ if [ -f /etc/crypttab -a -n "$(/bin/grep -v ^# /etc/crypttab | /bin/grep -v ^$)" CS=/sbin/cryptsetup.static do_uncrypt() { if [ $# -ge 3 ]; then - stat_append "${1}.." - $CS remove $1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - stat_append "failed " - else - stat_append "ok " + 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 fi } @@ -132,6 +137,8 @@ stat_busy "Remounting Root Filesystem Read-only" /bin/mount -n -o remount,ro / stat_done +run_hook shutdown_poweroff + # Power off or reboot if [ "$RUNLEVEL" = "0" ]; then printsep diff --git a/core/initscripts/rc.single b/core/initscripts/rc.single old mode 100644 new mode 100755 index 52c3e0c5c..5aea51e4a --- a/core/initscripts/rc.single +++ b/core/initscripts/rc.single @@ -6,6 +6,8 @@ . /etc/rc.conf . /etc/rc.d/functions +run_hook single_start + if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then # Find daemons NOT in the DAEMONS array. Shut these down first if [ -d /var/run/daemons ]; then @@ -26,29 +28,45 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then fi if [ "$PREVLEVEL" != "N" ]; then + run_hook single_prekillall + + # Terminate all processes stat_busy "Sending SIGTERM To Processes" /sbin/killall5 -15 &> /dev/null /bin/sleep 5 stat_done stat_busy "Sending SIGKILL To Processes" - /sbin/killall5 -9 + /sbin/killall5 -9 &> /dev/null /bin/sleep 1 stat_done - if [ -x /sbin/udevadm ]; then - stat_busy "Starting UDev Daemon" - /sbin/udevd --daemon - stat_done - stat_busy "Loading UDev uevents" - /sbin/udevadm trigger - /sbin/udevadm settle - stat_done - else - # Static /dev, our last resort - status "Using static /dev filesystem" /bin/true + run_hook single_postkillall + + stat_busy "Starting UDev Daemon" + /sbin/udevd --daemon + stat_done + + 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 + 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 + fi + + run_hook single_udevsettled + # try syslog-NG first, then fall back to good ol' syslogd if [ -x /etc/rc.d/syslog-ng ]; then /etc/rc.d/syslog-ng start @@ -58,6 +76,8 @@ if [ "$PREVLEVEL" != "N" ]; then fi fi +run_hook single_end + if [ "$RUNLEVEL" = "1" ]; then printsep printhl "Entering single-user mode..." diff --git a/core/initscripts/rc.sysinit b/core/initscripts/rc.sysinit old mode 100644 new mode 100755 index 8aa8fd28f..cea58e41a --- a/core/initscripts/rc.sysinit +++ b/core/initscripts/rc.sysinit @@ -12,8 +12,10 @@ printhl "${C_H2}http://www.plugapps.com" printhl "Copyright 2009-2010 Mike Staszel" printsep +run_hook sysinit_start + # mount /proc, /sys and our RAM /dev -/bin/mount -n -t tmpfs none /dev -o mode=0755 +/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid /bin/mount -n -t proc none /proc /bin/mount -n -t sysfs none /sys @@ -31,15 +33,6 @@ else /bin/dmesg -n 3 fi -# enable rtc access -/sbin/modprobe rtc-cmos >/dev/null 2>&1 -RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null) -RTC_MAJOR="${RTC_MAJOR%% *}" -if [ -n "$RTC_MAJOR" ]; then - /bin/mknod /dev/rtc0 c $RTC_MAJOR 0 - /bin/ln -s /dev/rtc0 /dev/rtc -fi - HWCLOCK_PARAMS="--hctosys" if [ "$HARDWARECLOCK" = "UTC" ]; then HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc" @@ -49,26 +42,41 @@ else HWCLOCK_PARAMS="" fi -# Set clock early to fix some bugs with filesystem checks -# Clock is set again later to match rc.conf -if [ -n "$HWCLOCK_PARAMS" -a -f /etc/localtime ]; then - /sbin/hwclock $HWCLOCK_PARAMS --noadjfile +if [ -n "$HWCLOCK_PARAMS" ]; then + # enable rtc access + /sbin/modprobe rtc-cmos >/dev/null 2>&1 + RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null) + RTC_MAJOR="${RTC_MAJOR%% *}" + if [ -n "$RTC_MAJOR" ]; then + /bin/mknod /dev/rtc0 c $RTC_MAJOR 0 + /bin/ln -s /dev/rtc0 /dev/rtc + fi + + # Do a clock set here for a few reasons: + # 1. Make creation time on udev nodes sane (FS#8665) + # 2. Filesystem checks can depend on system time + # 3. This will set the clock, if using non-UTC, off the last known + # 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 + /sbin/hwclock $HWCLOCK_PARAMS --noadjfile + fi fi echo > /proc/sys/kernel/hotplug -if [ -x /sbin/udevadm ]; then - stat_busy "Starting UDev" - /sbin/udevd --daemon - stat_done -else - # Static /dev, our last resort - status "Using static /dev filesystem" true -fi +stat_busy "Starting UDev Daemon" +/sbin/udevd --daemon +stat_done + +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 stat_done fi @@ -84,36 +92,18 @@ if ! [ "$load_modules" = "off" ]; then done stat_done fi - if [ -d /proc/acpi ]; then - stat_busy "Loading standard ACPI modules" - ACPI_MODULES="ac battery button fan processor thermal" - k="$(echo $BLACKLIST ${MOD_BLACKLIST[@]} | /bin/sed 's|-|_|g')" - j="$(echo ${MODULES[@]} | /bin/sed 's|-|_|g')" - #add disabled MODULES (!) to blacklist - much requested feature - for m in ${j}; do - [ "$m" != "${m#!}" ] && k="${k} ${m#!}" - done - # add disablemodules= from commandline to blacklist - k="${k} $(echo ${disablemodules} | /bin/sed 's|-|_|g' | /bin/sed 's|,| |g')" - for n in ${ACPI_MODULES}; do - if ! echo ${k} | /bin/grep "\<$n\>" 2>&1 >/dev/null; then - /sbin/modprobe $n > /dev/null 2>&1 - fi - done - stat_done - fi fi # Wait for udev uevents if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then stat_busy "Waiting for UDev uevents to be processed" - udevstart="$(/bin/date +%s%0N)" /sbin/udevadm settle + /sbin/udevadm control --property=STARTUP= stat_done - udevend="$(/bin/date +%s%0N)" - printhl " UDev uevent processing time: $((($udevend-$udevstart)/1000000))ms" fi +run_hook sysinit_udevsettled + # bring up the loopback interface if [ -d /sys/class/net/lo ]; then stat_busy "Bringing up loopback interface" @@ -127,13 +117,6 @@ 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 - # udev won't create these md nodes, so we do it ourselves - for dev in $(/bin/grep ^ARRAY /etc/mdadm.conf | /bin/awk '{print $2}'); do - path=$(echo $dev | /bin/sed 's|/[^/]*$||') - node=$(echo $dev | /bin/sed "s|^$path/||") - minor=$(echo $node | /bin/sed 's|^[^0-9]*||') - [ ! -e $path/$node ] && /bin/mknod $path/$node b 9 $minor - done status "Activating RAID arrays" /sbin/mdadm --assemble --scan fi @@ -142,7 +125,6 @@ if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then # Kernel 2.6.x, LVM2 groups /sbin/modprobe -q dm-mod 2>/dev/null stat_busy "Activating LVM2 groups" - /sbin/lvm vgscan --ignorelockingfailure --mknodes >/dev/null /sbin/lvm vgchange --ignorelockingfailure -a y >/dev/null if [ $? -ne 0 ]; then stat_fail @@ -221,7 +203,6 @@ if [ -f /etc/crypttab -a -n "$(/bin/grep -v ^# /etc/crypttab | /bin/grep -v ^$)" # 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 vgscan --ignorelockingfailure --mknodes >/dev/null /sbin/lvm vgchange --ignorelockingfailure -a y >/dev/null fi fi @@ -254,11 +235,11 @@ if [ -x /sbin/fsck ]; then echo echo "********************** REBOOT REQUIRED *********************" echo "* *" - echo "* The system will be rebooted automatically in 10 seconds. *" + echo "* The system will be rebooted automatically in 15 seconds. *" echo "* *" echo "************************************************************" echo - /bin/sleep 10 + /bin/sleep 15 fsck_reboot fi if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then @@ -281,13 +262,14 @@ fi stat_busy "Mounting Local Filesystems" /bin/mount -n -o remount,rw / -/bin/rm -f /etc/mtab* +: >| /etc/mtab # make sure / gets written to /etc/mtab /bin/mount -o remount,rw / # Write /proc, /sys and /dev to /etc/mtab if [ -e /proc/mounts ]; then /bin/grep -e "/proc " -e "/sys " -e "/dev " /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 @@ -295,17 +277,24 @@ stat_done status "Activating Swap" /sbin/swapon -a stat_busy "Configuring System Clock" -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 /bin/rm -f /etc/localtime /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime fi +clock_pid="" if [ -n "$HWCLOCK_PARAMS" ]; then - /sbin/hwclock --adjust #Adjust for system drift + # 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 @@ -323,7 +312,7 @@ stat_busy "Removing Leftover Files" /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 -- {} \; ) -: > /var/run/utmp +: >| /var/run/utmp /bin/chmod 0664 /var/run/utmp # Keep {x,k,g}dm happy with xorg /bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix @@ -345,7 +334,7 @@ fi status "Updating Module Dependencies" /sbin/depmod -A # Flush old locale settings -: >/etc/profile.d/locale.sh +: >| /etc/profile.d/locale.sh /bin/chmod 755 /etc/profile.d/locale.sh # Set user defined locale [ -z "$LOCALE" ] && LOCALE="en_US" @@ -360,10 +349,10 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8. for i in /dev/tty[0-9]*; do /usr/bin/kbd_mode -u < ${i} - printf "\e%%G" > ${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 "\e%%G"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%G"; fi' >>/etc/profile.d/locale.sh stat_done [ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP else @@ -371,10 +360,10 @@ else # make non-UTF-8 consoles work on 2.6.24 and newer kernels for i in /dev/tty[0-9]*; do /usr/bin/kbd_mode -a < ${i} - printf "\e%%@" > ${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 "\e%%@"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%@"; fi' >>/etc/profile.d/locale.sh stat_done [ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP fi @@ -396,10 +385,10 @@ if [ -n "$CONSOLEFONT" ]; then stat_fail else for i in /dev/tty[0-9]*; do - printf "\e(K" > ${i} + printf "\033(K" > ${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 "\e(K"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi' >>/etc/profile.d/locale.sh stat_done fi fi @@ -418,4 +407,12 @@ fi /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 +