]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsa-info: Refactor "withall" logic
authorDavid Henningsson <david.henningsson@canonical.com>
Fri, 22 Aug 2014 08:31:41 +0000 (10:31 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 22 Aug 2014 09:08:35 +0000 (11:08 +0200)
Previously, using --output, --no-upload, --upload and --pastebin
switches implied the withall switch.

A more intuitive logic would be that --with-all is disabled if you
use another --with* switch, such as --withdmesg, and only then.

Also update script version to reflect the behaviour change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
alsa-info/alsa-info.sh

index 47157f06b159a9042e6c90268897877362e5700f..acd849588141232ae5d6d258d498fa0b7ff4d8cf 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-SCRIPT_VERSION=0.4.63
+SCRIPT_VERSION=0.4.64
 CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
 
 #################################################################################
@@ -260,6 +260,7 @@ withall() {
        withlsmod
        withsysfs
        withdmesg
+       WITHALL="no"
 }
 
 get_alsa_library_version() {
@@ -629,7 +630,6 @@ fi
 #If no command line options are specified, then run as though --with-all was specified
 if [ -z "$1" ]; then
        update
-       withall
        pbcheck 
 fi
 
@@ -642,7 +642,6 @@ if [ -n "$1" ]; then
        case "$1" in
                --pastebin)
                        update
-                       withall
                        pbcheck
                        ;;
                --update)
@@ -651,43 +650,45 @@ if [ -n "$1" ]; then
                        ;;
                --upload)
                        UPLOAD="yes"
-                       withall
                        ;;
                --no-upload)
                        UPLOAD="no"
-                       withall
                        ;;
                --output)
                        shift
                        NFILE="$1"
                        KEEP_OUTPUT="yes"
-                       withall
                        ;;
                --debug)
                        echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
                        KEEP_FILES="yes"
                        echo ""
-                       withall
                        ;;
                --with-all)
                        withall
                        ;;
                --with-aplay)
                        withaplay
+                       WITHALL="no"
                        ;;
                --with-amixer)
                        withamixer
+                       WITHALL="no"
                        ;;
                --with-alsactl)
                        withalsactl
+                       WITHALL="no"
                        ;;
                --with-devices)
                        withdevices
+                       WITHALL="no"
                        ;;
                --with-dmesg)
                        withdmesg
+                       WITHALL="no"
                        ;;
                --with-configs)
+                       WITHALL="no"
                        if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
                        then
                                echo "!!ALSA configuration files" >> $FILE
@@ -717,7 +718,9 @@ if [ -n "$1" ]; then
                        ;;
                --stdout)
                        UPLOAD="no"
-                       withall
+                       if [ -z "$WITHALL" ]; then
+                               withall
+                       fi
                        cat $FILE
                        rm $FILE
                        ;;
@@ -766,6 +769,10 @@ if [ "$PROCEED" = "no" ]; then
        exit 1
 fi
 
+if [ -z "$WITHALL" ]; then
+       withall
+fi
+
 if [ "$UPLOAD" = "ask" ]; then
        if [ -n "$DIALOG" ]; then
                dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80