]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
[PATCH 10/50] Clean up initialization in dracut.
authorVictor Lowther <victor.lowther@gmail.com>
Fri, 13 Feb 2009 12:41:54 +0000 (04:41 -0800)
committerDave Jones <davej@redhat.com>
Mon, 16 Feb 2009 18:56:40 +0000 (13:56 -0500)
The source keyword is deprecated, and kernel / outfile are more legible as
conditional lists.

dracut

diff --git a/dracut b/dracut
index 82cf9e575a16089d62c28f8eb87c011fdbeaa743..bd592d03e23bbd94377bb7f74047b4edf6c7960c 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -23,29 +23,22 @@ while (($# > 0)); do
     shift
 done
 
-if [ -n "$2" ]; then
-    kernel=$2
-else
-    kernel=$(uname -r)
-fi
-if [ -n "$1" ]; then
-    outfile=$(readlink -f $1)
-else
+[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
+[[ $1 ]] && outfile=$(readlink -f $1) || \
     outfile="/boot/initrd-$kernel.img"
-fi
 
-if [ -f "$outfile" -a  -z "$force" ]; then
+if [[ -f $outfile && ! $force ]]; then
     echo "Will not override existing initramfs ($outfile) without --force"
     exit 1
 fi
 
-if [ -n "$allowlocal" -a -f ./init ]; then
-    source ./dracut-functions
+if [[ $allowlocal && -f ./init ]]; then
+    . ./dracut-functions
     initfile=./init
     switchroot=./switch_root
     rulesdir=./rules.d
 else
-    source /usr/libexec/dracut/functions
+    . /usr/libexec/dracut/functions
     initfile=/usr/libexec/dracut/init
     switchroot=/usr/libexec/dracut/switch_root
     rulesdir=/usr/libexec/dracut/rules.d