mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
Up-to-date initscripts 2011.06
This commit is contained in:
parent
6a89a44b48
commit
8857be7c19
11 changed files with 295 additions and 187 deletions
|
@ -1,5 +1,5 @@
|
||||||
VER := $(shell git describe)
|
VER := $(shell git describe)
|
||||||
DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin
|
DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin /etc/bash_completion.d /usr/share/zsh/site-functions
|
||||||
|
|
||||||
minilogd: minilogd.o
|
minilogd: minilogd.o
|
||||||
|
|
||||||
|
@ -8,11 +8,13 @@ installdirs:
|
||||||
|
|
||||||
install: minilogd installdirs
|
install: minilogd installdirs
|
||||||
install -m644 -t $(DESTDIR)/etc inittab rc.conf
|
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 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/cron.hourly adjtime
|
||||||
install -m755 -t $(DESTDIR)/etc/rc.d functions hwclock network netfs
|
install -m644 -t $(DESTDIR)/etc/rc.d functions
|
||||||
|
install -m755 -t $(DESTDIR)/etc/rc.d hwclock network netfs
|
||||||
install -m755 -t $(DESTDIR)/sbin minilogd rc.d
|
install -m755 -t $(DESTDIR)/sbin minilogd rc.d
|
||||||
|
install -m644 -T bash-completion $(DESTDIR)/etc/bash_completion.d/rc.d
|
||||||
|
install -m644 -T zsh-completion $(DESTDIR)/usr/share/zsh/site-functions/_rc.d
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f minilogd minilogd.o
|
rm -f minilogd minilogd.o
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# rc.sysinit has our copyright info
|
# rc.sysinit has our copyright info
|
||||||
|
|
||||||
pkgname=initscripts
|
pkgname=initscripts
|
||||||
pkgver=2011.05.2
|
pkgver=2011.06.4
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="System initialization/bootup scripts"
|
pkgdesc="System initialization/bootup scripts"
|
||||||
plugrel=1
|
plugrel=1
|
||||||
|
@ -23,6 +23,7 @@ optdepends=('bridge-utils: Network bridging support'
|
||||||
'wireless_tools: Wireless networking')
|
'wireless_tools: Wireless networking')
|
||||||
install=initscripts.install
|
install=initscripts.install
|
||||||
source=(adjtime
|
source=(adjtime
|
||||||
|
bash-completion
|
||||||
functions
|
functions
|
||||||
hwclock
|
hwclock
|
||||||
inittab
|
inittab
|
||||||
|
@ -41,22 +42,23 @@ source=(adjtime
|
||||||
rc.sysinit
|
rc.sysinit
|
||||||
wireless.conf.d)
|
wireless.conf.d)
|
||||||
md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
|
md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
|
||||||
'1aad77c872e7d3b3f9f4c3ba79b515c3'
|
'bb2506a443dd1efe1963aa731be2b7a9'
|
||||||
|
'3a387fbc7567bb053c9964765a7ea747'
|
||||||
'16fa1f14f10fc8c1daf04f4b5edb9cab'
|
'16fa1f14f10fc8c1daf04f4b5edb9cab'
|
||||||
'ac7be5551669fc867e330440e0151067'
|
'f02566fd9a1eeac3aadd5d6af32453c5'
|
||||||
'c6ceb8c7d4820a37b8bf0c827a6916ec'
|
'6260da9309cdcfd68444867dc91d574a'
|
||||||
'366e82ff2faeee4bd72a0b578963235d'
|
'da476ea7e29f23611cc1374a2a4cee8e'
|
||||||
'2c2dcc7ce7586f27fc5e6887f8ec74b8'
|
'2c2dcc7ce7586f27fc5e6887f8ec74b8'
|
||||||
'565f1f24c5dc765831a58622f65844af'
|
'565f1f24c5dc765831a58622f65844af'
|
||||||
'b2469f09d0ae5143b91c182b1d802194'
|
'f56d3a9eb7c0406b47dfb5fbab4d3cf3'
|
||||||
'0559c8a54a1a2720c53f8974143f246d'
|
'e75db8f5b8852f2a066a3ccf2325f7d5'
|
||||||
'66f90c041410bcf72b5c2747677d7780'
|
'dc8510d0be00b8c6640be59bfe7d6d27'
|
||||||
'bd236a57bc00aa4727b98c5ae401c457'
|
'bd236a57bc00aa4727b98c5ae401c457'
|
||||||
'669ce6d766dd9deb86686219f3763fe4'
|
'669ce6d766dd9deb86686219f3763fe4'
|
||||||
'986ca9250756b12f0cb5f517ccb8bc47'
|
'986ca9250756b12f0cb5f517ccb8bc47'
|
||||||
'bdec56c7d6964875c3b3ecaf3bbe58dd'
|
'bdec56c7d6964875c3b3ecaf3bbe58dd'
|
||||||
'6d77bdeeb65958171881fe15589d8c6a'
|
'6d77bdeeb65958171881fe15589d8c6a'
|
||||||
'bac8777077243c0cfefa093621370071'
|
'e3dc54a8c8518c79dbffbf687655bb81'
|
||||||
'027576534885b8d5dded9be546057b12')
|
'027576534885b8d5dded9be546057b12')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
|
22
core/initscripts/bash-completion
Normal file
22
core/initscripts/bash-completion
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# rc.d bash completion by Seblu <seblu@seblu.net>
|
||||||
|
|
||||||
|
_rc.d ()
|
||||||
|
{
|
||||||
|
local action="help list start stop reload restart"
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
local caction="${COMP_WORDS[1]}"
|
||||||
|
if ((${COMP_CWORD} == 1)); then
|
||||||
|
COMPREPLY=($(compgen -W "${action}" -- "$cur"))
|
||||||
|
elif [[ "$caction" =~ help|list ]]; then
|
||||||
|
COMPREPLY=()
|
||||||
|
elif [[ "$caction" == start ]]; then
|
||||||
|
COMPREPLY=($(comm -23 <(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort) <(cd /run/daemons/ && compgen -f "$cur"|sort)))
|
||||||
|
elif [[ "$caction" =~ stop|restart|reload ]]; then
|
||||||
|
COMPREPLY=($(cd /run/daemons/ && compgen -f "$cur"|sort))
|
||||||
|
elif ((${COMP_CWORD} > 1)); then
|
||||||
|
COMPREPLY=($(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
complete -F _rc.d rc.d
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 ft=sh noet:
|
|
@ -49,32 +49,41 @@ else
|
||||||
export LANG=C
|
export LANG=C
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# colors:
|
# set colors
|
||||||
if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then
|
if [[ $USECOLOR =~ yes|YES ]]; then
|
||||||
C_MAIN="\033[1;37;40m" # main text
|
if /bin/tput setaf 0 &>/dev/null; then
|
||||||
|
C_CLEAR="$(tput sgr0)" # clear text
|
||||||
C_OTHER="\033[1;34;40m" # prefix & brackets
|
C_MAIN="${C_CLEAR}$(/bin/tput bold)" # main text
|
||||||
C_SEPARATOR="\033[1;30;40m" # separator
|
C_OTHER="${C_MAIN}$(/bin/tput setaf 4)" # prefix & brackets
|
||||||
|
C_SEPARATOR="${C_MAIN}$(/bin/tput setaf 0)" # separator
|
||||||
C_BUSY="\033[0;36;40m" # busy
|
C_BUSY="${C_CLEAR}$(/bin/tput setaf 6)" # busy
|
||||||
C_FAIL="\033[1;31;40m" # failed
|
C_FAIL="${C_MAIN}$(/bin/tput setaf 1)" # failed
|
||||||
C_DONE="\033[1;37;40m" # completed
|
C_DONE="${C_MAIN}" # completed
|
||||||
C_BKGD="\033[1;35;40m" # backgrounded
|
C_BKGD="${C_MAIN}$(/bin/tput setaf 5)" # backgrounded
|
||||||
|
C_H1="${C_MAIN}" # highlight text 1
|
||||||
C_H1="\033[1;37;40m" # highlight text 1
|
C_H2="${C_MAIN}$(/bin/tput setaf 6)" # highlight text 2
|
||||||
C_H2="\033[1;36;40m" # highlight text 2
|
else
|
||||||
|
C_CLEAR="\e[m" # clear text
|
||||||
C_CLEAR="\033[1;0m"
|
C_MAIN="\e[;1m" # main text
|
||||||
|
C_OTHER="\e[1;34m" # prefix & brackets
|
||||||
|
C_SEPARATOR="\e[1;30m" # separator
|
||||||
|
C_BUSY="\e[;36m" # busy
|
||||||
|
C_FAIL="\e[1;31m" # failed
|
||||||
|
C_DONE="${C_MAIN}" # completed
|
||||||
|
C_BKGD="\e[1;35m" # backgrounded
|
||||||
|
C_H1="${C_MAIN}" # highlight text 1
|
||||||
|
C_H2="\e[1;36m" # highlight text 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
SAVE_POSITION="\033[s"
|
SAVE_POSITION="\e[s"
|
||||||
RESTORE_POSITION="\033[u"
|
RESTORE_POSITION="\e[u"
|
||||||
DEL_TEXT="\033[$(($STAT_COL+4))G"
|
DEL_TEXT="\e[$(($STAT_COL+4))G"
|
||||||
else
|
else
|
||||||
SAVE_POSITION=""
|
SAVE_POSITION=""
|
||||||
RESTORE_POSITION=""
|
RESTORE_POSITION=""
|
||||||
DEL_TEXT=""
|
DEL_TEXT=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prefixes:
|
# prefixes:
|
||||||
|
@ -222,6 +231,14 @@ ck_status() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# PIDs to be omitted by killall5
|
||||||
|
declare -a omit_pids
|
||||||
|
|
||||||
|
add_omit_pids() {
|
||||||
|
omit_pids+=( $@ )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
kill_everything() {
|
kill_everything() {
|
||||||
# $1 = where we are being called from.
|
# $1 = where we are being called from.
|
||||||
# This is used to determine which hooks to run.
|
# This is used to determine which hooks to run.
|
||||||
|
@ -241,12 +258,16 @@ kill_everything() {
|
||||||
# Terminate all processes
|
# Terminate all processes
|
||||||
stat_busy "Sending SIGTERM To Processes"
|
stat_busy "Sending SIGTERM To Processes"
|
||||||
run_hook "$1_prekillall"
|
run_hook "$1_prekillall"
|
||||||
/sbin/killall5 -15 &> /dev/null
|
local pid k5args=""
|
||||||
|
for pid in ${omit_pids[@]}; do
|
||||||
|
k5args+=" -o $pid"
|
||||||
|
done
|
||||||
|
/sbin/killall5 -15 $k5args &> /dev/null
|
||||||
/bin/sleep 5
|
/bin/sleep 5
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
stat_busy "Sending SIGKILL To Processes"
|
stat_busy "Sending SIGKILL To Processes"
|
||||||
/sbin/killall5 -9 &> /dev/null
|
/sbin/killall5 -9 $k5args &> /dev/null
|
||||||
/bin/sleep 1
|
/bin/sleep 1
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
|
|
4
core/initscripts/initscripts.install
Normal file → Executable file
4
core/initscripts/initscripts.install
Normal file → Executable file
|
@ -4,4 +4,8 @@ post_upgrade() {
|
||||||
echo "==> Original file saved as /etc/inittab.pacsave"
|
echo "==> Original file saved as /etc/inittab.pacsave"
|
||||||
sed -i'.pacsave' 's#vc/\([0-9]\)#tty\1#' /etc/inittab
|
sed -i'.pacsave' 's#vc/\([0-9]\)#tty\1#' /etc/inittab
|
||||||
fi
|
fi
|
||||||
|
if [ "$(vercmp $2 2011.06.1)" -lt 0 ]; then
|
||||||
|
echo "Blacklisting of modules is no longer supported in rc.conf,"
|
||||||
|
echo "please add blacklist entries to /etc/modprobe.d/ instead."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,19 +24,19 @@ rh:06:wait:/etc/rc.shutdown
|
||||||
su:S:wait:/sbin/sulogin -p
|
su:S:wait:/sbin/sulogin -p
|
||||||
|
|
||||||
# -8 options fixes umlauts problem on login
|
# -8 options fixes umlauts problem on login
|
||||||
s0:12345:respawn:/sbin/agetty -8 115200 ttyS0 linux
|
s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyS0 linux
|
||||||
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
|
c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux
|
||||||
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
|
c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux
|
||||||
#c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
|
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux
|
||||||
#c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
|
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux
|
||||||
#c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
|
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux
|
||||||
#c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
|
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux
|
||||||
|
|
||||||
# Serial Virtual Console for KVM and others VMs
|
# Serial Virtual Console for KVM and others VMs
|
||||||
#s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux
|
#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux
|
||||||
|
|
||||||
# Hypervisor Virtual Console for Xen and KVM
|
# Hypervisor Virtual Console for Xen and KVM
|
||||||
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
|
#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux
|
||||||
|
|
||||||
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
|
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,19 @@ rh:06:wait:/etc/rc.shutdown
|
||||||
su:S:wait:/sbin/sulogin -p
|
su:S:wait:/sbin/sulogin -p
|
||||||
|
|
||||||
# -8 options fixes umlauts problem on login
|
# -8 options fixes umlauts problem on login
|
||||||
s0:12345:respawn:/sbin/agetty -8 115200 ttyS0 linux
|
s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyS0 linux
|
||||||
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
|
c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux
|
||||||
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
|
c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux
|
||||||
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
|
c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux
|
||||||
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
|
c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux
|
||||||
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
|
c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux
|
||||||
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
|
c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux
|
||||||
|
|
||||||
# Serial Virtual Console for KVM and others VMs
|
# Serial Virtual Console for KVM and others VMs
|
||||||
#s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux
|
#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux
|
||||||
|
|
||||||
# Hypervisor Virtual Console for Xen and KVM
|
# Hypervisor Virtual Console for Xen and KVM
|
||||||
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
|
#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux
|
||||||
|
|
||||||
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
|
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,49 @@ for s in wireless bonding bridges dhcpcd; do
|
||||||
[[ -f /etc/conf.d/$s ]] && . "/etc/conf.d/$s"
|
[[ -f /etc/conf.d/$s ]] && . "/etc/conf.d/$s"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# helper function to determine if legacy network support is needed
|
||||||
|
need_legacy() {
|
||||||
|
if [[ -z $interface ]]; then
|
||||||
|
return 0 # need legacy
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1 # enough present for iproute2 support
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated() {
|
||||||
|
printf "${C_FAIL}Warning:${C_CLEAR} This functionality is deprecated.\n"
|
||||||
|
printf " Please refer to /etc/rc.conf on how to define a single wired\n"
|
||||||
|
printf " connection, or use a utility such as netcfg.\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
network_up() {
|
||||||
|
/usr/sbin/ip link set dev $interface up || return 1
|
||||||
|
|
||||||
|
if [[ $address ]]; then
|
||||||
|
for var in netmask gateway; do
|
||||||
|
if [[ -z ${!var} ]]; then
|
||||||
|
printf "${C_FAIL}Error: static address defined without $var!\n"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
/usr/sbin/ip addr add $address/$netmask dev $interface || return 1
|
||||||
|
/usr/sbin/ip route add default via $gateway || return 1
|
||||||
|
else
|
||||||
|
/sbin/dhcpcd $DHCPCD_ARGS $interface || return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
network_down() {
|
||||||
|
if [[ -f /var/run/dhcpcd-$interface.pid ]]; then
|
||||||
|
/sbin/dhcpcd -k $interface || return 1
|
||||||
|
else
|
||||||
|
/usr/sbin/ip route del default || return 1
|
||||||
|
/usr/sbin/ip addr flush dev $interface || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/sbin/ip link set dev $interface down || return 1
|
||||||
|
}
|
||||||
|
|
||||||
ifup() {
|
ifup() {
|
||||||
local ifcfg=${!1}
|
local ifcfg=${!1}
|
||||||
|
|
||||||
|
@ -179,29 +222,34 @@ bridge_down() {
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
# deprecation check
|
||||||
|
need_legacy && deprecated
|
||||||
if ! ck_daemon network; then
|
if ! ck_daemon network; then
|
||||||
echo "Network is already running. Try 'network restart'"
|
echo "Network is already running. Try 'network restart'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat_busy "Starting Network"
|
stat_busy "Starting Network"
|
||||||
error=0
|
error=0
|
||||||
# bring up bridge interfaces
|
if need_legacy; then
|
||||||
bridge_up
|
# bring up bridge interfaces
|
||||||
# bring up ethernet interfaces
|
bridge_up
|
||||||
for ifline in ${INTERFACES[@]}; do
|
# bring up ethernet interfaces
|
||||||
if [[ $ifline = ${ifline#!} ]]; then
|
for ifline in ${INTERFACES[@]}; do
|
||||||
ifup $ifline || error=1
|
if [[ $ifline = ${ifline#!} ]]; then
|
||||||
fi
|
ifup $ifline || error=1
|
||||||
done
|
fi
|
||||||
# bring up bond interfaces
|
done
|
||||||
bond_up
|
# bring up bond interfaces
|
||||||
# bring up routes
|
bond_up
|
||||||
for rtline in "${ROUTES[@]}"; do
|
# bring up routes
|
||||||
if [ "$rtline" = "${rtline#!}" ]; then
|
for rtline in "${ROUTES[@]}"; do
|
||||||
rtup $rtline || error=1
|
if [ "$rtline" = "${rtline#!}" ]; then
|
||||||
fi
|
rtup $rtline || error=1
|
||||||
done
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
network_up
|
||||||
|
fi
|
||||||
if ((error == 0)); then
|
if ((error == 0)); then
|
||||||
add_daemon network
|
add_daemon network
|
||||||
stat_done
|
stat_done
|
||||||
|
@ -210,11 +258,8 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
#if ck_daemon network; then
|
# deprecation check
|
||||||
# echo "Network is not running. Try 'network start'"
|
need_legacy && deprecated
|
||||||
# exit
|
|
||||||
#fi
|
|
||||||
|
|
||||||
if [[ $NETWORK_PERSIST =~ yes|YES && $RUNLEVEL == [06] ]]; then
|
if [[ $NETWORK_PERSIST =~ yes|YES && $RUNLEVEL == [06] ]]; then
|
||||||
status "Skipping Network Shutdown" true
|
status "Skipping Network Shutdown" true
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -223,20 +268,24 @@ case "$1" in
|
||||||
stat_busy "Stopping Network"
|
stat_busy "Stopping Network"
|
||||||
rm_daemon network
|
rm_daemon network
|
||||||
error=0
|
error=0
|
||||||
for rtline in "${ROUTES[@]}"; do
|
if need_legacy; then
|
||||||
if [[ $rtline = ${rtline#!} ]]; then
|
for rtline in "${ROUTES[@]}"; do
|
||||||
rtdown $rtline || error=1
|
if [[ $rtline = ${rtline#!} ]]; then
|
||||||
fi
|
rtdown $rtline || error=1
|
||||||
done
|
fi
|
||||||
# bring down bond interfaces
|
done
|
||||||
bond_down
|
# bring down bond interfaces
|
||||||
for ifline in ${INTERFACES[@]}; do
|
bond_down
|
||||||
if [[ $ifline = ${ifline#!} ]]; then
|
for ifline in ${INTERFACES[@]}; do
|
||||||
ifdown $ifline || error=1
|
if [[ $ifline = ${ifline#!} ]]; then
|
||||||
fi
|
ifdown $ifline || error=1
|
||||||
done
|
fi
|
||||||
# bring down bridge interfaces
|
done
|
||||||
bridge_down
|
# bring down bridge interfaces
|
||||||
|
bridge_down
|
||||||
|
else
|
||||||
|
network_down
|
||||||
|
fi
|
||||||
if ((error == 0)); then
|
if ((error == 0)); then
|
||||||
stat_done
|
stat_done
|
||||||
else
|
else
|
||||||
|
@ -249,6 +298,8 @@ case "$1" in
|
||||||
$0 start
|
$0 start
|
||||||
;;
|
;;
|
||||||
ifup|ifdown|iflist|rtup|rtdown|rtlist)
|
ifup|ifdown|iflist|rtup|rtdown|rtlist)
|
||||||
|
# deprecation check
|
||||||
|
need_legacy && deprecated
|
||||||
$1 $2
|
$1 $2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -33,10 +33,12 @@ VERBOSE="3"
|
||||||
# HARDWARE
|
# HARDWARE
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed
|
# MODULES: Modules to load at boot-up. Blacklisting is no longer supported.
|
||||||
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
|
# Replace every !module by an entry as on the following line in a file in
|
||||||
|
# /etc/modprobe.d:
|
||||||
|
# blacklist module
|
||||||
|
# See "man modprobe.conf" for details.
|
||||||
#
|
#
|
||||||
MOD_AUTOLOAD="yes"
|
|
||||||
MODULES=()
|
MODULES=()
|
||||||
|
|
||||||
# Udev settle timeout (default to 30)
|
# Udev settle timeout (default to 30)
|
||||||
|
@ -59,41 +61,44 @@ USELVM="no"
|
||||||
#
|
#
|
||||||
HOSTNAME="alarm"
|
HOSTNAME="alarm"
|
||||||
|
|
||||||
# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
|
# Use 'ip addr' or 'ls /sys/class/net/' to see all available interfaces.
|
||||||
#
|
#
|
||||||
# Interfaces to start at boot-up (in this order)
|
# Wired network setup
|
||||||
# Declare each interface then list in INTERFACES
|
# - interface: name of device (required)
|
||||||
# - prefix an entry in INTERFACES with a ! to disable it
|
# - address: IP address (leave blank for DHCP)
|
||||||
# - no hyphens in your interface names - Bash doesn't like it
|
# - netmask: subnet mask (ignored for DHCP)
|
||||||
#
|
# - gateway: default route (ignored for DHCP)
|
||||||
# DHCP: Set your interface to "dhcp" (eth0="dhcp")
|
|
||||||
# Wireless: See network profiles below
|
|
||||||
#
|
#
|
||||||
|
# Static IP example
|
||||||
|
# interface=eth0
|
||||||
|
# address=192.168.0.2
|
||||||
|
# netmask=255.255.255.0
|
||||||
|
# gateway=192.168.0.1
|
||||||
|
#
|
||||||
|
# DHCP example
|
||||||
|
# interface=eth0
|
||||||
|
# address=
|
||||||
|
# netmask=
|
||||||
|
# gateway=
|
||||||
|
|
||||||
#Static IP example
|
interface=
|
||||||
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
|
address=
|
||||||
eth0="dhcp"
|
netmask=
|
||||||
INTERFACES=(eth0)
|
gateway=
|
||||||
|
|
||||||
# Routes to start at boot-up (in this order)
|
|
||||||
# Declare each route then list in ROUTES
|
|
||||||
# - prefix an entry in ROUTES with a ! to disable it
|
|
||||||
#
|
|
||||||
gateway="default gw 192.168.0.1"
|
|
||||||
ROUTES=(!gateway)
|
|
||||||
|
|
||||||
# Setting this to "yes" will skip network shutdown.
|
# Setting this to "yes" will skip network shutdown.
|
||||||
# This is required if your root device is on NFS.
|
# This is required if your root device is on NFS.
|
||||||
NETWORK_PERSIST="no"
|
NETWORK_PERSIST="no"
|
||||||
|
|
||||||
# Enable these network profiles at boot-up. These are only useful
|
# Enable these netcfg profiles at boot-up. These are useful if you happen to
|
||||||
# if you happen to need multiple network configurations (ie, laptop users)
|
# need more advanced network features than the simple network service
|
||||||
|
# supports, such as multiple network configurations (ie, laptop users)
|
||||||
# - set to 'menu' to present a menu during boot-up (dialog package required)
|
# - set to 'menu' to present a menu during boot-up (dialog package required)
|
||||||
# - prefix an entry with a ! to disable it
|
# - prefix an entry with a ! to disable it
|
||||||
#
|
#
|
||||||
# Network profiles are found in /etc/network.d
|
# Network profiles are found in /etc/network.d
|
||||||
#
|
#
|
||||||
# This now requires the netcfg package
|
# This requires the netcfg package
|
||||||
#
|
#
|
||||||
#NETWORKS=(main)
|
#NETWORKS=(main)
|
||||||
|
|
||||||
|
|
|
@ -42,20 +42,28 @@ case $1 in
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
# check min args count
|
||||||
|
(( $# < 2 )) && usage
|
||||||
action=$1
|
action=$1
|
||||||
shift
|
shift
|
||||||
# set same environment variables as init
|
# set same environment variables as init
|
||||||
runlevel=$(/sbin/runlevel)
|
runlevel=$(/sbin/runlevel)
|
||||||
ENV="PATH='/bin:/usr/bin:/sbin:/usr/sbin'"
|
ENV=("PATH=/bin:/usr/bin:/sbin:/usr/sbin"
|
||||||
ENV+=" PREVLEVEL='${runlevel:0:1}'"
|
"PREVLEVEL=${runlevel%% *}"
|
||||||
ENV+=" RUNLEVEL='${runlevel:2:1}'"
|
"RUNLEVEL=${runlevel##* }"
|
||||||
ENV+=" CONSOLE='${CONSOLE:-/dev/console}'"
|
"CONSOLE=${CONSOLE:-/dev/console}"
|
||||||
|
"TERM=$TERM")
|
||||||
|
cd /
|
||||||
for i; do
|
for i; do
|
||||||
[[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action"
|
if [[ -x "/etc/rc.d/$i" ]]; then
|
||||||
|
/usr/bin/env -i "${ENV[@]}" "/etc/rc.d/$i" "$action"
|
||||||
|
else
|
||||||
|
printf "${C_OTHER}:: ${C_FAIL}Error: ${C_DONE}Daemon script $i does not exist.\n"
|
||||||
|
fi
|
||||||
(( ret += !! $? )) # clamp exit value to 0/1
|
(( ret += !! $? )) # clamp exit value to 0/1
|
||||||
done
|
done
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
# vim: set ts=2 sw=2 ft=sh noet:
|
||||||
|
|
|
@ -13,7 +13,7 @@ printsep
|
||||||
|
|
||||||
run_hook sysinit_start
|
run_hook sysinit_start
|
||||||
|
|
||||||
# export standard PATH (will be overridden later when /etc/profile is sourced, but is usefull for UDev)
|
# export standard PATH (will be overridden later when /etc/profile is sourced, but is useful for UDev)
|
||||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
|
||||||
# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
|
# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
|
||||||
|
@ -29,9 +29,9 @@ if ! /bin/mountpoint -q /dev; then
|
||||||
fi
|
fi
|
||||||
/bin/mkdir -p /run/lock /dev/{pts,shm}
|
/bin/mkdir -p /run/lock /dev/{pts,shm}
|
||||||
/bin/chmod 1777 /run/lock
|
/bin/chmod 1777 /run/lock
|
||||||
/bin/mountpoint -q /dev/pts || /bin/mount /dev/pts &> /dev/null \
|
/bin/mountpoint -q /dev/pts || /bin/mount -n /dev/pts &> /dev/null \
|
||||||
|| /bin/mount -n -t devpts devpts /dev/pts -o mode=620,gid=5,nosuid,noexec
|
|| /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/mountpoint -q /dev/shm || /bin/mount -n /dev/shm &> /dev/null \
|
||||||
|| /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
|
|| /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
|
# remount root ro to allow for fsck later on, we remount now to
|
||||||
|
@ -90,8 +90,8 @@ run_hook sysinit_udevlaunched
|
||||||
# Trigger udev uevents
|
# Trigger udev uevents
|
||||||
if /bin/pidof /sbin/udevd &>/dev/null; then
|
if /bin/pidof /sbin/udevd &>/dev/null; then
|
||||||
stat_busy "Triggering UDev uevents"
|
stat_busy "Triggering UDev uevents"
|
||||||
/sbin/udevadm trigger --action=add --type=subsystems
|
/sbin/udevadm trigger --action=add --type=subsystems
|
||||||
/sbin/udevadm trigger --action=add --type=devices
|
/sbin/udevadm trigger --action=add --type=devices
|
||||||
stat_done
|
stat_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ run_hook sysinit_udevsettled
|
||||||
|
|
||||||
# bring up the loopback interface
|
# bring up the loopback interface
|
||||||
[[ -d /sys/class/net/lo ]] && \
|
[[ -d /sys/class/net/lo ]] && \
|
||||||
status "Bringing up loopback interface" /sbin/ifconfig lo 127.0.0.1 up
|
status "Bringing up loopback interface" /sbin/ip link set up dev lo
|
||||||
|
|
||||||
# FakeRAID devices detection
|
# FakeRAID devices detection
|
||||||
if [[ $USEDMRAID =~ yes|YES && -x /sbin/dmraid ]]; then
|
if [[ $USEDMRAID =~ yes|YES && -x /sbin/dmraid ]]; then
|
||||||
|
@ -275,20 +275,21 @@ if [[ -x /sbin/fsck ]]; then
|
||||||
stat_done
|
stat_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status "Mounting Local Filesystems" /bin/mount -n -o remount,rw /
|
stat_busy "Mounting Local Filesystems"
|
||||||
|
/bin/mount -n -o remount,rw /
|
||||||
|
|
||||||
# don't touch /etc/mtab if it is a symlink to /proc/self/mounts
|
# don't touch /etc/mtab if it is a symlink to /proc/self/mounts
|
||||||
if [[ -L /etc/mtab ]]; then
|
if [[ -L /etc/mtab ]]; then
|
||||||
:
|
:
|
||||||
elif [[ -x /bin/findmnt && -e /proc/self/mountinfo ]]; then
|
elif [[ -x /bin/findmnt && -e /proc/self/mountinfo ]]; then
|
||||||
/bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab
|
/bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab
|
||||||
else
|
else
|
||||||
cat /proc/mounts >| /etc/mtab
|
cat /proc/mounts >| /etc/mtab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_hook sysinit_premount
|
run_hook sysinit_premount
|
||||||
# now mount all the local filesystems
|
# now mount all the local filesystems
|
||||||
/bin/mount -a -t $NETFS -O no_netdev
|
/bin/mount -a -t $NETFS -O no_netdev
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
|
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
|
||||||
|
@ -312,62 +313,55 @@ if [[ -f $RANDOM_SEED ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat_busy "Removing Leftover Files"
|
stat_busy "Removing Leftover Files"
|
||||||
/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
|
/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
|
||||||
/bin/mountpoint -q /tmp || /bin/rm -rf /tmp/* /tmp/.* &>/dev/null
|
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
|
||||||
[[ ! -L /var/lock ]] && /bin/rm -rf /var/lock/*
|
[[ ! -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 && -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
|
||||||
[[ ! -L /var/run && ! -L /var/run/daemons ]] && /bin/rm -rf /var/run/daemons \
|
[[ ! -L /var/run && ! -L /var/run/daemons ]] && /bin/rm -rf /var/run/daemons \
|
||||||
&& /bin/ln -s /run/daemons /var/run/daemons
|
&& /bin/ln -s /run/daemons /var/run/daemons
|
||||||
: >| /var/run/utmp
|
: >| /var/run/utmp
|
||||||
/bin/chmod 0664 /var/run/utmp
|
/bin/chmod 0664 /var/run/utmp
|
||||||
/bin/chown root:utmp /var/run/utmp
|
/bin/chown root:utmp /var/run/utmp
|
||||||
# Keep {x,k,g}dm happy with xorg
|
# Keep {x,k,g}dm happy with xorg
|
||||||
/bin/mkdir -m1777 /tmp/.{X11,ICE}-unix
|
/bin/mkdir -m1777 /tmp/.{X11,ICE}-unix
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
#status "Updating Shared Library Links" /sbin/ldconfig
|
|
||||||
|
|
||||||
if [[ $HOSTNAME ]]; then
|
if [[ $HOSTNAME ]]; then
|
||||||
status "Setting Hostname: $HOSTNAME" /bin/hostname "$HOSTNAME"
|
stat_busy "Setting Hostname: $HOSTNAME"
|
||||||
fi
|
echo $HOSTNAME > /proc/sys/kernel/hostname
|
||||||
|
stat_done
|
||||||
# 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"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat_busy "Setting Locale: ${LOCALE:=en_US}"
|
stat_busy "Setting Locale: ${LOCALE:=en_US}"
|
||||||
# Flush old locale settings
|
# Flush old locale settings
|
||||||
: >| /etc/profile.d/locale.sh
|
: >| /etc/profile.d/locale.sh
|
||||||
/bin/chmod 755 /etc/profile.d/locale.sh
|
/bin/chmod 755 /etc/profile.d/locale.sh
|
||||||
# Set user defined locale
|
# Set user defined locale
|
||||||
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
|
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
if [[ ${LOCALE,,} =~ utf ]]; then
|
if [[ ${LOCALE,,} =~ utf ]]; then
|
||||||
stat_busy "Setting Consoles to UTF-8 mode"
|
stat_busy "Setting Consoles to UTF-8 mode"
|
||||||
# UTF-8 consoles are default since 2.6.24 kernel
|
# UTF-8 consoles are default since 2.6.24 kernel
|
||||||
# this code is needed not only for older kernels,
|
# this code is needed not only for older kernels,
|
||||||
# but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
|
# but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
|
||||||
for i in /dev/tty[0-9]*; do
|
for i in /dev/tty[0-9]*; do
|
||||||
/usr/bin/kbd_mode -u < ${i}
|
/usr/bin/kbd_mode -u < ${i}
|
||||||
printf "\033%%G" > ${i}
|
printf "\e%%G" > ${i}
|
||||||
done
|
done
|
||||||
echo 1 > /sys/module/vt/parameters/default_utf8
|
echo 1 > /sys/module/vt/parameters/default_utf8
|
||||||
stat_done
|
stat_done
|
||||||
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
|
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
|
||||||
else
|
else
|
||||||
stat_busy "Setting Consoles to legacy mode"
|
stat_busy "Setting Consoles to legacy mode"
|
||||||
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
|
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
|
||||||
for i in /dev/tty[0-9]*; do
|
for i in /dev/tty[0-9]*; do
|
||||||
/usr/bin/kbd_mode -a < ${i}
|
/usr/bin/kbd_mode -a < ${i}
|
||||||
printf "\033%%@" > ${i}
|
printf "\e%%@" > ${i}
|
||||||
done
|
done
|
||||||
echo 0 > /sys/module/vt/parameters/default_utf8
|
echo 0 > /sys/module/vt/parameters/default_utf8
|
||||||
stat_done
|
stat_done
|
||||||
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
|
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set console font if required
|
# Set console font if required
|
||||||
|
@ -378,9 +372,8 @@ set_consolefont
|
||||||
# we therefore need to copy this from /run to /etc. This functionality is going away one day.
|
# we therefore need to copy this from /run to /etc. This functionality is going away one day.
|
||||||
for f in cd net; do
|
for f in cd net; do
|
||||||
[[ -f /run/udev/tmp-rules--70-persistent-$f.rules ]] || continue
|
[[ -f /run/udev/tmp-rules--70-persistent-$f.rules ]] || continue
|
||||||
stat_busy "Adding persistent $f udev rules"
|
status "Adding persistent $f udev rules"
|
||||||
/bin/cat "/run/udev/tmp-rules--70-persistent-$f.rules" >> "/etc/udev/rules.d/70-persistent-$f.rules"
|
/bin/cat "/run/udev/tmp-rules--70-persistent-$f.rules" >> "/etc/udev/rules.d/70-persistent-$f.rules"
|
||||||
stat_done
|
|
||||||
done
|
done
|
||||||
|
|
||||||
/bin/dmesg >| /var/log/dmesg.log
|
/bin/dmesg >| /var/log/dmesg.log
|
||||||
|
|
Loading…
Reference in a new issue