alsa-info: Refactor "withall" logic

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>
This commit is contained in:
David Henningsson 2014-08-22 10:31:41 +02:00 committed by Takashi Iwai
parent 4f569affc4
commit 808af5fdb0

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SCRIPT_VERSION=0.4.63 SCRIPT_VERSION=0.4.64
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog" CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
################################################################################# #################################################################################
@ -260,6 +260,7 @@ withall() {
withlsmod withlsmod
withsysfs withsysfs
withdmesg withdmesg
WITHALL="no"
} }
get_alsa_library_version() { 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 no command line options are specified, then run as though --with-all was specified
if [ -z "$1" ]; then if [ -z "$1" ]; then
update update
withall
pbcheck pbcheck
fi fi
@ -642,7 +642,6 @@ if [ -n "$1" ]; then
case "$1" in case "$1" in
--pastebin) --pastebin)
update update
withall
pbcheck pbcheck
;; ;;
--update) --update)
@ -651,43 +650,45 @@ if [ -n "$1" ]; then
;; ;;
--upload) --upload)
UPLOAD="yes" UPLOAD="yes"
withall
;; ;;
--no-upload) --no-upload)
UPLOAD="no" UPLOAD="no"
withall
;; ;;
--output) --output)
shift shift
NFILE="$1" NFILE="$1"
KEEP_OUTPUT="yes" KEEP_OUTPUT="yes"
withall
;; ;;
--debug) --debug)
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted" echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
KEEP_FILES="yes" KEEP_FILES="yes"
echo "" echo ""
withall
;; ;;
--with-all) --with-all)
withall withall
;; ;;
--with-aplay) --with-aplay)
withaplay withaplay
WITHALL="no"
;; ;;
--with-amixer) --with-amixer)
withamixer withamixer
WITHALL="no"
;; ;;
--with-alsactl) --with-alsactl)
withalsactl withalsactl
WITHALL="no"
;; ;;
--with-devices) --with-devices)
withdevices withdevices
WITHALL="no"
;; ;;
--with-dmesg) --with-dmesg)
withdmesg withdmesg
WITHALL="no"
;; ;;
--with-configs) --with-configs)
WITHALL="no"
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
then then
echo "!!ALSA configuration files" >> $FILE echo "!!ALSA configuration files" >> $FILE
@ -717,7 +718,9 @@ if [ -n "$1" ]; then
;; ;;
--stdout) --stdout)
UPLOAD="no" UPLOAD="no"
withall if [ -z "$WITHALL" ]; then
withall
fi
cat $FILE cat $FILE
rm $FILE rm $FILE
;; ;;
@ -766,6 +769,10 @@ if [ "$PROCEED" = "no" ]; then
exit 1 exit 1
fi fi
if [ -z "$WITHALL" ]; then
withall
fi
if [ "$UPLOAD" = "ask" ]; then if [ "$UPLOAD" = "ask" ]; then
if [ -n "$DIALOG" ]; 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 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