mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
new initscripts just missing md5sums, on my mac so no makepkg to do it
This commit is contained in:
parent
50694c6048
commit
f89b5afbd9
19 changed files with 871 additions and 594 deletions
|
@ -1,5 +1,15 @@
|
|||
VER := $(shell git describe)
|
||||
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
|
||||
DIRS := \
|
||||
/etc/rc.d \
|
||||
/etc/conf.d \
|
||||
/etc/rc.d/functions.d \
|
||||
/etc/logrotate.d \
|
||||
/sbin \
|
||||
/etc/tmpfiles.d \
|
||||
/usr/lib/tmpfiles.d \
|
||||
/usr/lib/initscripts \
|
||||
/etc/bash_completion.d \
|
||||
/usr/share/zsh/site-functions
|
||||
|
||||
minilogd: minilogd.o
|
||||
|
||||
|
@ -9,10 +19,12 @@ installdirs:
|
|||
install: minilogd installdirs
|
||||
install -m644 -t $(DESTDIR)/etc inittab rc.conf
|
||||
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 -m644 -t $(DESTDIR)/etc/logrotate.d bootlog
|
||||
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)/usr/lib/initscripts arch-tmpfiles
|
||||
install -m644 tmpfiles.conf $(DESTDIR)/usr/lib/tmpfiles.d/arch.conf
|
||||
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
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# Maintainer: Mike Staszel <mikestaszel@plugapps.com>
|
||||
|
||||
# PlugApps changes: inittab has a line for ttyS0 at 115200, 2 ttys
|
||||
# ALARM 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
|
||||
|
||||
pkgname=initscripts
|
||||
pkgver=2011.06.4
|
||||
pkgrel=1.1
|
||||
pkgver=2011.07.3
|
||||
pkgrel=1
|
||||
pkgdesc="System initialization/bootup scripts"
|
||||
plugrel=1
|
||||
arch=('arm' 'armv7h')
|
||||
|
@ -23,8 +23,9 @@ optdepends=('bridge-utils: Network bridging support'
|
|||
'net-tools: legacy network support'
|
||||
'wireless_tools: Wireless networking')
|
||||
install=initscripts.install
|
||||
source=(adjtime
|
||||
source=(arch-tmpfiles
|
||||
bash-completion
|
||||
bootlog
|
||||
functions
|
||||
hwclock
|
||||
inittab
|
||||
|
@ -41,28 +42,10 @@ source=(adjtime
|
|||
rc.shutdown
|
||||
rc.single
|
||||
rc.sysinit
|
||||
tmpfiles.conf
|
||||
wireless.conf.d
|
||||
zsh-completion)
|
||||
md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
|
||||
'bb2506a443dd1efe1963aa731be2b7a9'
|
||||
'3a387fbc7567bb053c9964765a7ea747'
|
||||
'16fa1f14f10fc8c1daf04f4b5edb9cab'
|
||||
'f02566fd9a1eeac3aadd5d6af32453c5'
|
||||
'6260da9309cdcfd68444867dc91d574a'
|
||||
'da476ea7e29f23611cc1374a2a4cee8e'
|
||||
'2c2dcc7ce7586f27fc5e6887f8ec74b8'
|
||||
'565f1f24c5dc765831a58622f65844af'
|
||||
'f56d3a9eb7c0406b47dfb5fbab4d3cf3'
|
||||
'afc78ab156a6ec7389a3265af96d922e'
|
||||
'dc8510d0be00b8c6640be59bfe7d6d27'
|
||||
'bd236a57bc00aa4727b98c5ae401c457'
|
||||
'669ce6d766dd9deb86686219f3763fe4'
|
||||
'986ca9250756b12f0cb5f517ccb8bc47'
|
||||
'bdec56c7d6964875c3b3ecaf3bbe58dd'
|
||||
'6d77bdeeb65958171881fe15589d8c6a'
|
||||
'e3dc54a8c8518c79dbffbf687655bb81'
|
||||
'027576534885b8d5dded9be546057b12'
|
||||
'b75f2f05e8272aecf08aabd8c4003b4a')
|
||||
#md5sums()
|
||||
|
||||
package() {
|
||||
cd ${srcdir}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/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
|
250
core/initscripts/arch-tmpfiles
Executable file
250
core/initscripts/arch-tmpfiles
Executable file
|
@ -0,0 +1,250 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# /usr/lib/initscripts/arch-tmpfiles
|
||||
#
|
||||
# Control creation, deletion, and cleaning of volatile and temporary files
|
||||
#
|
||||
|
||||
warninvalid() {
|
||||
printf "arch-tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
|
||||
(( ++error ))
|
||||
} >&2
|
||||
|
||||
checkparams() {
|
||||
local parmreq=$1; shift
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
# parmcount must be >= parmreq
|
||||
if (( $# < parmreq )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# mode must be valid octal and 3 or 4 digits
|
||||
if [[ $mode && ! $mode =~ ^[0-7]{3,4}$ ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# uid must be numeric or a valid user name
|
||||
if [[ $uid && $uid != +([[:digit:]]) ]] && ! getent passwd "$uid" >/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# gid must be numeric or a valid group name
|
||||
if [[ $gid && $gid != +([[:digit:]]) ]] && ! getent group "$gid" >/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_f() {
|
||||
# Create a file if it doesn't exist yet
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
(( CREATE )) || return 0
|
||||
|
||||
if ! checkparams 4 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -e $path ]]; then
|
||||
install -m"$mode" -o"$uid" -g"$gid" <(:) "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
_F() {
|
||||
# Create or truncate a file
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
(( CREATE )) || return 0
|
||||
|
||||
if ! checkparams 4 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
install -m"$mode" -o"$uid" -g"$gid" <(:) "$path"
|
||||
}
|
||||
|
||||
_d() {
|
||||
# Create a directory if it doesn't exist yet
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
(( CREATE )) || return 0
|
||||
|
||||
if ! checkparams 4 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -d "$path" ]]; then
|
||||
install -d -m"$mode" -o"$uid" -g"$gid" "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
_D() {
|
||||
# Create or empty a directory
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
(( CREATE )) || return 0
|
||||
|
||||
if ! checkparams 4 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -d $path ]]; then
|
||||
find "$path" -mindepth 1 -maxdepth 1 -xdev -print0 | xargs -r0 rm -rf
|
||||
fi
|
||||
install -d -m"$mode" -o"$uid" -g"$gid" "$path"
|
||||
}
|
||||
|
||||
_p() {
|
||||
# Create a named pipe (FIFO) if it doesn't exist yet
|
||||
local path=$1 mode=$2 uid=$3 gid=$4
|
||||
|
||||
(( CREATE )) || return 0
|
||||
|
||||
if ! checkparams 4 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -p "$path" ]]; then
|
||||
mkfifo -m$mode "$path"
|
||||
chown "$uid:$gid" "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
_x() {
|
||||
# Ignore a path during cleaning. Use this type to exclude paths from clean-up as
|
||||
# controlled with the Age parameter. Note that lines of this type do not
|
||||
# influence the effect of r or R lines. Lines of this type accept shell-style
|
||||
# globs in place of of normal path names.
|
||||
:
|
||||
# XXX: we don't implement this
|
||||
}
|
||||
|
||||
_r() {
|
||||
# Remove a file or directory if it exists. This may not be used to remove
|
||||
# non-empty directories, use R for that. Lines of this type accept shell-style
|
||||
# globs in place of normal path names.
|
||||
local path
|
||||
local -a paths=($1)
|
||||
|
||||
(( REMOVE )) || return 0
|
||||
|
||||
if ! checkparams 1 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
for path in "${paths[@]}"; do
|
||||
if [[ -f $path ]]; then
|
||||
rm -f "$path"
|
||||
elif [[ -d $path ]]; then
|
||||
rmdir "$path"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_R() {
|
||||
# Recursively remove a path and all its subdirectories (if it is a directory).
|
||||
# Lines of this type accept shell-style globs in place of normal path names.
|
||||
local path
|
||||
local -a paths=($1)
|
||||
|
||||
(( REMOVE )) || return 0
|
||||
|
||||
if ! checkparams 1 "$@"; then
|
||||
warninvalid
|
||||
return
|
||||
fi
|
||||
|
||||
for path in "${paths[@]}"; do
|
||||
[[ -d $path ]] && rm -rf --one-file-system "$path"
|
||||
done
|
||||
}
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
declare -i CREATE=0 REMOVE=0 CLEAN=0 error=0 LINENO=0
|
||||
declare FILE=
|
||||
declare -A fragments
|
||||
declare -a tmpfiles_d=(
|
||||
/usr/lib/tmpfiles.d/*.conf
|
||||
/etc/tmpfiles.d/*.conf
|
||||
/run/tmpfiles.d/*.conf
|
||||
)
|
||||
|
||||
while (( $# )); do
|
||||
case $1 in
|
||||
--create) CREATE=1 ;;
|
||||
--remove) REMOVE=1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if (( !(CREATE + REMOVE) )); then
|
||||
printf 'usage: %s [--create] [--remove]\n' "${0##*/}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# directories declared later in the tmpfiles_d array will override earlier
|
||||
# directories, on a per file basis.
|
||||
# Example: `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
|
||||
for path in "${tmpfiles_d[@]}"; do
|
||||
[[ -f $path ]] && fragments[${path##*/}]=${path%/*}
|
||||
done
|
||||
|
||||
# catch errors in functions so we can exit with something meaningful
|
||||
set -E
|
||||
trap '(( ++error ))' ERR
|
||||
|
||||
# loop through the gathered fragments, sorted globally by filename.
|
||||
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
|
||||
while read -d '' fragment; do
|
||||
LINENUM=0
|
||||
|
||||
printf -v FILE '%s/%s' "${fragments[$fragment]}" "$fragment"
|
||||
|
||||
### FILE FORMAT ###
|
||||
# XXX: We ignore the final 'Age' parameter
|
||||
# 0 1 2 3 4 5
|
||||
# Type Path Mode UID GID Age
|
||||
# d /run/user 0755 root root 10d
|
||||
|
||||
# omit read's -r flag to honor escapes here, so that whitespace can be
|
||||
# escaped for paths. We will _not_ honor quoted paths.
|
||||
while read -a line; do
|
||||
(( ++LINENUM ))
|
||||
|
||||
# skip over comments and empty lines
|
||||
if (( ! ${#line[*]} )) || [[ ${line[0]:0:1} = '#' ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# whine about invalid entries
|
||||
if ! type -t _${line[0]} >/dev/null; then
|
||||
warninvalid
|
||||
continue
|
||||
fi
|
||||
|
||||
# fall back on defaults when parameters are passed as '-'
|
||||
if [[ ${line[2]} = '-' ]]; then
|
||||
case ${line[0]} in
|
||||
p|f|F) line[2]=0644 ;;
|
||||
d|D) line[2]=0755 ;;
|
||||
esac
|
||||
fi
|
||||
[[ ${line[3]} = '-' ]] && line[3]=0
|
||||
[[ ${line[4]} = '-' ]] && line[4]=0
|
||||
|
||||
_${line[0]} "${line[@]:1}"
|
||||
done <"$FILE"
|
||||
done < <(printf '%s\0' "${!fragments[@]}" | sort -z)
|
||||
|
||||
exit $error
|
||||
|
||||
# vim: set ts=2 sw=2 noet:
|
|
@ -1,22 +1,24 @@
|
|||
# rc.d bash completion by Seblu <seblu@seblu.net>
|
||||
|
||||
_rc.d ()
|
||||
_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
|
||||
local action cur prev
|
||||
action="help list start stop reload restart"
|
||||
_get_comp_words_by_ref cur prev
|
||||
if ((COMP_CWORD == 1)); then
|
||||
COMPREPLY=($(compgen -W "${action}" -- "$cur"))
|
||||
elif [[ "$caction" =~ help|list ]]; then
|
||||
elif [[ "$prev" == help ]]; then
|
||||
COMPREPLY=()
|
||||
elif [[ "$caction" == start ]]; then
|
||||
elif [[ "$prev" == list ]]; then
|
||||
((COMP_CWORD == 2)) && COMPREPLY=($(compgen -W "started stopped" -- "$cur")) || COMPREPLY=()
|
||||
elif [[ "$prev" == 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
|
||||
elif [[ "$prev" =~ stop|restart|reload ]]; then
|
||||
COMPREPLY=($(cd /run/daemons/ && compgen -f "$cur"|sort))
|
||||
elif ((${COMP_CWORD} > 1)); then
|
||||
elif ((COMP_CWORD > 1)); then
|
||||
COMPREPLY=($(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort))
|
||||
fi
|
||||
}
|
||||
complete -F _rc.d rc.d
|
||||
complete -F _rc_d rc.d
|
||||
|
||||
# vim: set ts=2 sw=2 ft=sh noet:
|
||||
|
|
9
core/initscripts/bootlog
Normal file
9
core/initscripts/bootlog
Normal file
|
@ -0,0 +1,9 @@
|
|||
/var/log/boot {
|
||||
compress
|
||||
rotate 1
|
||||
size=+1024k
|
||||
notifempty
|
||||
missingok
|
||||
copytruncate
|
||||
noolddir
|
||||
}
|
|
@ -2,32 +2,56 @@
|
|||
# initscripts functions
|
||||
#
|
||||
|
||||
# sanitize 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"
|
||||
|
||||
if [[ $1 == "start" ]]; then
|
||||
if [[ $STARTING ]]; then
|
||||
echo "A daemon is starting another daemon, this is unlikely to work as intended.\n"
|
||||
else
|
||||
export STARTING=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# width:
|
||||
|
||||
STAT_COL=80
|
||||
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 ((STAT_COL==0)); then
|
||||
# if output was 0 (serial console), set default width to 80
|
||||
calc_columns () {
|
||||
STAT_COL=80
|
||||
USECOLOR=""
|
||||
fi
|
||||
if [[ ! -t 1 ]]; then
|
||||
USECOLOR=""
|
||||
elif [[ -t 0 ]]; then
|
||||
# stty will fail when stdin isn't a terminal
|
||||
STAT_COL=$(stty size)
|
||||
# stty gives "rows cols"; strip the rows number, we just want columns
|
||||
STAT_COL=${STAT_COL##* }
|
||||
elif tput cols &>/dev/null; then
|
||||
# is /usr/share/terminfo already mounted, and TERM recognized?
|
||||
STAT_COL=$(tput cols)
|
||||
fi
|
||||
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
|
||||
STAT_COL=$(($STAT_COL - 13))
|
||||
# we use 13 characters for our own stuff
|
||||
STAT_COL=$(( STAT_COL - 13 ))
|
||||
|
||||
if [[ -t 1 ]]; then
|
||||
SAVE_POSITION="\e[s"
|
||||
RESTORE_POSITION="\e[u"
|
||||
DEL_TEXT="\e[$(( STAT_COL + 4 ))G"
|
||||
else
|
||||
SAVE_POSITION=""
|
||||
RESTORE_POSITION=""
|
||||
DEL_TEXT=""
|
||||
fi
|
||||
}
|
||||
|
||||
calc_columns
|
||||
|
||||
# disable colors on broken terminals
|
||||
TERM_COLORS="$(/bin/tput colors 2>/dev/null)"
|
||||
if (($? != 3)); then
|
||||
TERM_COLORS=$(tput colors 2>/dev/null)
|
||||
if (( $? != 3 )); then
|
||||
case $TERM_COLORS in
|
||||
*[!0-9]*) USECOLOR="";;
|
||||
[0-7]) USECOLOR="";;
|
||||
|
@ -43,47 +67,37 @@ unset TZ
|
|||
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
|
||||
if [[ $DAEMON_LOCALE = [yY][eE][sS] && $LOCALE ]]; then
|
||||
export LANG="${LOCALE}"
|
||||
else
|
||||
export LANG=C
|
||||
fi
|
||||
|
||||
# set colors
|
||||
if [[ $USECOLOR =~ yes|YES ]]; then
|
||||
if /bin/tput setaf 0 &>/dev/null; then
|
||||
C_CLEAR="$(tput sgr0)" # clear text
|
||||
C_MAIN="${C_CLEAR}$(/bin/tput bold)" # main text
|
||||
C_OTHER="${C_MAIN}$(/bin/tput setaf 4)" # prefix & brackets
|
||||
C_SEPARATOR="${C_MAIN}$(/bin/tput setaf 0)" # separator
|
||||
C_BUSY="${C_CLEAR}$(/bin/tput setaf 6)" # busy
|
||||
C_FAIL="${C_MAIN}$(/bin/tput setaf 1)" # failed
|
||||
C_DONE="${C_MAIN}" # completed
|
||||
C_BKGD="${C_MAIN}$(/bin/tput setaf 5)" # backgrounded
|
||||
C_H1="${C_MAIN}" # highlight text 1
|
||||
C_H2="${C_MAIN}$(/bin/tput setaf 6)" # highlight text 2
|
||||
else
|
||||
C_CLEAR="\e[m" # clear text
|
||||
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
|
||||
|
||||
if [[ -t 1 ]]; then
|
||||
SAVE_POSITION="\e[s"
|
||||
RESTORE_POSITION="\e[u"
|
||||
DEL_TEXT="\e[$(($STAT_COL+4))G"
|
||||
else
|
||||
SAVE_POSITION=""
|
||||
RESTORE_POSITION=""
|
||||
DEL_TEXT=""
|
||||
if [[ $USECOLOR = [yY][eE][sS] ]]; then
|
||||
if tput setaf 0 &>/dev/null; then
|
||||
C_CLEAR=$(tput sgr0) # clear text
|
||||
C_MAIN=${C_CLEAR}$(tput bold) # main text
|
||||
C_OTHER=${C_MAIN}$(tput setaf 4) # prefix & brackets
|
||||
C_SEPARATOR=${C_MAIN}$(tput setaf 0) # separator
|
||||
C_BUSY=${C_CLEAR}$(tput setaf 6) # busy
|
||||
C_FAIL=${C_MAIN}$(tput setaf 1) # failed
|
||||
C_DONE=${C_MAIN} # completed
|
||||
C_BKGD=${C_MAIN}$(tput setaf 5) # backgrounded
|
||||
C_H1=${C_MAIN} # highlight text 1
|
||||
C_H2=${C_MAIN}$(tput setaf 6) # highlight text 2
|
||||
else
|
||||
C_CLEAR="\e[m" # clear text
|
||||
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
|
||||
|
||||
# prefixes:
|
||||
|
@ -142,24 +156,20 @@ stat_die() {
|
|||
status() {
|
||||
stat_busy "$1"
|
||||
shift
|
||||
if "$@" >/dev/null 2>&1; then
|
||||
stat_done
|
||||
return 0
|
||||
fi
|
||||
stat_fail
|
||||
return 1
|
||||
"$@" &>/dev/null
|
||||
local ret=$?
|
||||
(( ret == 0 )) && stat_done || stat_fail
|
||||
return $ret
|
||||
}
|
||||
|
||||
# usage : in_array( $needle, $haystack )
|
||||
# return : 0 - found
|
||||
# 1 - not found
|
||||
# Copied from makepkg
|
||||
in_array() {
|
||||
[[ $2 ]] || return 1
|
||||
local needle=$1; shift
|
||||
local item
|
||||
for item in "$@"; do
|
||||
[[ ${item#@} = $needle ]] && return 0
|
||||
for item; do
|
||||
[[ $item = "${needle}" ]] && return 0
|
||||
done
|
||||
return 1 # Not Found
|
||||
}
|
||||
|
@ -167,12 +177,12 @@ in_array() {
|
|||
# daemons:
|
||||
|
||||
add_daemon() {
|
||||
[[ -d /run/daemons ]] || /bin/mkdir -p /run/daemons
|
||||
> /run/daemons/"$1"
|
||||
[[ -d /run/daemons ]] || mkdir -p /run/daemons
|
||||
>| /run/daemons/"$1"
|
||||
}
|
||||
|
||||
rm_daemon() {
|
||||
/bin/rm -f /run/daemons/"$1"
|
||||
rm -f /run/daemons/"$1"
|
||||
}
|
||||
|
||||
ck_daemon() {
|
||||
|
@ -186,9 +196,9 @@ have_daemon() {
|
|||
|
||||
# Check if $1 is started at boot
|
||||
ck_autostart() {
|
||||
local d
|
||||
for d in "${DAEMONS[@]}"; do
|
||||
[[ "$1" = ${d#@} ]] && return 1
|
||||
local daemon
|
||||
for daemon in "${DAEMONS[@]}"; do
|
||||
[[ $1 = "${daemon#@}" ]] && return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
@ -197,8 +207,11 @@ start_daemon() {
|
|||
have_daemon "$1" && /etc/rc.d/"$1" start
|
||||
}
|
||||
|
||||
# Never use this function, it causes daemons to be stoped in the wrong order.
|
||||
# The only way to start a daemon at boot is to add it to the DAEMONS array.
|
||||
ck_depends() {
|
||||
for daemon in "$@"; do
|
||||
local daemon
|
||||
for daemon; do
|
||||
ck_daemon "$daemon" && start_daemon "$daemon"
|
||||
done
|
||||
}
|
||||
|
@ -224,66 +237,110 @@ status_stopped() {
|
|||
}
|
||||
|
||||
ck_status() {
|
||||
if ! ck_daemon "$1"; then
|
||||
status_started
|
||||
else
|
||||
status_stopped
|
||||
! ck_daemon "$1" && status_started || status_stopped
|
||||
}
|
||||
|
||||
# Return PID of $1
|
||||
get_pid() {
|
||||
pidof -o %PPID $1 || return 1
|
||||
}
|
||||
|
||||
# Check if PID-file $1 is still the active PID-file for command $2
|
||||
ck_pidfile() {
|
||||
if [[ -f $1 ]]; then
|
||||
local fpid ppid
|
||||
read -r fpid <"$1"
|
||||
ppid=$(get_pid "$2")
|
||||
[[ $fpid = "${ppid}" ]] && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# PIDs to be omitted by killall5
|
||||
declare -a omit_pids
|
||||
|
||||
add_omit_pids() {
|
||||
omit_pids+=( $@ )
|
||||
omit_pids+=( $@ )
|
||||
}
|
||||
|
||||
|
||||
kill_everything() {
|
||||
# $1 = where we are being called from.
|
||||
# This is used to determine which hooks to run.
|
||||
# Stop all daemons
|
||||
# This function should *never* ever perform any other actions beside calling stop_daemon()!
|
||||
# It might be used by a splash system etc. to get a list of daemons to be stopped.
|
||||
stop_all_daemons() {
|
||||
# Find daemons NOT in the DAEMONS array. Shut these down first
|
||||
local daemon
|
||||
for daemon in /run/daemons/*; do
|
||||
[[ -f $daemon ]] || continue
|
||||
daemon=${daemon##*/}
|
||||
in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
|
||||
ck_autostart "$daemon" && 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]#@}
|
||||
local i daemon
|
||||
for (( i=${#DAEMONS[@]}-1; i>=0; i-- )); do
|
||||
[[ ${DAEMONS[i]} = '!'* ]] && continue
|
||||
daemon=${DAEMONS[i]#@}
|
||||
ck_daemon "$daemon" || stop_daemon "$daemon"
|
||||
done
|
||||
}
|
||||
|
||||
kill_all() {
|
||||
# Terminate all processes
|
||||
# and wait until killall5 reports all done or timeout
|
||||
# Unfortunately killall5 does not support the 0 signal, so just
|
||||
# use SIGCONT for checking (which should be ignored).
|
||||
stat_busy "Sending SIGTERM To Processes"
|
||||
run_hook "$1_prekillall"
|
||||
local pid k5args=""
|
||||
for pid in ${omit_pids[@]}; do
|
||||
k5args+=" -o $pid"
|
||||
done
|
||||
/sbin/killall5 -15 $k5args &> /dev/null
|
||||
/bin/sleep 5
|
||||
local i
|
||||
killall5 -15 ${omit_pids[@]/#/-o } &>/dev/null
|
||||
for (( i=0; i<20 && $?!=2; i++ )); do
|
||||
sleep .25 # 1/4 second
|
||||
killall5 -18 ${omit_pids[@]/#/-o } &>/dev/null
|
||||
done
|
||||
stat_done
|
||||
|
||||
stat_busy "Sending SIGKILL To Processes"
|
||||
/sbin/killall5 -9 $k5args &> /dev/null
|
||||
/bin/sleep 1
|
||||
local i
|
||||
killall5 -9 ${omit_pids[@]/#/-o } &>/dev/null
|
||||
for (( i=0; i<4 && $?!=2; i++ )); do
|
||||
sleep .25 # 1/4 second
|
||||
killall5 -18 ${omit_pids[@]/#/-o } &>/dev/null
|
||||
done
|
||||
stat_done
|
||||
}
|
||||
|
||||
# Start/trigger UDev, load MODULES and settle UDev
|
||||
udevd_modprobe() {
|
||||
# $1 = where we are being called from.
|
||||
# This is used to determine which hooks to run.
|
||||
status "Starting UDev Daemon" udevd --daemon
|
||||
|
||||
run_hook "$1_udevlaunched"
|
||||
|
||||
stat_busy "Triggering UDev uevents"
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
stat_done
|
||||
|
||||
run_hook "$1_postkillall"
|
||||
# Load modules from the MODULES array defined in rc.conf
|
||||
[[ -f /proc/modules ]] && (( ${#MODULES[*]} )) &&
|
||||
status "Loading Modules" modprobe -ab "${MODULES[@]}"
|
||||
|
||||
status "Waiting for UDev uevents to be processed" \
|
||||
udevadm settle --timeout=${UDEV_TIMEOUT:-30}
|
||||
|
||||
run_hook "$1_udevsettled"
|
||||
|
||||
# in case loading a module changed the display mode
|
||||
calc_columns
|
||||
}
|
||||
|
||||
activate_vgs() {
|
||||
[[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]] || return
|
||||
[[ $USELVM = [yY][eE][sS] && -x $(type -P lvm) && -d /sys/block ]] || return 0
|
||||
# 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
|
||||
modprobe -q dm-mod 2>/dev/null
|
||||
vgchange --sysinit -a y >/dev/null
|
||||
(( $? == 0 )) && stat_done || stat_fail
|
||||
}
|
||||
|
||||
# Arch cryptsetup packages traditionally contained the binaries
|
||||
|
@ -301,7 +358,7 @@ 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
|
||||
[[ $line && $line != '#'* ]] || continue
|
||||
eval nspo=("${line%#*}")
|
||||
if $1 "${nspo[0]}" "${nspo[1]}" "${nspo[2]}" "${nspo[*]:3}"; then
|
||||
crypto_unlocked=1
|
||||
|
@ -312,6 +369,75 @@ read_crypttab() {
|
|||
return $failed
|
||||
}
|
||||
|
||||
# Filesystem functions
|
||||
# These can be overridden/reused for customizations like shutdown/loop-fsck.
|
||||
NETFS="nfs,nfs4,smbfs,cifs,codafs,ncpfs,shfs,fuse,fuseblk,glusterfs,davfs,fuse.glusterfs"
|
||||
|
||||
# Check local filesystems
|
||||
fsck_all() {
|
||||
fsck -A -T -C"$FSCK_FD" -a -t "no${NETFS//,/,no},noopts=_netdev" $FORCEFSCK
|
||||
return $?
|
||||
}
|
||||
|
||||
# Single-user login and/or automatic reboot after fsck (if needed)
|
||||
fsck_reboot() {
|
||||
# $1 = exit code returned by fsck
|
||||
# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
|
||||
(( ($1 | 33) == 33 )) && return 0
|
||||
if (( $1 & 2 )); then
|
||||
echo
|
||||
echo "********************** REBOOT REQUIRED *********************"
|
||||
echo "* *"
|
||||
echo "* The system will be rebooted automatically in 15 seconds. *"
|
||||
echo "* *"
|
||||
echo "************************************************************"
|
||||
echo
|
||||
sleep 15
|
||||
else
|
||||
echo
|
||||
echo "***************** FILESYSTEM CHECK FAILED ****************"
|
||||
echo "* *"
|
||||
echo "* Please repair manually and reboot. Note that the root *"
|
||||
echo "* file system is currently mounted read-only. To remount *"
|
||||
echo "* it read-write type: mount -n -o remount,rw / *"
|
||||
echo "* When you exit the maintenance shell the system will *"
|
||||
echo "* reboot automatically. *"
|
||||
echo "* *"
|
||||
echo "************************************************************"
|
||||
echo
|
||||
sulogin -p
|
||||
fi
|
||||
echo "Automatic reboot in progress..."
|
||||
umount -a
|
||||
mount -n -o remount,ro /
|
||||
reboot -f
|
||||
exit 0
|
||||
}
|
||||
|
||||
mount_all() {
|
||||
mount -a -t "nosysfs,no${NETFS//,/,no}" -O no_netdev
|
||||
}
|
||||
|
||||
remove_leftover() {
|
||||
stat_busy "Removing Leftover Files"
|
||||
# handle this separately until we declare the non-symlinks obsoleted
|
||||
[[ ! -L /var/lock ]] && rm -rf /var/lock/*
|
||||
if [[ ! -L /var/run && -d /var/run ]]; then
|
||||
find /var/run/ \! -type d -delete
|
||||
ln -s /run/daemons /var/run/daemons
|
||||
fi
|
||||
/usr/lib/initscripts/arch-tmpfiles --create --remove && stat_done || stat_fail
|
||||
}
|
||||
|
||||
bootlogd_stop() {
|
||||
[[ -f /run/bootlogd.pid ]] || return 0
|
||||
touch /var/log/boot
|
||||
kill $(< /run/bootlogd.pid)
|
||||
rm -f /run/bootlogd.pid
|
||||
sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
|
||||
-e 's/\^\[(\[151|%)G//g' /var/log/boot
|
||||
}
|
||||
|
||||
###############################
|
||||
# Custom hooks in initscripts #
|
||||
###############################
|
||||
|
@ -338,21 +464,23 @@ read_crypttab() {
|
|||
# sysinit_udevsettled: after uevents have settled in rc.sysinit
|
||||
# single_udevsettled: after uevents have settled in rc.single
|
||||
# sysinit_premount: before local filesystems are mounted, but after root is mounted read-write in rc.sysinit
|
||||
# sysinit_postmount: after local filesystems are mounted
|
||||
# shutdown_prekillall: before all processes are being killed in rc.shutdown
|
||||
# single_prekillall: before all processes are being killed in rc.single
|
||||
# shutdown_postkillall: after all processes have been killed in rc.shutdown
|
||||
# single_postkillall: after all processes have been killed in rc.single
|
||||
# shutdown_postumount: after filesystems are unmounted
|
||||
# shutdown_poweroff: directly before powering off in rc.shutdown
|
||||
#
|
||||
# Declare add_hook and run_hook as read-only to prevent overwriting them.
|
||||
# Too bad we cannot do the same thing with hook_funcs
|
||||
|
||||
if [[ $RC_FUNCTIONS_HOOK_FUNCS_DEFINED -ne 1 ]]; then
|
||||
if (( RC_FUNCTIONS_HOOK_FUNCS_DEFINED != 1 )); then
|
||||
declare -A hook_funcs
|
||||
|
||||
add_hook() {
|
||||
[[ $1 && $2 ]] || return 1
|
||||
hook_funcs["$1"]+=" $2"
|
||||
hook_funcs[$1]+=" $2"
|
||||
}
|
||||
|
||||
run_hook() {
|
||||
|
@ -371,13 +499,14 @@ fi
|
|||
set_consolefont() {
|
||||
[[ $CONSOLEFONT ]] || return 0
|
||||
stat_busy "Loading Console Font: $CONSOLEFONT"
|
||||
#CONSOLEMAP in UTF-8 shouldn't be used
|
||||
[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
|
||||
for i in /dev/tty[0-9]*; do
|
||||
/usr/bin/setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
|
||||
$CONSOLEFONT -C ${i} >/dev/null 2>&1
|
||||
done
|
||||
if (($? != 0)); then
|
||||
#CONSOLEMAP in UTF-8 shouldn't be used
|
||||
[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
|
||||
local i
|
||||
for i in /dev/tty[0-9]*; do
|
||||
setfont ${CONSOLEMAP:+-m "${CONSOLEMAP}"} \
|
||||
"$CONSOLEFONT" -C ${i} &>/dev/null
|
||||
done
|
||||
if (( $? )); then
|
||||
stat_fail
|
||||
elif [[ $CONSOLEMAP ]]; then
|
||||
cat <<"EOF" >>/etc/profile.d/locale.sh
|
||||
|
@ -394,5 +523,15 @@ for f in /etc/rc.d/functions.d/*; do
|
|||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
# Exit current shell if user is not root
|
||||
need_root() {
|
||||
(( EUID )) && printf 'You need to be root.\n' && exit 1
|
||||
}
|
||||
|
||||
# Quit script if it's not running by root
|
||||
# This can be disabled in scripts sourcing functions by setting NEED_ROOT=0
|
||||
# A local call to need_root can be done to ensure part of script need root privilege
|
||||
(( ${NEED_ROOT:-0} == 1 )) && need_root
|
||||
|
||||
# End of file
|
||||
# vim: set ts=2 sw=2 noet:
|
||||
|
|
|
@ -11,27 +11,18 @@ 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
|
||||
;;
|
||||
add_daemon hwclock;;
|
||||
stop)
|
||||
if [[ $HWCLOCK_PARAMS ]]; then
|
||||
stat_busy "Saving System Clock"
|
||||
/sbin/hwclock --systohc $HWCLOCK_PARAMS || stat_die
|
||||
stat_done
|
||||
fi
|
||||
case $HARDWARECLOCK in
|
||||
UTC) hwclock --adjust --utc;;
|
||||
localtime) hwclock --adjust --localtime;;
|
||||
"") hwclock --adjust;;
|
||||
esac
|
||||
rm_daemon hwclock
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
|
|
4
core/initscripts/initscripts.install
Executable file → Normal file
4
core/initscripts/initscripts.install
Executable file → Normal file
|
@ -8,4 +8,8 @@ post_upgrade() {
|
|||
echo "Blacklisting of modules is no longer supported in rc.conf,"
|
||||
echo "please add blacklist entries to /etc/modprobe.d/ instead."
|
||||
fi
|
||||
if [ "$(vercmp $2 2011.07.2)" -lt 0 ]; then
|
||||
echo "VERBOSE= in rc.conf no longer has any effect."
|
||||
echo "Please append 'quiet' to your kernel command line."
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -4,32 +4,24 @@
|
|||
. /etc/rc.conf
|
||||
. /etc/rc.d/functions
|
||||
|
||||
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,davfs
|
||||
mount -a -t "$NETFS"
|
||||
rc=$?
|
||||
/bin/mount -a -O _netdev
|
||||
if ((rc + $? > 0)); then
|
||||
stat_fail
|
||||
else
|
||||
add_daemon netfs
|
||||
stat_done
|
||||
fi
|
||||
mount -a -O _netdev
|
||||
(( rc || $? )) && stat_die
|
||||
add_daemon netfs
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Unmounting Network Filesystems"
|
||||
/bin/umount -a -O _netdev
|
||||
umount -a -O _netdev
|
||||
rc=$?
|
||||
/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
|
||||
stat_done
|
||||
fi
|
||||
umount -a -t "$NETFS"
|
||||
(( rc || $? )) && stat_die
|
||||
rm_daemon netfs
|
||||
stat_done
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
|
@ -37,7 +29,8 @@ case "$1" in
|
|||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# vim: set ts=2 noet:
|
||||
|
|
|
@ -9,7 +9,8 @@ done
|
|||
|
||||
# helper function to determine if legacy network support is needed
|
||||
need_legacy() {
|
||||
if [[ -z $interface ]]; then
|
||||
# complain when `interface' is unset and `INTERFACES' has profiles enabled
|
||||
if [[ -z $interface && ${INTERFACES[@]##!*} ]]; then
|
||||
return 0 # need legacy
|
||||
fi
|
||||
|
||||
|
@ -17,37 +18,30 @@ need_legacy() {
|
|||
}
|
||||
|
||||
deprecated() {
|
||||
printf "${C_FAIL}Warning:${C_CLEAR} This functionality is deprecated.\n"
|
||||
printf "${C_FAIL}Warning:${C_CLEAR} Your network settings are 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
|
||||
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
|
||||
ip addr add $address/${netmask:-24} broadcast ${broadcast:-+} dev $interface || return 1
|
||||
[[ $gateway ]] && { ip route add default via $gateway || return 1; }
|
||||
else
|
||||
/sbin/dhcpcd $DHCPCD_ARGS $interface || return 1
|
||||
dhcpcd $DHCPCD_ARGS $interface || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
network_down() {
|
||||
if [[ -f /var/run/dhcpcd-$interface.pid ]]; then
|
||||
/sbin/dhcpcd -k $interface || return 1
|
||||
dhcpcd -k $interface || return 1
|
||||
else
|
||||
/usr/sbin/ip route del default || return 1
|
||||
/usr/sbin/ip addr flush dev $interface || return 1
|
||||
ip addr flush dev $interface || return 1
|
||||
fi
|
||||
|
||||
/usr/sbin/ip link set dev $interface down || return 1
|
||||
ip link set dev $interface down || return 1
|
||||
}
|
||||
|
||||
ifup() {
|
||||
|
@ -65,17 +59,17 @@ ifup() {
|
|||
ifname=${ifcfg%% *}
|
||||
fi
|
||||
|
||||
/sbin/ifconfig $ifname up
|
||||
ifconfig $ifname up
|
||||
|
||||
wi_up $1 || return 1
|
||||
|
||||
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
|
||||
/sbin/dhcpcd $DHCPCD_ARGS ${1}
|
||||
rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
|
||||
rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
|
||||
dhcpcd $DHCPCD_ARGS ${1}
|
||||
else
|
||||
/sbin/ifconfig $ifcfg
|
||||
ifconfig $ifcfg
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -84,7 +78,7 @@ wi_up() {
|
|||
|
||||
[[ ${!iwcfg} ]] || return 0
|
||||
|
||||
/usr/sbin/iwconfig ${!iwcfg}
|
||||
iwconfig ${!iwcfg}
|
||||
[[ $WIRELESS_TIMEOUT ]] || WIRELESS_TIMEOUT=2
|
||||
sleep $WIRELESS_TIMEOUT
|
||||
|
||||
|
@ -105,10 +99,10 @@ ifdown() {
|
|||
fi
|
||||
|
||||
if [[ $ifcfg = dhcp && -f /var/run/dhcpcd-${1}.pid ]]; then
|
||||
/sbin/dhcpcd -k ${1} >/dev/null 2>&1
|
||||
dhcpcd -k ${1} >/dev/null 2>&1
|
||||
fi
|
||||
# Always bring the interface itself down
|
||||
/sbin/ifconfig ${1} down >/dev/null 2>&1
|
||||
ifconfig ${1} down >/dev/null 2>&1
|
||||
}
|
||||
|
||||
iflist() {
|
||||
|
@ -131,9 +125,9 @@ rtup() {
|
|||
fi
|
||||
|
||||
if [[ $routecfg =~ :: ]]; then
|
||||
/sbin/route -A inet6 add $routecfg
|
||||
route -A inet6 add $routecfg
|
||||
else
|
||||
/sbin/route add $routecfg
|
||||
route add $routecfg
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -146,9 +140,9 @@ rtdown() {
|
|||
fi
|
||||
|
||||
if [[ $routecfg =~ :: ]]; then
|
||||
/sbin/route -A inet6 del $routecfg
|
||||
route -A inet6 del $routecfg
|
||||
else
|
||||
/sbin/route del $routecfg
|
||||
route del $routecfg
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -168,7 +162,7 @@ bond_up() {
|
|||
if [[ $ifline = ${ifline#!} ]]; then
|
||||
bondcfg="bond_$ifline"
|
||||
if [[ ${!bondcfg} ]]; then
|
||||
/sbin/ifenslave $ifline ${!bondcfg} || error=1
|
||||
ifenslave $ifline ${!bondcfg} || error=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -178,7 +172,7 @@ bond_down() {
|
|||
for ifline in ${BOND_INTERFACES[@]}; do
|
||||
if [[ $ifline = ${ifline#!} ]]; then
|
||||
bondcfg="bond_$ifline"
|
||||
/sbin/ifenslave -d $ifline ${!bondcfg} || error=1
|
||||
ifenslave -d $ifline ${!bondcfg} || error=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -187,11 +181,11 @@ bridge_up() {
|
|||
for br in ${BRIDGE_INTERFACES[@]}; do
|
||||
if [[ $br = ${br#!} ]]; then
|
||||
# if the bridge already exists, remove it
|
||||
if [[ $(/sbin/ifconfig $br 2>/dev/null) ]]; then
|
||||
/sbin/ifconfig $br down
|
||||
/usr/sbin/brctl delbr $br
|
||||
if [[ $(ifconfig $br 2>/dev/null) ]]; then
|
||||
ifconfig $br down
|
||||
brctl delbr $br
|
||||
fi
|
||||
/usr/sbin/brctl addbr $br
|
||||
brctl addbr $br
|
||||
brifs="bridge_$br"
|
||||
for brif in ${!brifs}; do
|
||||
if [[ $brif = ${brif#!} ]]; then
|
||||
|
@ -199,12 +193,12 @@ bridge_up() {
|
|||
if [[ $brif = $ifline && $ifline = ${ifline#!} ]]; then
|
||||
ifup $ifline
|
||||
bondcfg="bond_$ifline"
|
||||
/sbin/ifenslave $ifline ${!bondcfg} || error=1
|
||||
ifenslave $ifline ${!bondcfg} || error=1
|
||||
unset bond_$ifline
|
||||
fi
|
||||
done
|
||||
|
||||
/usr/sbin/brctl addif $br $brif || error=1
|
||||
brctl addif $br $brif || error=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -214,7 +208,7 @@ bridge_up() {
|
|||
bridge_down() {
|
||||
for br in ${BRIDGE_INTERFACES[@]}; do
|
||||
if [[ $br = ${br#!} ]]; then
|
||||
/usr/sbin/brctl delbr $br
|
||||
brctl delbr $br
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -294,12 +288,12 @@ case "$1" in
|
|||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
/bin/sleep 2
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
ifup|ifdown|iflist|rtup|rtdown|rtlist)
|
||||
# deprecation check
|
||||
need_legacy && deprecated
|
||||
deprecated
|
||||
$1 $2
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -9,15 +9,16 @@
|
|||
# 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
|
||||
# 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.
|
||||
# Note: Using "localtime" is discouraged, using "" makes hwclock fall back
|
||||
# to the value in /var/lib/hwclock/adjfile
|
||||
# TIMEZONE: timezones are found in /usr/share/zoneinfo
|
||||
# Note: if unset, the value in /etc/localtime is used unchanged
|
||||
# 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"
|
||||
DAEMON_LOCALE="no"
|
||||
|
@ -27,7 +28,6 @@ KEYMAP="us"
|
|||
CONSOLEFONT=
|
||||
CONSOLEMAP=
|
||||
USECOLOR="yes"
|
||||
VERBOSE="3"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# HARDWARE
|
||||
|
@ -66,13 +66,15 @@ HOSTNAME="alarm"
|
|||
# Wired network setup
|
||||
# - interface: name of device (required)
|
||||
# - address: IP address (leave blank for DHCP)
|
||||
# - netmask: subnet mask (ignored for DHCP)
|
||||
# - netmask: subnet mask (ignored for DHCP) (optional, defaults to 255.255.255.0)
|
||||
# - broadcast: broadcast address (ignored for DHCP) (optional)
|
||||
# - gateway: default route (ignored for DHCP)
|
||||
#
|
||||
#
|
||||
# Static IP example
|
||||
# interface=eth0
|
||||
# address=192.168.0.2
|
||||
# netmask=255.255.255.0
|
||||
# broadcast=192.168.0.255
|
||||
# gateway=192.168.0.1
|
||||
#
|
||||
# DHCP example
|
||||
|
@ -84,6 +86,7 @@ HOSTNAME="alarm"
|
|||
interface=eth0
|
||||
address=
|
||||
netmask=
|
||||
broadcast=
|
||||
gateway=
|
||||
|
||||
# Setting this to "yes" will skip network shutdown.
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
NEED_ROOT=0 # this script can be run without be root
|
||||
. /etc/rc.conf
|
||||
. /etc/rc.d/functions
|
||||
|
||||
usage() {
|
||||
local name=${0##*/}
|
||||
cat >&2 << EOF
|
||||
usage: $name action daemon ...
|
||||
usage: $name <action> <daemon> [daemon] ...
|
||||
$name list [started|stopped]
|
||||
$name help
|
||||
|
||||
<daemon> is the name of a script in /etc/rc.d
|
||||
<action> can be a start, stop, restart, reload, status, ...
|
||||
WARNING: initscripts are free to implement or not the above actions.
|
||||
|
||||
e.g: $name list
|
||||
$name list started
|
||||
$name help
|
||||
$name start sshd gpm
|
||||
EOF
|
||||
|
@ -23,13 +31,16 @@ case $1 in
|
|||
usage
|
||||
;;
|
||||
list)
|
||||
shift
|
||||
cd /etc/rc.d/
|
||||
for d in *; do
|
||||
have_daemon "$d" || continue
|
||||
# print running / stopped satus
|
||||
if ! ck_daemon "$d"; then
|
||||
[[ "$1" == stopped ]] && continue
|
||||
printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
|
||||
else
|
||||
[[ "$1" == started ]] && continue
|
||||
printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
|
||||
fi
|
||||
# print auto / manual status
|
||||
|
@ -40,7 +51,7 @@ case $1 in
|
|||
fi
|
||||
printf " ${C_CLEAR}$d\n"
|
||||
done
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
# check min args count
|
||||
(( $# < 2 )) && usage
|
||||
|
@ -56,12 +67,13 @@ case $1 in
|
|||
cd /
|
||||
for i; do
|
||||
if [[ -x "/etc/rc.d/$i" ]]; then
|
||||
/usr/bin/env -i "${ENV[@]}" "/etc/rc.d/$i" "$action"
|
||||
env -i "${ENV[@]}" "/etc/rc.d/$i" "$action"
|
||||
else
|
||||
printf "${C_OTHER}:: ${C_FAIL}Error: ${C_DONE}Daemon script $i does not exist.\n"
|
||||
printf "${C_OTHER}:: ${C_FAIL}Error: ${C_DONE}Daemon script $i does not exist.${C_CLEAR}\n"
|
||||
fi
|
||||
(( ret += !! $? )) # clamp exit value to 0/1
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $ret
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
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 ]] && sysctl -q -p &>/dev/null
|
||||
|
||||
# Start daemons
|
||||
for daemon in "${DAEMONS[@]}"; do
|
||||
|
@ -20,14 +20,10 @@ for daemon in "${DAEMONS[@]}"; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ -x /etc/rc.local ]]; then
|
||||
/etc/rc.local
|
||||
fi
|
||||
[[ -x /etc/rc.local ]] && /etc/rc.local
|
||||
|
||||
run_hook multi_end
|
||||
|
||||
/bin/touch /var/log/boot
|
||||
kill `/bin/cat /run/bootlogd.pid`
|
||||
/bin/rm /run/bootlogd.pid
|
||||
bootlogd_stop
|
||||
|
||||
# vim: set ts=2 sw=2 noet:
|
||||
|
|
|
@ -6,88 +6,84 @@
|
|||
. /etc/rc.conf
|
||||
. /etc/rc.d/functions
|
||||
|
||||
run_hook shutdown_start
|
||||
|
||||
# avoid staircase effect
|
||||
/bin/stty onlcr
|
||||
stty onlcr
|
||||
|
||||
echo " "
|
||||
printhl "Initiating Shutdown..."
|
||||
echo " "
|
||||
|
||||
run_hook shutdown_start
|
||||
|
||||
[[ -x /etc/rc.local.shutdown ]] && /etc/rc.local.shutdown
|
||||
|
||||
kill_everything shutdown
|
||||
stop_all_daemons
|
||||
|
||||
run_hook shutdown_prekillall
|
||||
|
||||
kill_all
|
||||
|
||||
run_hook shutdown_postkillall
|
||||
|
||||
stat_busy "Saving Random Seed"
|
||||
RANDOM_SEED=/var/lib/misc/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
|
||||
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
|
||||
RANDOM_SEED=/var/lib/misc/random-seed
|
||||
install -TDm 0600 <(:) $RANDOM_SEED
|
||||
POOL_FILE=/proc/sys/kernel/random/poolsize
|
||||
if [[ -r $POOL_FILE ]]; then
|
||||
read POOL_SIZE < $POOL_FILE
|
||||
else
|
||||
POOL_SIZE=512
|
||||
fi
|
||||
dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &>/dev/null
|
||||
stat_done
|
||||
|
||||
if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
|
||||
/bin/rm -f /etc/localtime
|
||||
[[ $TIMEZONE ]] &&
|
||||
status "Saving Time Zone" \
|
||||
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
fi
|
||||
cp --remove-destination "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
|
||||
# Write to wtmp file before unmounting
|
||||
/sbin/halt -w
|
||||
halt -w
|
||||
|
||||
status "Deactivating Swap" /sbin/swapoff -a
|
||||
status "Deactivating Swap" swapoff -a
|
||||
|
||||
# stop monitoring of lvm2 groups before unmounting filesystems
|
||||
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
|
||||
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
|
||||
status "Deactivating monitoring of LVM2 groups" \
|
||||
/sbin/vgchange --monitor n >/dev/null 2>&1
|
||||
fi
|
||||
vgchange --monitor n &>/dev/null
|
||||
|
||||
stat_busy "Unmounting Filesystems"
|
||||
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
|
||||
# if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
|
||||
status "Unmounting Filesystems" \
|
||||
umount -a -r -t nodevtmpfs,notmpfs,nosysfs,noproc,nodevpts -O no_netdev
|
||||
|
||||
run_hook shutdown_postumount
|
||||
|
||||
# Kill non-root encrypted partition mappings
|
||||
if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
|
||||
if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
|
||||
stat_busy "Deactivating encrypted volumes:"
|
||||
# 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_lock() {
|
||||
stat_append "${1}.."
|
||||
if $CS remove "$1" >/dev/null 2>&1; then
|
||||
stat_append "ok "
|
||||
else
|
||||
stat_append "failed "
|
||||
fi
|
||||
}
|
||||
read_crypttab do_lock
|
||||
# Maybe someone has LVM on an encrypted block device
|
||||
# executing an extra vgchange is errorless
|
||||
[[ $USELVM = [Yy][Ee][Ss] ]] && vgchange --sysinit -a n &>/dev/null
|
||||
do_lock() {
|
||||
stat_append "${1}.."
|
||||
if $CS remove "$1" &>/dev/null; then
|
||||
stat_append "ok "
|
||||
else
|
||||
stat_append "failed "
|
||||
fi
|
||||
}
|
||||
read_crypttab do_lock
|
||||
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
|
||||
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
|
||||
status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null
|
||||
|
||||
status "Remounting Root Filesystem Read-only" /bin/mount -n -o remount,ro /
|
||||
status "Remounting Root Filesystem Read-only" \
|
||||
mount -n -o remount,ro /
|
||||
|
||||
run_hook shutdown_poweroff
|
||||
|
||||
# PlugApps: Turn LEDs off
|
||||
# ALARM: Turn LEDs off
|
||||
|
||||
/usr/bin/find /sys/ -path *led* -name *trigger* -exec sh -c '/bin/echo none > {}' \;
|
||||
|
||||
|
@ -95,12 +91,12 @@ run_hook shutdown_poweroff
|
|||
printsep
|
||||
if [[ $RUNLEVEL = 0 ]]; then
|
||||
printhl "${C_H2}POWER OFF"
|
||||
/sbin/poweroff -d -f -h -i
|
||||
poweroff -d -f -h -i
|
||||
else
|
||||
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
|
||||
/sbin/reboot -d -f -i
|
||||
[[ -x $(type -P kexec) ]] && kexec -e &>/dev/null
|
||||
reboot -d -f -i
|
||||
fi
|
||||
|
||||
# End of file
|
||||
|
|
|
@ -9,48 +9,36 @@
|
|||
run_hook single_start
|
||||
|
||||
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 trigger --action=add --type=subsystems
|
||||
/sbin/udevadm trigger --action=add --type=devices
|
||||
stat_done
|
||||
fi
|
||||
stop_all_daemons
|
||||
|
||||
# Wait for udev uevents
|
||||
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
|
||||
status "Waiting for UDev uevents to be processed" \
|
||||
/sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
|
||||
fi
|
||||
run_hook single_prekillall
|
||||
|
||||
run_hook single_udevsettled
|
||||
kill_all
|
||||
|
||||
# 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
|
||||
elif [[ -x /etc/rc.d/syslogd ]]; then
|
||||
/etc/rc.d/syslogd start
|
||||
[[ -x /etc/rc.d/klogd ]] && /etc/rc.d/klogd start
|
||||
fi
|
||||
run_hook single_postkillall
|
||||
|
||||
# start up our mini logger until syslog takes over
|
||||
minilogd
|
||||
|
||||
# Start/trigger UDev, load MODULES and settle UDev
|
||||
udevd_modprobe single
|
||||
|
||||
# Removing leftover files
|
||||
remove_leftover
|
||||
fi
|
||||
|
||||
run_hook single_end
|
||||
|
||||
bootlogd_stop
|
||||
|
||||
if [[ $RUNLEVEL = 1 ]]; then
|
||||
printsep
|
||||
printhl "Entering single-user mode..."
|
||||
# make sure /dev/initctl is in place
|
||||
kill -HUP 1
|
||||
exec /sbin/init -t1 S
|
||||
exec 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 sw=2 noet:
|
||||
|
|
|
@ -11,139 +11,99 @@ printhl "Arch Linux ARM\n"
|
|||
printhl "${C_H2}http://www.archlinuxarm.org"
|
||||
printsep
|
||||
|
||||
run_hook sysinit_start
|
||||
|
||||
# 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"
|
||||
|
||||
# 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 -n /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 -n /dev/shm &> /dev/null \
|
||||
|| /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
|
||||
mountpoint -q /proc || mount -n -t proc proc /proc -o nosuid,noexec,nodev
|
||||
mountpoint -q /sys || mount -n -t sysfs sys /sys -o nosuid,noexec,nodev
|
||||
mountpoint -q /run || mount -n -t tmpfs run /run -o mode=0755,size=10M,nosuid,nodev
|
||||
mountpoint -q /dev || mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid &>/dev/null \
|
||||
|| mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
|
||||
mkdir -p -m 1777 /run/lock
|
||||
mkdir -p /dev/{pts,shm}
|
||||
mountpoint -q /dev/pts || mount -n /dev/pts &>/dev/null \
|
||||
|| mount -n -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
|
||||
mountpoint -q /dev/shm || mount -n /dev/shm &>/dev/null \
|
||||
|| 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 /
|
||||
findmnt / --options ro &>/dev/null ||
|
||||
status "Mounting Root Read-Only" mount -n -o remount,ro /
|
||||
|
||||
run_hook sysinit_start
|
||||
|
||||
# start up our mini logger until syslog takes over
|
||||
/sbin/minilogd
|
||||
/sbin/bootlogd -p /run/bootlogd.pid
|
||||
minilogd
|
||||
bootlogd -p /run/bootlogd.pid
|
||||
|
||||
# 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"
|
||||
HWCLOCK_PARAMS="--systz"
|
||||
case $HARDWARECLOCK in
|
||||
UTC) HWCLOCK_PARAMS+=" --utc";;
|
||||
localtime) HWCLOCK_PARAMS+=" --localtime";;
|
||||
"") ;;
|
||||
UTC) HWCLOCK_PARAMS+=" --utc --noadjfile";;
|
||||
localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile";;
|
||||
*) HWCLOCK_PARAMS="";;
|
||||
esac
|
||||
|
||||
if [[ $HWCLOCK_PARAMS ]]; then
|
||||
# enable rtc access
|
||||
/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 || -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
|
||||
done
|
||||
fi
|
||||
stat_busy "Adjusting system time and setting kernel timezone"
|
||||
# enable rtc access
|
||||
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 || -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"
|
||||
mknod /dev/rtc c $major $minor
|
||||
done
|
||||
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 may occur in rc.d/hwclock to match rc.conf.
|
||||
if [[ -f /etc/localtime ]]; then
|
||||
/sbin/hwclock $HWCLOCK_PARAMS --noadjfile
|
||||
fi
|
||||
# Adjust the system time for timezone offset if rtc is not in UTC
|
||||
# 1. Make creation time on udev nodes sane (FS#8665)
|
||||
# 2. Filesystem checks can depend on system time
|
||||
# 3. This also sets the kernel time zone, used by e.g. vfat
|
||||
# If TIMEZONE is not set in rc.conf, the timezone stored in /etc/localtime
|
||||
# is used. If HARDWARECLOCK is not set in rc.conf, the value in
|
||||
# /var/lib/hwclock/adjfile is used (in this case /var can not be a separate
|
||||
# partition).
|
||||
TZ=$TIMEZONE hwclock $HWCLOCK_PARAMS && stat_done || stat_fail
|
||||
fi
|
||||
|
||||
status "Starting UDev Daemon" /sbin/udevd --daemon
|
||||
|
||||
run_hook sysinit_udevlaunched
|
||||
|
||||
# Trigger udev uevents
|
||||
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
|
||||
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 /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
|
||||
# Start/trigger UDev, load MODULES and settle UDev
|
||||
udevd_modprobe sysinit
|
||||
|
||||
# bring up the loopback interface
|
||||
[[ -d /sys/class/net/lo ]] && \
|
||||
status "Bringing up loopback interface" /sbin/ip link set up dev lo
|
||||
[[ -d /sys/class/net/lo ]] &&
|
||||
status "Bringing up loopback interface" ip link set up dev lo
|
||||
|
||||
# FakeRAID devices detection
|
||||
if [[ $USEDMRAID =~ yes|YES && -x /sbin/dmraid ]]; then
|
||||
status "Activating FakeRAID arrays" /sbin/dmraid -i -ay
|
||||
fi
|
||||
[[ $USEDMRAID = [Yy][Ee][Ss] && -x $(type -P dmraid) ]] &&
|
||||
status "Activating FakeRAID arrays" dmraid -i -ay
|
||||
|
||||
# BTRFS devices detection
|
||||
if [[ $USEBTRFS =~ yes|YES && -x /sbin/btrfs ]]; then
|
||||
status "Activating BTRFS volumes" /sbin/btrfs device scan
|
||||
fi
|
||||
[[ $USEBTRFS = [Yy][Ee][Ss] && -x $(type -P btrfs) ]] &&
|
||||
status "Activating BTRFS volumes" btrfs device scan
|
||||
|
||||
# Activate LVM2 groups if any
|
||||
activate_vgs
|
||||
|
||||
# Set up non-root encrypted partition mappings
|
||||
if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
|
||||
/sbin/modprobe -q dm-crypt 2>/dev/null
|
||||
if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
|
||||
stat_busy "Unlocking encrypted volumes:"
|
||||
modprobe -q dm-crypt 2>/dev/null
|
||||
do_unlock() {
|
||||
# $1 = requested name
|
||||
# $2 = source device
|
||||
# $3 = password
|
||||
# $4 = options
|
||||
stat_append "${1}.."
|
||||
local open=create a="$1" b="$2" failed=0
|
||||
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"
|
||||
a=$2
|
||||
b=$1
|
||||
fi
|
||||
case $3 in
|
||||
SWAP)
|
||||
|
@ -158,50 +118,48 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
|
|||
#
|
||||
# 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
|
||||
blkid -p "$2" &>/dev/null
|
||||
(( $? == 2 )) && _overwriteokay=1
|
||||
fi
|
||||
if [[ $_overwriteokay -eq 0 ]]; then
|
||||
if (( _overwriteokay == 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
|
||||
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
|
||||
local ckdev=${3%%:*}
|
||||
local cka=${3#*:}
|
||||
local ckb=${cka#*:}
|
||||
local cka=${cka%:*}
|
||||
local ckfile=/dev/ckfile
|
||||
local 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};;
|
||||
mkdir ${ckdir}
|
||||
mount -r -t ${cka} ${ckdev} ${ckdir}
|
||||
dd if=${ckdir}/${ckb} of=${ckfile} >/dev/null 2>&1
|
||||
umount ${ckdir}
|
||||
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;;
|
||||
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
|
||||
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
|
||||
if (( $? )); then
|
||||
failed=1
|
||||
stat_append "failed "
|
||||
else
|
||||
|
@ -210,173 +168,112 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
|
|||
return $failed
|
||||
}
|
||||
crypto_unlocked=0
|
||||
if read_crypttab do_unlock; then
|
||||
stat_done
|
||||
else
|
||||
stat_fail
|
||||
fi
|
||||
if [[ ${crypto_unlocked} -eq 1 ]]; then
|
||||
# Maybe someone has LVM on an encrypted block device
|
||||
activate_vgs
|
||||
fi
|
||||
read_crypttab do_unlock && stat_done || stat_fail
|
||||
# Maybe someone has LVM on an encrypted block device
|
||||
(( crypto_unlocked == 1 )) && activate_vgs
|
||||
fi
|
||||
|
||||
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs"
|
||||
|
||||
if [[ -x /sbin/fsck ]]; then
|
||||
# Check filesystems
|
||||
[[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-- -f"
|
||||
declare -r FORCEFSCK
|
||||
run_hook sysinit_prefsck
|
||||
if [[ -x $(type -P 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 > 1)); then
|
||||
stat_fail
|
||||
fi
|
||||
run_hook sysinit_postfsck
|
||||
if (( ( fsckret & 2) == 2)); then
|
||||
echo
|
||||
echo "********************** REBOOT REQUIRED *********************"
|
||||
echo "* *"
|
||||
echo "* The system will be rebooted automatically in 15 seconds. *"
|
||||
echo "* *"
|
||||
echo "************************************************************"
|
||||
echo
|
||||
/bin/sleep 15
|
||||
fsck_reboot
|
||||
elif ((fsckret > 1 && fsckret != 32)); then
|
||||
echo
|
||||
echo "***************** FILESYSTEM CHECK FAILED ****************"
|
||||
echo "* *"
|
||||
echo "* Please repair manually and reboot. Note that the root *"
|
||||
echo "* file system is currently mounted read-only. To remount *"
|
||||
echo "* it read-write type: mount -n -o remount,rw / *"
|
||||
echo "* When you exit the maintenance shell the system will *"
|
||||
echo "* reboot automatically. *"
|
||||
echo "* *"
|
||||
echo "************************************************************"
|
||||
echo
|
||||
/sbin/sulogin -p
|
||||
fsck_reboot
|
||||
fi
|
||||
stat_done
|
||||
fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}"
|
||||
declare -r fsckret=$?
|
||||
(( fsckret <= 1 )) && stat_done || stat_fail
|
||||
else
|
||||
declare -r fsckret=0
|
||||
fi
|
||||
run_hook sysinit_postfsck
|
||||
|
||||
# Single-user login and/or automatic reboot if needed
|
||||
fsck_reboot $fsckret
|
||||
|
||||
status "Remounting Root Read/Write" \
|
||||
mount -n -o remount,rw /
|
||||
|
||||
# don't touch /etc/mtab if it is a symlink to /proc/self/mounts
|
||||
if [[ ! -L /etc/mtab ]]; then
|
||||
stat_busy "Creating mtab"
|
||||
if [[ -x $(type -P findmnt) && -e /proc/self/mountinfo ]]; then
|
||||
findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab
|
||||
else
|
||||
cat /proc/mounts >| /etc/mtab
|
||||
fi
|
||||
(( $? == 0 )) && stat_done || stat_fail
|
||||
fi
|
||||
|
||||
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
|
||||
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
|
||||
# now mount all the local filesystems
|
||||
run_hook sysinit_premount
|
||||
status "Mounting Local Filesystems" \
|
||||
mount_all
|
||||
run_hook sysinit_postmount
|
||||
|
||||
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
|
||||
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
|
||||
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
|
||||
status "Activating monitoring of LVM2 groups" \
|
||||
/sbin/vgchange --monitor y >/dev/null
|
||||
fi
|
||||
vgchange --monitor y >/dev/null
|
||||
|
||||
status "Activating Swap" /sbin/swapon -a
|
||||
status "Activating Swap" swapon -a
|
||||
|
||||
if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
|
||||
/bin/rm -f /etc/localtime
|
||||
[[ $TIMEZONE ]] &&
|
||||
status "Configuring Time Zone" \
|
||||
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
fi
|
||||
cp --remove-destination "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
||||
|
||||
RANDOM_SEED=/var/lib/misc/random-seed
|
||||
if [[ -f $RANDOM_SEED ]]; then
|
||||
[[ -f $RANDOM_SEED ]] &&
|
||||
status "Initializing Random Seed" \
|
||||
/bin/cat $RANDOM_SEED > /dev/urandom
|
||||
fi
|
||||
cp $RANDOM_SEED /dev/urandom
|
||||
|
||||
stat_busy "Removing Leftover Files"
|
||||
/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
|
||||
/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 -m1777 /tmp/.{X11,ICE}-unix
|
||||
stat_done
|
||||
# Remove leftover files
|
||||
remove_leftover
|
||||
|
||||
if [[ $HOSTNAME ]]; then
|
||||
stat_busy "Setting Hostname: $HOSTNAME"
|
||||
echo $HOSTNAME > /proc/sys/kernel/hostname
|
||||
stat_done
|
||||
stat_busy "Setting Hostname: $HOSTNAME"
|
||||
echo "$HOSTNAME" >| /proc/sys/kernel/hostname && stat_done || stat_fail
|
||||
fi
|
||||
|
||||
# Flush old locale settings and set user defined locale
|
||||
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
|
||||
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
|
||||
stat_done
|
||||
echo "export LANG=$LOCALE" > /etc/profile.d/locale.sh &&
|
||||
chmod 0755 /etc/profile.d/locale.sh && stat_done || stat_fail
|
||||
|
||||
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,
|
||||
# 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}
|
||||
done
|
||||
echo 1 > /sys/module/vt/parameters/default_utf8
|
||||
stat_done
|
||||
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
|
||||
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,
|
||||
# but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
|
||||
for i in /dev/tty[0-9]*; do
|
||||
kbd_mode -u < ${i}
|
||||
printf "\e%%G" > ${i}
|
||||
done
|
||||
echo 1 >| /sys/module/vt/parameters/default_utf8
|
||||
stat_done
|
||||
else
|
||||
stat_busy "Setting Consoles to legacy mode"
|
||||
# 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}
|
||||
done
|
||||
echo 0 > /sys/module/vt/parameters/default_utf8
|
||||
stat_done
|
||||
[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
|
||||
stat_busy "Setting Consoles to legacy mode"
|
||||
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
|
||||
for i in /dev/tty[0-9]*; do
|
||||
kbd_mode -a < ${i}
|
||||
printf "\e%%@" > ${i}
|
||||
done
|
||||
echo 0 >| /sys/module/vt/parameters/default_utf8
|
||||
stat_done
|
||||
fi
|
||||
[[ $KEYMAP ]] &&
|
||||
status "Loading Keyboard Map: $KEYMAP" loadkeys -q $KEYMAP
|
||||
|
||||
# Set console font if required
|
||||
set_consolefont
|
||||
|
||||
# Adding persistent network/cdrom generated rules
|
||||
# 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
|
||||
status "Adding persistent $f udev rules"
|
||||
/bin/cat "/run/udev/tmp-rules--70-persistent-$f.rules" >> "/etc/udev/rules.d/70-persistent-$f.rules"
|
||||
done
|
||||
|
||||
/bin/dmesg >| /var/log/dmesg.log
|
||||
stat_busy "Saving dmesg Log"
|
||||
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
|
||||
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then
|
||||
install -Tm 0600 <( dmesg ) /var/log/dmesg.log
|
||||
else
|
||||
install -Tm 0644 <( dmesg ) /var/log/dmesg.log
|
||||
fi
|
||||
(( $? == 0 )) && stat_done || stat_fail
|
||||
|
||||
run_hook sysinit_end
|
||||
|
||||
|
|
20
core/initscripts/tmpfiles.conf
Normal file
20
core/initscripts/tmpfiles.conf
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# /usr/lib/tmpfiles.d/arch.conf
|
||||
#
|
||||
|
||||
D /tmp 1777 root root
|
||||
D /run/daemons 0755 root root
|
||||
|
||||
d /tmp/.X11-unix 1777 root root
|
||||
d /tmp/.ICE-unix 1777 root root
|
||||
d /tmp/.XIM-unix 1777 root root
|
||||
d /tmp/.font-unix 1777 root root
|
||||
d /tmp/.Test-unix 1777 root root
|
||||
|
||||
F /var/run/utmp 0664 root utmp
|
||||
|
||||
r /tmp/.X[0-9]-lock
|
||||
r /etc/nologin
|
||||
r /etc/shutdownpid
|
||||
r /forcefsck
|
||||
|
|
@ -15,9 +15,12 @@ _rc.d () {
|
|||
curcontext="${curcontext%:*:*}:rc.d-${action}:"
|
||||
|
||||
case $action in
|
||||
list|help)
|
||||
help)
|
||||
_arguments "*: :"
|
||||
;;
|
||||
list)
|
||||
_arguments "2: :(started stopped)"
|
||||
;;
|
||||
start)
|
||||
_arguments "*: :($(comm -23 <(echo /etc/rc.d/*(N-*:t)|tr ' ' '\n') <(echo /run/daemons/*(N:t)|tr ' ' '\n')))"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue