diff options
author | Colin Guthrie <colin@mageia.org> | 2011-11-03 22:26:54 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2011-11-03 22:26:54 +0000 |
commit | 1e6179bf54cbc84b4ad33480e7f2f713418bb28a (patch) | |
tree | 794b2654be506d551421bcc47d3ad97822e2861c /rc.d | |
parent | 87589b49d1543595188dcb26aa5a09d33e5e0a4e (diff) | |
parent | 6ce3e4700baa4e37e6b16e4160c00b2ebea58d81 (diff) | |
download | initscripts-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')
-rw-r--r-- | rc.d/init.d/functions | 88 | ||||
-rwxr-xr-x | rc.d/init.d/halt | 3 | ||||
-rw-r--r-- | rc.d/init.d/netconsole | 2 | ||||
-rwxr-xr-x | rc.d/init.d/netfs | 15 | ||||
-rwxr-xr-x | rc.d/init.d/network | 14 | ||||
-rwxr-xr-x | rc.d/rc | 2 | ||||
-rwxr-xr-x | rc.d/rc.local | 2 | ||||
-rwxr-xr-x | rc.d/rc.sysinit | 58 |
8 files changed, 112 insertions, 72 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) @@ -73,7 +73,7 @@ fi # Set language, vc settings once to avoid doing it for every init script # through functions -if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n ] ; then +if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then . /etc/profile.d/10lang.sh 2>/dev/null export LANGSH_SOURCED=1 fi diff --git a/rc.d/rc.local b/rc.d/rc.local index 6d125d8b..cf1cf8dc 100755 --- a/rc.d/rc.local +++ b/rc.d/rc.local @@ -5,7 +5,7 @@ # X-Mandriva-Compat-Mode # Default-Start: 2 3 4 5 # Short-Description: Local initialization script -# Description: This script will be executed *after* all the other init scripts. +# Description: This script will be executed at the end of the boot process. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. ### END INIT INFO diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 18368b08..6b1baf0f 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -20,6 +20,10 @@ if [ -f /etc/sysconfig/system ]; then . /etc/sysconfig/system fi +if [ -r /etc/hostname ]; then + HOSTNAME=$(cat /etc/hostname) +fi + if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then HOSTNAME=localhost fi @@ -161,11 +165,14 @@ if [ "x$SPEEDBOOT" = "xyes" ]; then UDEV_PID=$! fi +PLYMOUTH= +[ -x /bin/plymouth ] && PLYMOUTH=yes + # Check SELinux status SELINUX_STATE= -if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then - if [ -r "/selinux/enforce" ] ; then - SELINUX_STATE=$(cat "/selinux/enforce") +if [ -e "/sys/fs/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then + if [ -r "/sys/fs/selinux/enforce" ] ; then + SELINUX_STATE=$(cat "/sys/fs/selinux/enforce") else # assume enforcing if you can't read it SELINUX_STATE=1 @@ -180,7 +187,7 @@ disable_selinux() { gprintf "*** Warning -- SELinux is active\n" gprintf "*** Disabling security enforcement for system recovery.\n" gprintf "*** Run 'setenforce 1' to reenable.\n" - echo "0" > "/selinux/enforce" + echo "0" > "/sys/fs/selinux/enforce" } relabel_selinux() { @@ -188,7 +195,7 @@ relabel_selinux() { # wrong context, so a reboot will be required after relabel AUTORELABEL= . /etc/selinux/config - echo "0" > /selinux/enforce + echo "0" > /sys/fs/selinux/enforce [ -n "$PLYMOUTH" ] && plymouth --hide-splash if [ "$AUTORELABEL" = "0" ]; then @@ -271,9 +278,11 @@ fi nashpid=$(pidof nash 2>/dev/null) [ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1 unset nashpid -if [ "x$SPEEDBOOT" != "xyes" ]; then - /sbin/start_udev -fi #SPEEDBOOT + +action $"Starting udev: " /sbin/udevd --daemon +/sbin/udevadm trigger --type=subsystems --action=add +/sbin/udevadm trigger --type=devices --action=add +/sbin/udevadm settle # Load other user-defined modules for file in /etc/sysconfig/modules/*.modules ; do @@ -297,11 +306,7 @@ mount -n -t tmpfs none /dev/shm >/dev/null 2>&1 # Configure kernel parameters update_boot_stage RCkernelparam -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 +apply_sysctl if [ "x$SPEEDBOOT" != "xyes" ]; then @@ -381,8 +386,12 @@ if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then done fi fi +fi fi #SPEEDBOOT +# Start any MD RAID arrays that haven't been started yet +[ -r /proc/mdstat ] && [ -r /dev/md/md-device-map ] && /sbin/mdadm -IRs + if [ -x /sbin/lvm ]; then action "Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --ignorelockingfailure fi @@ -393,7 +402,7 @@ if [ -f /etc/crypttab ]; then fi fi #SPEEDBOOT -if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then +if strstr "$cmdline" fastboot || [ -f /fastboot ]; then fastboot=yes fi @@ -404,7 +413,7 @@ fi # (blino) always source autofsck settings, for AUTOFSCK_CRYPTO_TIMEOUT (#16029) [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck -if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then +if strstr "$cmdline" forcefsck || [ -f /forcefsck ]; then fsckoptions="-f $fsckoptions" elif [ -f /.autofsck ]; then if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then @@ -417,9 +426,9 @@ elif [ -f /.autofsck ]; then gprintf "*** Warning -- the system did not shut down cleanly. \n" gprintf "*** Dropping you to a shell; the system will continue\n" gprintf "*** when you leave the shell.\n" - [ -n "$SELINUX_STATE" ] && echo "0" > /selinux/enforce + [ -n "$SELINUX_STATE" ] && echo "0" > /sys/fs/selinux/enforce sulogin - [ -n "$SELINUX_STATE" ] && echo "1" > /selinux/enforce + [ -n "$SELINUX_STATE" ] && echo "1" > /sys/fs/selinux/enforce [ -n "$PLYMOUTH" ] && plymouth --show-splash fi fsckoptions="$AUTOFSCK_OPT $fsckoptions" @@ -519,7 +528,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }') for ip in $ipaddr ; do HOSTNAME= - eval $(ipcalc -h $ipaddr 2>/dev/null) + eval $(ipcalc -h $ip 2>/dev/null) [ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; } done fi @@ -747,6 +756,7 @@ fi # export locales (needed by mount.ntfs-3g) export LC_ALL export LANG +# The 'no' applies to all listed filesystem types. See mount(8). if [ "$READONLY" != "yes" ] ; then action "Mounting local filesystems: " mount -a -t nodevpts,nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev,noloop,noencrypted else @@ -845,8 +855,8 @@ fi # Configure machine if necessary. if [ -f /.unconfigured ]; then - if [ -x /usr/bin/plymouth ]; then - /usr/bin/plymouth quit + if [ -x /bin/plymouth ]; then + /bin/plymouth quit fi if [ -x /usr/bin/system-config-keyboard ]; then @@ -951,14 +961,12 @@ fi /bin/mount -t binfmt_misc none /proc/sys/fs/binfmt_misc > /dev/null 2>&1 # Boot time profiles. Yes, this should be somewhere else. -if [ -x /usr/sbin/system-config-network-cmd ]; then - if strstr "$cmdline" netprofile= ; then +if strstr "$cmdline" netprofile= && [ -x /usr/sbin/system-config-network-cmd ]; then for arg in $cmdline ; do if [ "${arg##netprofile=}" != "${arg}" ]; then /usr/sbin/system-config-network-cmd --profile ${arg##netprofile=} fi done - fi fi ( @@ -1172,8 +1180,8 @@ for i in XF86Config XF86Config-4; do done # Let rhgb know that we're leaving rc.sysinit -if [ -x /usr/bin/plymouth ]; then - /usr/bin/plymouth --sysinit +if [ -x /bin/plymouth ]; then + /bin/plymouth --sysinit fi # remove this file at the very end, for speedboot |