From 681717364c786083356ebe5d92c4cc6fd73af307 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 14:46:25 -0500 Subject: Allow for plymouth to enter non-LUKS passphrases (#621158, ) --- rc.d/init.d/functions | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 3f2cbc50..3eddf1ea 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -786,10 +786,16 @@ init_crypto() { rc=$? 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 -- cgit v1.2.1 From 5212d0a596d67bbd2f5effdd3686c123f778078f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 21 Feb 2010 21:21:48 +0200 Subject: Drop some unnecessary command invocations. --- rc.d/init.d/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 3eddf1ea..63d1190e 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -671,7 +671,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 @@ -686,8 +686,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 echo $"INSECURE MODE FOR $key" fi fi -- cgit v1.2.1 From ec2bee09f74293bf30cd06e62ae2a6845af09dda Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 15:53:12 -0500 Subject: Add support for noauto crypt devices, to mirror systemd. --- rc.d/init.d/functions | 3 +++ 1 file changed, 3 insertions(+) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 63d1190e..5fd4742a 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -751,6 +751,9 @@ init_crypto() { skip="yes" fi ;; + noauto) + skip="yes" + ;; verify) params="$params -y" ;; -- cgit v1.2.1 From 9369bf1568b73061fe29670b4faae80c6507d56f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 16:31:09 -0500 Subject: Make killproc more granular when delay is passed. (#428029, ) --- rc.d/init.d/functions | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 5fd4742a..212ecee8 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -312,7 +312,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. @@ -355,11 +355,17 @@ killproc() { # 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 + 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 100000 + fi fi fi checkpid $pid -- cgit v1.2.1 From 13f2ec05b5af5f57b6847b04185c6e710dc769b2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 16:34:56 -0500 Subject: Tweak waiting times slightly. (#596451) --- rc.d/init.d/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 212ecee8..da8d9794 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -354,7 +354,7 @@ killproc() { if checkpid $pid 2>&1; then # TERM first, then KILL if not dead kill -TERM $pid >/dev/null 2>&1 - usleep 100000 + usleep 50000 if checkpid $pid ; then try=0 while [ $try -lt $delay ] ; do @@ -364,7 +364,7 @@ killproc() { done if checkpid $pid ; then kill -KILL $pid >/dev/null 2>&1 - usleep 100000 + usleep 50000 fi fi fi -- cgit v1.2.1 From 3f296db591da779000a301b2b29560ee6df413f3 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 16:56:40 -0500 Subject: Move sysctl.conf/sysctl.d handling to a function, call it where appropriate. (#593211, continued) --- rc.d/init.d/functions | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index da8d9794..7377f999 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -658,6 +658,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" ] -- cgit v1.2.1 From 6fa9b81fe263f25c1395a6156d939433623a849f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 1 Mar 2011 17:35:52 +0200 Subject: Fix path to sysconfig.txt in comments. --- rc.d/init.d/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 7377f999..01cfed8c 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -73,7 +73,7 @@ if [ -z "${BOOTUP:-}" ]; then . /etc/sysconfig/init else # This all seem confusing? Look in /etc/sysconfig/init, - # or in /usr/doc/initscripts-*/sysconfig.txt + # or in /usr/share/doc/initscripts-*/sysconfig.txt BOOTUP=color RES_COL=60 MOVE_TO_COL="echo -en \\033[${RES_COL}G" -- cgit v1.2.1 From a9b0d6b5c655da96783851d5304c4d800d4e4553 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 7 Mar 2011 15:53:45 -0500 Subject: Don't do force/lazy umount for the first nfs umount. (#676851, ) This can cause hung tasks that aren't cleaned up or killed properly, as their dangling references won't get caught. --- rc.d/init.d/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 01cfed8c..ff6ac88c 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -124,7 +124,7 @@ __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() { @@ -134,7 +134,7 @@ __umount_loop() { 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 -- cgit v1.2.1 From 22c79dd133d0e0d72667c1d9c4cfd4e82c83e7a9 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 15 Mar 2011 12:37:43 -0400 Subject: Fix mishandled argument to fstab-decode. (#685137) --- rc.d/init.d/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index ff6ac88c..ec4f2bbe 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -134,7 +134,7 @@ __umount_loop() { 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 '' $remaining + action "$3" fstab-decode umount $remaining else action "$4" fstab-decode umount $5 $remaining fi -- cgit v1.2.1 From 81b50ecb6be1df83b45c6ed868e855c6d11bf135 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 10 May 2011 15:02:47 -0400 Subject: fuser -k defaults to -9; set the initial pass to kill -15. (#703457) --- rc.d/init.d/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index ec4f2bbe..8a3177a1 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -128,7 +128,7 @@ __fgrep() { # 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) @@ -156,7 +156,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 != "/" {print $2}' /proc/mounts) -- cgit v1.2.1 From 56ac215dd147c559558009ca899dc33d9932dce2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 2 Jun 2011 11:23:14 -0400 Subject: Clean up some noise if stderr isn't available. --- rc.d/init.d/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 8a3177a1..1b0b4843 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -55,9 +55,9 @@ systemctl_redirect () { if [ -z "${CONSOLETYPE:-}" ]; then if [ -r "/dev/stderr" ]; then - CONSOLETYPE="$(/sbin/consoletype < /dev/stderr)" + CONSOLETYPE="$(/sbin/consoletype < /dev/stderr 2>/dev/null)" else - CONSOLETYPE="$(/sbin/consoletype)" + CONSOLETYPE="$(/sbin/consoletype 2>/dev/null)" fi fi -- cgit v1.2.1 From 19ea300575c00132cf576ae0f8ef99f0c78f20d1 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 15 Aug 2011 16:23:38 -0400 Subject: plymouth lives in /bin. (#702814) --- rc.d/init.d/functions | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 1b0b4843..79545b51 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -546,8 +546,8 @@ echo_warning() { # Inform the graphical boot of our current state update_boot_stage() { - if [ -x /usr/bin/plymouth ]; then - /usr/bin/plymouth --update="$1" + if [ -x /bin/plymouth ]; then + /bin/plymouth --update="$1" fi return 0 } @@ -562,7 +562,7 @@ success() { failure() { local rc=$? [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --details + [ -x /bin/plymouth ] && /bin/plymouth --details return $rc } @@ -601,7 +601,7 @@ strstr() { # Confirm whether we really want to run this service confirm() { - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --hide-splash + [ -x /bin/plymouth ] && /bin/plymouth --hide-splash while : ; do echo -n $"Start service $1 (Y)es/(N)o/(C)ontinue? [Y] " read answer @@ -609,7 +609,7 @@ confirm() { return 0 elif strstr $"cC" "$answer" ; then rm -f /var/run/confirm - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --show-splash + [ -x /bin/plymouth ] && /bin/plymouth --show-splash return 2 elif strstr $"nN" "$answer" ; then return 1 -- cgit v1.2.1 From 09bfb5033230e6846414bc6002aa12ce09c23687 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 19 Sep 2011 17:45:17 -0400 Subject: Only bother with consoletype if we're actually connected to something that's console-ish. (#657869) If we're connected to a socket, or a pipe, or a file, or anything else - assume dumb mode. --- rc.d/init.d/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 79545b51..e313e35b 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -54,10 +54,10 @@ systemctl_redirect () { [ -z "${COLUMNS:-}" ] && COLUMNS=80 if [ -z "${CONSOLETYPE:-}" ]; then - if [ -r "/dev/stderr" ]; then + if [ -c "/dev/stderr" ]; then CONSOLETYPE="$(/sbin/consoletype < /dev/stderr 2>/dev/null)" else - CONSOLETYPE="$(/sbin/consoletype 2>/dev/null)" + CONSOLETYPE="serial" fi fi -- cgit v1.2.1 From d088bd27ef9fac2695c9769b4fbb230e32d93b31 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 25 Oct 2011 12:47:26 -0400 Subject: If locale.conf exists, use it. (#706756, in part) systemd's algorithm on startup is: - if /etc/locale.conf is parseable, use that - otherwise, use /etc/sysconfig/i18n Given that we have a heirarchy of system -> user settings here, simply go: ~/.i18n > /etc/locale.conf > /etc/sysconfig/i18n Add some documentation as well. --- rc.d/init.d/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index e313e35b..1437b252 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -61,7 +61,7 @@ if [ -z "${CONSOLETYPE:-}" ]; then fi fi -if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n ] ; then +if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then . /etc/profile.d/lang.sh 2>/dev/null # avoid propagating LANGSH_SOURCED any further unset LANGSH_SOURCED -- cgit v1.2.1