[arch-projects] [initscripts] [PATCH 07/18] ck_depends, ck_pidfile, do_unlock, kill_everything: add missing local statements
Dave Reisner
d at falconindy.com
Mon Jun 27 13:43:34 EDT 2011
On Mon, Jun 27, 2011 at 07:11:13PM +0200, Kurt J. Bosch wrote:
> ---
> functions | 4 ++++
> rc.sysinit | 12 ++++++------
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/functions b/functions
> index cdb048a..0776ae4 100644
> --- a/functions
> +++ b/functions
> @@ -210,6 +210,7 @@ start_daemon() {
> # 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() {
> + local daemon
> for daemon in "$@"; do
> ck_daemon "$daemon" && start_daemon "$daemon"
> done
> @@ -251,6 +252,7 @@ get_pid() {
> # 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
> @@ -270,6 +272,7 @@ kill_everything() {
> # $1 = where we are being called from.
> # This is used to determine which hooks to run.
> # Find daemons NOT in the DAEMONS array. Shut these down first
> + local deamon
typo here.
> for daemon in /run/daemons/*; do
> [[ -f $daemon ]] || continue
> daemon=${daemon##*/}
> @@ -277,6 +280,7 @@ kill_everything() {
> done
>
> # Shutdown daemons in reverse order
> + local i
> for (( i=${#DAEMONS[@]}-1; i>=0; i-- )); do
> [[ ${DAEMONS[i]} = '!'* ]] && continue
> ck_daemon ${DAEMONS[i]#@} || stop_daemon ${DAEMONS[i]#@}
> diff --git a/rc.sysinit b/rc.sysinit
> index fe7b58e..d674e72 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -138,12 +138,12 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
> 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
> --
> 1.7.1
>
More information about the arch-projects
mailing list