alsa-info.sh - Check if pastebin.ca is up, and gracefully fallback to --no-upload if its down.
PATCH 1/1 alsa-info.sh - Check if pastebin.ca is up, and gracefully fallback to --no-upload if its down.
Changelog: This patch will allow alsa-info.sh to check if the pastebin site
(www.pastebin.ca) is down, before trying to upload to it. It will fail
gracefully, with a message letting the user know what happened. The script
will also keep the ALSA information it collected (same way it does
with --no-upload).
Patch is attached.
alsa-info.sh +22 -21
@@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION=0.4.44 +SCRIPT_VERSION=0.4.45 CHANGELOG="http://hg.alsa-project.org/alsa/log/tip/alsa-info.sh" #################################################################################
@@ -31,6 +31,10 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" BGTITLE="ALSA-Info v $SCRIPT_VERSION" PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" #Define some simple functions + +pbcheck(){ + [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" NOUPLOAD="yes" PBERROR="yes" +} update() { wget -O /tmp/alsa-info.sh http://hg.alsa-project.org/alsa/raw-file/tip/alsa-info.sh >/dev/null 2>&1
@@ -190,7 +194,6 @@ SNDOPTIONS=$(modprobe -c|sed -n 's/^opti QUESTION="yes" PROCEED="yes" -NOUPLOAD="" REPEAT="" while [ -z "$REPEAT" ]; do REPEAT="no"
@@ -411,9 +414,7 @@ then withamixer withalsactl withlsmod - #Workaround, while we sort out pastebin location, since pastebin.ca blocked us. - #NOUPLOAD="yes" - + pbcheck fi fi # proceed
@@ -457,17 +458,6 @@ then withalsactl withlsmod ;; - #### FIX ME - --secure) - withdevices - withconfigs - withaplay - withamixer - withalsactl - withlsmod - withsecure - ;; - ########### --with-aplay) withaplay ;;
@@ -598,7 +588,11 @@ if [[ -n $DIALOG ]] if [[ -n $DIALOG ]] then if [[ -n $NOUPLOAD ]]; then - dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "You requested that your information was NOT automatically uploaded to the pastebin\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + if [[ -n $PBERROR ]]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occured while contacting the pastebin. Your information was NOT automatically uploaded.\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + else + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "You requested that your information was NOT automatically uploaded to the pastebin\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + fi else dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 DIALOG_EXIT_CODE=$?
@@ -610,10 +604,17 @@ fi fi clear if [[ -n $NOUPLOAD ]]; then - echo "You requested that your information was NOT automatically uploaded to the pastebin" - echo "" - echo "Your ALSA information can be seen by looking in $FILE" - echo "" + if [[ -n $PBERROR ]]; then + echo "An error occured while contacting the pastebin. Your information was NOT automatically uploaded." + echo "" + echo "Your ALSA information can be seen by looking in $FILE" + echo "" + else + echo "You requested that your information was NOT automatically uploaded to the pastebin" + echo "" + echo "Your ALSA information can be seen by looking in $FILE" + echo "" + fi fi if [[ -z $NOUPLOAD ]]; then echo "Your ALSA information is located at $FINAL_URL"
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 17 lines · Travis Place
Changelog: This patch will allow
alsa-info.shto check if the pastebin site
(www.pastebin.ca) is down, before trying to upload to it. It will fail
gracefully, with a message letting the user know what happened. The script
will also keep the ALSA information it collected (same way it does
with --no-upload).Patch is attached.
Signed-off-by Travis Place <wishie at wishie dot net>
Quoted 6 lines
------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
You mean this message,
your patch attached.
alsa-info.sh +22 -21
@@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION=0.4.44 +SCRIPT_VERSION=0.4.45 CHANGELOG="http://hg.alsa-project.org/alsa/log/tip/alsa-info.sh" #################################################################################
@@ -31,6 +31,10 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" BGTITLE="ALSA-Info v $SCRIPT_VERSION" PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" #Define some simple functions + +pbcheck(){ + [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" NOUPLOAD="yes" PBERROR="yes" +} update() { wget -O /tmp/alsa-info.sh http://hg.alsa-project.org/alsa/raw-file/tip/alsa-info.sh >/dev/null 2>&1
@@ -190,7 +194,6 @@ SNDOPTIONS=$(modprobe -c|sed -n 's/^opti QUESTION="yes" PROCEED="yes" -NOUPLOAD="" REPEAT="" while [ -z "$REPEAT" ]; do REPEAT="no"
@@ -411,9 +414,7 @@ then withamixer withalsactl withlsmod - #Workaround, while we sort out pastebin location, since pastebin.ca blocked us. - #NOUPLOAD="yes" - + pbcheck fi fi # proceed
@@ -457,17 +458,6 @@ then withalsactl withlsmod ;; - #### FIX ME - --secure) - withdevices - withconfigs - withaplay - withamixer - withalsactl - withlsmod - withsecure - ;; - ########### --with-aplay) withaplay ;;
@@ -598,7 +588,11 @@ if [[ -n $DIALOG ]] if [[ -n $DIALOG ]] then if [[ -n $NOUPLOAD ]]; then - dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "You requested that your information was NOT automatically uploaded to the pastebin\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + if [[ -n $PBERROR ]]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occured while contacting the pastebin. Your information was NOT automatically uploaded.\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + else + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "You requested that your information was NOT automatically uploaded to the pastebin\n\nYour ALSA information can be seen by looking in $FILE" 10 100 + fi else dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 DIALOG_EXIT_CODE=$?
@@ -610,10 +604,17 @@ fi fi clear if [[ -n $NOUPLOAD ]]; then - echo "You requested that your information was NOT automatically uploaded to the pastebin" - echo "" - echo "Your ALSA information can be seen by looking in $FILE" - echo "" + if [[ -n $PBERROR ]]; then + echo "An error occured while contacting the pastebin. Your information was NOT automatically uploaded." + echo "" + echo "Your ALSA information can be seen by looking in $FILE" + echo "" + else + echo "You requested that your information was NOT automatically uploaded to the pastebin" + echo "" + echo "Your ALSA information can be seen by looking in $FILE" + echo "" + fi fi if [[ -z $NOUPLOAD ]]; then echo "Your ALSA information is located at $FINAL_URL"
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel