]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
mkinitrd-dracut.sh: Implement --quiet|-q option
authorThomas Renninger <trenn@suse.de>
Fri, 27 Sep 2013 18:18:57 +0000 (20:18 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 4 Oct 2013 11:56:41 +0000 (13:56 +0200)
Dracut is rather verbose. This optional parameter is to limit the output
to the essential: For each generated initrd show the kernel, target and
possibly additional options passed to dracut.

Signed-off-by: Thomas Renninger <trenn@suse.de>
mkinitrd-dracut.sh

index d8e92f3c1b18ef5dbb4478311349fdd8b9e52157..803abc0fcea18d4c516a9c63b1e07268d6933739 100755 (executable)
@@ -2,6 +2,7 @@
 kver=$(uname -r)
 
 boot_dir="/boot"
+quiet=0
 
 error() { echo "$@" >&2; }
 
@@ -89,6 +90,7 @@ while (($# > 0)); do
         --looppath*) ;;
         --dsdt*) ;;
         --bootchart) ;;
+       --quiet|-q) quiet=1;;
        -b) read_arg boot_dir "$@" || shift $?
            if [ ! -d $boot_dir ];then
                error "Boot directory $boot_dir does not exist"
@@ -123,6 +125,7 @@ done
 targets=( $targets )
 [[ $kernels ]] && kernels=( $kernels )
 
+echo "Creating: target|kernel|dracut args|basicmodules "
 for ((i=0 ; $i<${#targets[@]} ; i++)); do
 
     if [[ $img_vers ]];then
@@ -132,9 +135,21 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
     fi
     kernel="${kernels[$i]}"
 
-    if [[ $basicmodules ]]; then
-        dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
+    # Duplicate code: No way found how to redirect output based on $quiet
+    if [[ $quiet == 1 ]];then
+       echo "$target|$kernel|$dracut_args|$basicmodules"
+       if [[ $basicmodules ]]; then
+            dracut $dracut_args --add-drivers "$basicmodules" "$target" \
+               "$kernel" &>/dev/null
+       else
+            dracut $dracut_args "$target" "$kernel" &>/dev/null
+       fi
     else
-        dracut $dracut_args "$target" "$kernel"
+       if [[ $basicmodules ]]; then
+            dracut $dracut_args --add-drivers "$basicmodules" "$target" \
+               "$kernel"
+       else
+            dracut $dracut_args "$target" "$kernel"
+       fi
     fi
 done