[alsa-devel] [PATCH v2 alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues
Changes in v2: - Call lspci only once and filter its output - Assume the file upload failed if no URL is returned
David Ward (11): alsa-info.sh: Consolidate PCI device output alsa-info.sh: Read from /proc/modules and sort the result alsa-info.sh: Simplify iteration over cards when calling amixer alsa-info.sh: Use existing function to print ALSA configuration files alsa-info.sh: Exit script after writing information to stdout alsa-info.sh: Replace gauge with infobox for upload dialog alsa-info.sh: Remove progress spinner during upload without dialog alsa-info.sh: Condense nested commands for file upload alsa-info.sh: Condense nested commands for formatting upload result alsa-info.sh: Perform test for wget earlier alsa-info.sh: Warn after actual upload failure; do not ping server
alsa-info/alsa-info.sh | 248 ++++++++++++++++--------------------------------- 1 file changed, 82 insertions(+), 166 deletions(-)
Include numeric IDs and subsystem info in the PCI device output, rather than placing them alone in a separate section.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index cf7ad89..2dcfcbf 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -455,7 +455,7 @@ fi cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp cat /proc/asound/cards > $TEMPDIR/alsacards.tmp if [[ ! -z "$LSPCI" ]]; then - lspci | grep -i "multi|audio">$TEMPDIR/lspci.tmp + lspci -vnn | grep -A1 ' [040[1-3]]: ' > $TEMPDIR/lspci.tmp fi
#Check for HDA-Intel cards codec#* @@ -585,12 +585,6 @@ echo "" >> $FILE cat $TEMPDIR/lspci.tmp >> $FILE echo "" >> $FILE echo "" >> $FILE -echo "!!Advanced information - PCI Vendor/Device/Subsystem ID's" >> $FILE -echo "!!-------------------------------------------------------" >> $FILE -echo "" >> $FILE -lspci -vvn |grep -A1 040[1-3] >> $FILE -echo "" >> $FILE -echo "" >> $FILE fi
if [ "$SNDOPTIONS" ]
Sorting the list of loaded modules makes it much easier to compare two alsa-info.txt files, even if they are both from the same system (since the order actually changes after each reboot).
lsmod just formats the contents of /proc/modules. After this script calls lsmod, it strips everything but module names from the output. This same result can be obtained just as easily by reading directly from /proc/modules; then there is no need to remove the header line printed by lsmod before sorting the output.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 2dcfcbf..d6d0935 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -35,7 +35,7 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) -REQUIRES="mktemp grep pgrep whereis ping awk date uname cat dmesg amixer alsactl" +REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl"
# # Define some simple functions @@ -131,11 +131,11 @@ withaplay() { echo "" >> $FILE }
-withlsmod() { +withmodules() { echo "!!All Loaded Modules" >> $FILE echo "!!------------------" >> $FILE echo "" >> $FILE - lsmod | awk '{print $1}' >> $FILE + awk '{print $1}' < /proc/modules | sort >> $FILE echo "" >> $FILE echo "" >> $FILE } @@ -254,7 +254,7 @@ withall() { withaplay withamixer withalsactl - withlsmod + withmodules withsysfs withdmesg WITHALL="no" @@ -366,7 +366,6 @@ information about your ALSA installation and sound related hardware.
dmesg lspci - lsmod aplay amixer alsactl
Read card names directly from individual procfs files, and pass them to amixer using the '-c' option.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index d6d0935..ff3cf95 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -144,12 +144,12 @@ withamixer() { echo "!!Amixer output" >> $FILE echo "!!-------------" >> $FILE echo "" >> $FILE - for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do - CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }') - echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE + for f in /proc/asound/card*/id; do + [ -f "$f" ] && read -r CARD_NAME < "$f" || continue + echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE echo "" >>$FILE - amixer -c$i info >> $FILE 2>&1 - amixer -c$i >> $FILE 2>&1 + amixer -c "$CARD_NAME" info >> $FILE 2>&1 + amixer -c "$CARD_NAME" >> $FILE 2>&1 echo "" >> $FILE done echo "" >> $FILE
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index ff3cf95..a1c1449 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -708,33 +708,8 @@ if [ -n "$1" ]; then WITHALL="no" ;; --with-configs) + withconfigs WITHALL="no" - if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] - then - echo "!!ALSA configuration files" >> $FILE - echo "!!------------------------" >> $FILE - echo "" >> $FILE - - #Check for ~/.asoundrc - if [[ -e $HOME/.asoundrc ]] - then - echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE - echo "" >> $FILE - cat $HOME/.asoundrc >> $FILE - echo "" >> $FILE - echo "" >> $FILE - fi - - #Check for /etc/asound.conf - if [[ -e /etc/asound.conf ]] - then - echo "!!System wide config file (/etc/asound.conf)" >> $FILE - echo "" >> $FILE - cat /etc/asound.conf >> $FILE - echo "" >> $FILE - echo "" >> $FILE - fi - fi ;; --stdout) UPLOAD="no"
The '--stdout' option is mutually exclusive with uploading the file.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index a1c1449..cc058f7 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -349,9 +349,7 @@ case "$1" in ;; --stdout) DIALOG="" - UPLOAD="no" WELCOME="no" - TOSTDOUT="yes" ;; esac done @@ -718,6 +716,7 @@ if [ -n "$1" ]; then fi cat $FILE rm $FILE + exit ;; --about) echo "Written/Tested by the following users of #alsa on irc.freenode.net:" @@ -791,10 +790,8 @@ fi
if [ "$UPLOAD" = "no" ]; then
- if [ -z "$TOSTDOUT" ]; then - mv -f $FILE $NFILE || exit 1 - KEEP_OUTPUT="yes" - fi + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes"
if [[ -n $DIALOG ]] then @@ -813,11 +810,9 @@ if [ "$UPLOAD" = "no" ]; then echo "Your ALSA information is in $NFILE" echo "" else - if [ -z "$TOSTDOUT" ]; then - echo "" - echo "Your ALSA information is in $NFILE" - echo "" - fi + echo "" + echo "Your ALSA information is in $NFILE" + echo "" fi fi
The gauge did not actually show the upload progress; in fact, the dialog did not even appear until after the upload was completed.
Use an infobox instead, which will be displayed while wget runs.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index cc058f7..7204c8e 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -828,19 +828,11 @@ if [[ -n $DIALOG ]] then
if [[ -z $PASTEBIN ]]; then + dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" - { for i in 10 20 30 40 50 60 70 80 90; do - echo $i - sleep 0.2 - done - echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0 else + dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryp..." &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" - { for i in 10 20 30 40 50 60 70 80 90; do - echo $i - sleep 0.2 - done - echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0 fi
dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
The spinner did not actually provide information about the status of the file upload, and caused other problems: it would repeatedly spawn new pgrep processes (without a delay between them), and it blocked the script if any wget process was running on the system.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 7204c8e..f958599 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -849,22 +849,12 @@ else
if [[ -z $PASTEBIN ]]; then echo -n "Uploading information to www.alsa-project.org ... " - wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp & + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp else echo -n "Uploading information to www.pastebin.ca ... " - wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY" &>$TEMPDIR/wget.tmp fi
-#Progess spinner for wget transfer. -i=1 -sp="/-|" -echo -n ' ' -while pgrep wget &>/dev/null -do - echo -en "\b${sp:i++%${#sp}:1}" -done - -echo -e "\b Done!" echo ""
fi # dialog
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index f958599..987acb9 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -826,15 +826,19 @@ then
if [[ -n $DIALOG ]] then + dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 +else + echo "Uploading information to $WWWSERVICE ..." +fi
if [[ -z $PASTEBIN ]]; then - dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" else - dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryp..." &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" fi
+if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 DIALOG_EXIT_CODE=$? if [ $DIALOG_EXIT_CODE = 0 ]; then @@ -844,19 +848,6 @@ fi
clear
-# no dialog -else - -if [[ -z $PASTEBIN ]]; then - echo -n "Uploading information to www.alsa-project.org ... " - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp -else - echo -n "Uploading information to www.pastebin.ca ... " - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY" &>$TEMPDIR/wget.tmp -fi - -echo "" - fi # dialog
# See if tput is available, and use it if it is.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 987acb9..1bdb1aa 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -833,8 +833,10 @@ fi
if [[ -z $PASTEBIN ]]; then wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) else wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryp..." &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*:([0-9]+).*/http://pastebin.ca/\1/p') fi
if [ -n "$DIALOG" ]; then @@ -851,18 +853,8 @@ clear fi # dialog
# See if tput is available, and use it if it is. -if [ -n "$TPUT" ]; then - if [[ -z $PASTEBIN ]]; then - FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0) - else - FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*:([0-9]+).*/http://pastebin.ca/\1/p'; tput sgr0) - fi -else - if [[ -z $PASTEBIN ]]; then - FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) - else - FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*:([0-9]+).*/http://pastebin.ca/\1/p') - fi +if [ -x "$TPUT" ]; then + FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0) fi
# Output the URL of the uploaded file.
If wget is not present, do not ask about uploading the information.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 73 ++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 38 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 1bdb1aa..445e2cb 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -767,6 +767,41 @@ if [ -z "$WITHALL" ]; then withall fi
+# Check if wget is installed, and supports --post-file. +if ! wget --help 2>/dev/null | grep -q post-file; then + # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually. + if [ "$UPLOAD" != "yes" ]; then + : + elif [ -n "$DIALOG" ]; then + if [ -z "$PASTEBIN" ]; then + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.%5CnPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." 25 100 + else + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.%5CnPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 + fi + else + if [ -z "$PASTEBIN" ]; then + echo "" + echo "Could not automatically upload output to http://www.alsa-project.org" + echo "Possible reasons are:" + echo " 1. Couldn't find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." + echo "" + else + echo "" + echo "Could not automatically upload output to http://www.pastebin.ca" + echo "Possible reasons are:" + echo " 1. Couldn't find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." + echo "" + fi + fi + UPLOAD="no" +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 @@ -820,10 +855,6 @@ if [ "$UPLOAD" = "no" ]; then
fi # UPLOAD
-# Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it does not. -if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ $(wget --help | grep post-file) ]] -then - if [[ -n $DIALOG ]] then dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 @@ -861,37 +892,3 @@ fi echo "Your ALSA information is located at $FINAL_URL" echo "Please inform the person helping you." echo "" - -# We couldnt find a suitable wget, so tell the user to upload manually. -else - mv -f $FILE $NFILE || exit 1 - KEEP_OUTPUT="yes" - if [[ -z $DIALOG ]] - then - if [[ -z $PASTEBIN ]]; then - echo "" - echo "Could not automatically upload output to http://www.alsa-project.org" - echo "Possible reasons are:" - echo " 1. Couldnt find 'wget' in your PATH" - echo " 2. Your version of wget is less than 1.8.2" - echo "" - echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." - echo "" - else - echo "" - echo "Could not automatically upload output to http://www.pastebin.ca" - echo "Possible reasons are:" - echo " 1. Couldnt find 'wget' in your PATH" - echo " 2. Your version of wget is less than 1.8.2" - echo "" - echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." - echo "" - fi - else - if [[ -z $PASTEBIN ]]; then - dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.%5CnPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project,org/cardinfo-db/ and submit your post." 25 100 - else - dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.%5CnPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 - fi - fi -fi
Check the output from wget to determine if the file upload failed. If it did, display the message about upload failure and exit.
Do not ping the web server; the result does not indicate whether a file upload will succeed or not.
Signed-off-by: David Ward david.ward@ll.mit.edu --- alsa-info/alsa-info.sh | 57 +++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 33 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 445e2cb..7cab649 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -35,22 +35,12 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) -REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl" +REQUIRES="mktemp grep pgrep whereis awk date uname cat sort dmesg amixer alsactl"
# # Define some simple functions #
-pbcheck() { - [[ $UPLOAD = "no" ]] && return - - if [[ -z $PASTEBIN ]]; then - [[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" - else - [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" - fi -} - update() { test -z "$WGET" -o ! -x "$WGET" && return
@@ -648,7 +638,6 @@ fi #If no command line options are specified, then run as though --with-all was specified if [ -z "$1" ]; then update - pbcheck fi
fi # proceed @@ -660,7 +649,6 @@ if [ -n "$1" ]; then case "$1" in --pastebin) update - pbcheck ;; --update) update @@ -830,25 +818,11 @@ if [ "$UPLOAD" = "no" ]; then
if [[ -n $DIALOG ]] then - if [[ -n $PBERROR ]]; then - dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 - else - dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 - fi + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 else - echo - - if [[ -n $PBERROR ]]; then - echo "An error occurred while contacting the $WWWSERVICE." - echo "Your information was NOT automatically uploaded." - echo "" - echo "Your ALSA information is in $NFILE" - echo "" - else - echo "" - echo "Your ALSA information is in $NFILE" - echo "" - fi + echo "" + echo "Your ALSA information is in $NFILE" + echo "" fi
exit @@ -863,13 +837,30 @@ else fi
if [[ -z $PASTEBIN ]]; then - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) else - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryp..." &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryp..." &>$TEMPDIR/wget.tmp FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*:([0-9]+).*/http://pastebin.ca/\1/p') fi
+if [ -z "$FINAL_URL" ]; then + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes" + + if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information not uploaded" --msgbox "An error occurred while contacting $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 + else + echo "An error occurred while contacting $WWWSERVICE." + echo "Your information was NOT automatically uploaded." + echo "" + echo "Your ALSA information is in $NFILE" + echo "" + fi + + exit +fi + if [ -n "$DIALOG" ]; then
dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
participants (1)
-
David Ward