aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-11-03 22:26:54 +0000
committerColin Guthrie <colin@mageia.org>2011-11-03 22:26:54 +0000
commit1e6179bf54cbc84b4ad33480e7f2f713418bb28a (patch)
tree794b2654be506d551421bcc47d3ad97822e2861c /rc.d/init.d
parent87589b49d1543595188dcb26aa5a09d33e5e0a4e (diff)
parent6ce3e4700baa4e37e6b16e4160c00b2ebea58d81 (diff)
downloadinitscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar
initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.gz
initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.bz2
initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.xz
initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.zip
Merge commit 'initscripts-9.34-1' into mga-34
This brings our fully patched initscripts branch up to version 9.34. Some code was not easily merged and thus not all functionality relating to multiple IP addresses per interface were merged in. Conflicts: Makefile lang.csh lang.sh prefdm rc.d/init.d/functions rc.d/init.d/netfs rc.d/init.d/network rc.d/rc rc.d/rc.local rc.d/rc.sysinit service sysconfig.txt sysconfig/network-scripts/ifdown-eth sysconfig/network-scripts/ifup-eth sysconfig/network-scripts/ifup-ipv6 sysconfig/network-scripts/ifup-sit sysconfig/network-scripts/ifup-tunnel sysconfig/network-scripts/network-functions systemd/system/fedora-sysinit-unhack.service
Diffstat (limited to 'rc.d/init.d')
-rw-r--r--rc.d/init.d/functions88
-rwxr-xr-xrc.d/init.d/halt3
-rw-r--r--rc.d/init.d/netconsole2
-rwxr-xr-xrc.d/init.d/netfs15
-rwxr-xr-xrc.d/init.d/network14
5 files changed, 77 insertions, 45 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 6f989ba4..43b3abe4 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -64,17 +64,23 @@ systemctl_redirect () {
[ -z "${COLUMNS:-}" ] && COLUMNS=80
function load_i18_settings() {
- if [ -f /etc/sysconfig/i18n -a -z "$NOLOCALE" ]; then
- . /etc/sysconfig/i18n
- if [ "$CONSOLETYPE" != "pty" ]; then
- [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANG=C
- [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANGUAGE=C
- fi
- if [ -z "$GP_LANG" ]; then
- [ -n "$LC_CTYPE" ] && GP_LANG=$LC_CTYPE || GP_LANG=$LC_MESSAGES
- fi
- if [ -z "$GP_LANGUAGE" ]; then
- [ -n "$LANGUAGE" ] && GP_LANGUAGE=$LANGUAGE || GP_LANGUAGE=$GP_LANG
+ if [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ]; then
+ if [ -z "$NOLOCALE" ]; then
+ if [ -f /etc/locale.conf ]; then
+ . /etc/locale.conf
+ else
+ . /etc/sysconfig/i18n
+ fi
+ if [ "$CONSOLETYPE" != "pty" ]; then
+ [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANG=C
+ [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANGUAGE=C
+ fi
+ if [ -z "$GP_LANG" ]; then
+ [ -n "$LC_CTYPE" ] && GP_LANG=$LC_CTYPE || GP_LANG=$LC_MESSAGES
+ fi
+ if [ -z "$GP_LANGUAGE" ]; then
+ [ -n "$LANGUAGE" ] && GP_LANGUAGE=$LANGUAGE || GP_LANGUAGE=$GP_LANG
+ fi
fi
fi
}
@@ -198,17 +204,17 @@ __fgrep() {
return 1
}
-# __umount_loop awk_program fstab_file first_msg retry_msg umount_args
+# __umount_loop awk_program fstab_file first_msg retry_msg retry_umount_args
# awk_program should process fstab_file and return a list of fstab-encoded
# paths; it doesn't have to handle comments in fstab_file.
__umount_loop() {
- local remaining sig=
+ local remaining sig=-15
local retry=3 count
remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r)
while [ -n "$remaining" -a "$retry" -gt 0 ]; do
if [ "$retry" -eq 3 ]; then
- action "$3" fstab-decode umount $5 $remaining
+ action "$3" fstab-decode umount $remaining
else
action "$4" fstab-decode umount $5 $remaining
fi
@@ -230,7 +236,7 @@ __umount_loop() {
# Similar to __umount loop above, specialized for loopback devices
__umount_loopback_loop() {
- local remaining devremaining sig=
+ local remaining devremaining sig=-15
local retry=3
remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" && $2 !~ /^\/live\// {print $2}' /proc/mounts)
@@ -387,7 +393,7 @@ daemon() {
# A function to stop a program.
killproc() {
- local RC killlevel= base pid pid_file= delay
+ local RC killlevel= base pid pid_file= delay try
RC=0; delay=3
# Test syntax.
@@ -432,12 +438,18 @@ killproc() {
if checkpid $pid 2>&1; then
# TERM first, then KILL if not dead
kill -TERM $pid >/dev/null 2>&1
- usleep 100000
- if checkpid $pid && sleep 1 &&
- checkpid $pid && sleep $delay &&
- checkpid $pid ; then
- kill -KILL $pid >/dev/null 2>&1
- usleep 100000
+ usleep 50000
+ if checkpid $pid ; then
+ try=0
+ while [ $try -lt $delay ] ; do
+ checkpid $pid || break
+ sleep 1
+ let try+=1
+ done
+ if checkpid $pid ; then
+ kill -KILL $pid >/dev/null 2>&1
+ usleep 50000
+ fi
fi
fi
checkpid $pid
@@ -827,6 +839,15 @@ is_false() {
return 1
}
+# Apply sysctl settings, including files in /etc/sysctl.d
+apply_sysctl() {
+ sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
+ for file in /etc/sysctl.d/* ; do
+ is_ignored_file "$file" && continue
+ test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1
+ done
+}
+
key_is_random() {
[ "$1" = "/dev/urandom" -o "$1" = "/dev/hw_random" \
-o "$1" = "/dev/random" ]
@@ -846,7 +867,7 @@ find_crypto_mount_point() {
# Because of a chicken/egg problem, init_crypto must be run twice. /var may be
# encrypted but /var/lib/random-seed is needed to initialize swap.
init_crypto() {
- local have_random dst src key opt mode owner params makeswap skip arg opt
+ local have_random dst src key opt lsl owner params makeswap skip arg opt
local param value rc ret mke2fs mdir prompt mount_point
ret=0
@@ -861,8 +882,8 @@ init_crypto() {
if test -e "$key" ; then
owner=$(ls -l $key | (read a b owner rest; echo $owner))
if ! key_is_random "$key"; then
- mode=$(ls -l "$key" | cut -c 5-10)
- if [ "$mode" != "------" ]; then
+ lsl=$(ls -l "$key")
+ if [ "${lsl:4:6}" != "------" ]; then
gprintf "INSECURE MODE FOR %s\n" $key
fi
fi
@@ -926,6 +947,9 @@ init_crypto() {
skip="yes"
fi
;;
+ noauto)
+ skip="yes"
+ ;;
verify)
params="$params -y"
;;
@@ -968,10 +992,16 @@ init_crypto() {
fi
fi
else
- [ -z "$key" ] && plymouth --hide-splash
- /sbin/cryptsetup $params ${key:+-d $key} create "$dst" "$src" <&1 2>/dev/null && success || failure
- rc=$?
- [ -z "$key" ] && plymouth --show-splash
+ if [ -z "$key" ]; then
+ mount_point="$(find_crypto_mount_point $dst)"
+ [ -n "$mount_point" ] || mount_point=${src##*/}
+ prompt=$(printf $"%s is password protected" "$mount_point")
+ plymouth ask-for-password --prompt "$prompt" --command="/sbin/cryptsetup $params create $dst $src" <&1
+ rc=$?
+ else
+ /sbin/cryptsetup $params ${key:+-d $key} create "$dst" "$src" <&1 2>/dev/null && success || failure
+ rc=$?
+ fi
fi
if [ $rc -ne 0 ]; then
ret=1
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index c137d87d..80deb629 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -182,7 +182,8 @@ __umount_loop '$3 ~ /^rpc_pipefs$/ || $3 ~ /^rpc_svc_gss_pipefs$/ {print $2}' \
LANG=C __umount_loop '$2 ~ /^\/$|^\/proc|^\/cgroup|^\/sys\/fs\/cgroup|^\/dev/{next}
$2 ~ /^\/live\//{next}
$3 == "tmpfs" || $3 == "proc" {print $2 ; next}
- /(loopfs|autofs|nfs|cifs|smbfs|ncpfs|sysfs|^none|^\/dev\/ram|^\/dev\/root$)/ {next}
+ $3 ~ /(loopfs|autofs|nfs|cifs|smbfs|ncpfs|sysfs)/ {next}
+ /(^none|^\/dev\/ram|^\/dev\/root$)/ {next}
{print $2}' /proc/mounts \
"Unmounting file systems: " \
"Unmounting file systems (retry): " \
diff --git a/rc.d/init.d/netconsole b/rc.d/init.d/netconsole
index 520a846b..14f96d76 100644
--- a/rc.d/init.d/netconsole
+++ b/rc.d/init.d/netconsole
@@ -63,7 +63,7 @@ print_address_info ()
target=$host
fi
if [ -z "$SYSLOGMACADDR" ]; then
- arp=$(LANG=C /sbin/arping -c 1 -I $DEV $target 2>/dev/null | awk '/ reply from .*[.*]/ { print gensub(".* reply from .* \\[(.*)\\].*","\\1","G") }')
+ arp=$(LANG=C /sbin/arping -c 1 -I $DEV $target 2>/dev/null | awk '/ reply from .*[.*]/ { print gensub(".* reply from .* \\[(.*)\\].*","\\1","G"); exit }')
[ -n "$arp" ] && echo "SYSLOGMACADDR=$arp"
fi
}
diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs
index d3f22714..2a37ce76 100755
--- a/rc.d/init.d/netfs
+++ b/rc.d/init.d/netfs
@@ -49,14 +49,14 @@ case "$1" in
[ -n "$NCPFSTAB" ] && action "Mounting NCP filesystems: " mount -a -t ncpfs
[ -n "$NETDEVFSTAB" ] &&
{
- if [ -f /etc/mdadm.conf ]; then
- mdadm -A -s
+ if [ -f /etc/mdadm.conf ] && [ -x /sbin/mdadm ]; then
+ /sbin/mdadm -A -s
fi
if [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then
modprobe dm-multipath >/dev/null 2>&1
- /sbin/multipath -v 0
+ /sbin/multipath -u -v 0
if [ -x /sbin/kpartx ]; then
- /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p"
+ /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -u -a -p p"
fi
fi
if [ -x /sbin/lvm ]; then
@@ -84,8 +84,8 @@ case "$1" in
fi
if [ "$rc" -gt 1 ]; then
- if [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --ping ; then
- /usr/bin/plymouth --hide-splash
+ if [ -x /bin/plymouth ] && /bin/plymouth --ping ; then
+ /bin/plymouth --hide-splash
fi
failure "$STRING"
tty >/dev/null 2>&1 || exit 1
@@ -104,7 +104,8 @@ case "$1" in
fi
}
touch /var/lock/subsys/netfs
- action "Mounting other filesystems: " mount -a -t nonfs,nfs4,cifs,ncpfs,gfs -O noencrypted
+ # The 'no' applies to all listed filesystem types. See mount(8).
+ action $"Mounting other filesystems: " mount -a -t nonfs,nfs4,cifs,ncpfs,gfs2 -O noencrypted
;;
stop)
# Unmount loopback stuff first
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index dd4fcb8e..9b86aa70 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -69,7 +69,7 @@ case "$1" in
/etc/sysconfig/network-scripts/init.ipv6-global start pre
fi
- sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
+ apply_sysctl
if [ -r /etc/ethers -a -x /sbin/arp ]; then
action "Storing ARP mapping" /sbin/arp -f /etc/ethers
@@ -123,6 +123,10 @@ case "$1" in
if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
+ if [ "$SLAVE" = "yes" ]; then
+ continue
+ fi
+
if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then
vpninterfaces="$vpninterfaces $i"
continue
@@ -146,10 +150,6 @@ case "$1" in
continue
fi
- if [ "$SLAVE" = "yes" ]; then
- continue
- fi
-
if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then
# this loads the module, to preserve ordering
is_available $i
@@ -200,8 +200,8 @@ case "$1" in
/etc/sysconfig/network-scripts/init.ipv6-global start post
fi
# Run this again to catch any interface-specific actions
- sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
-
+ apply_sysctl
+
touch /var/lock/subsys/network
;;
stop)