4
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
6
#################################################################################
7
#Copyright (C) 2007 Free Software Foundation.
9
#This program is free software; you can redistribute it and/or modify
10
#it under the terms of the GNU General Public License as published by
11
#the Free Software Foundation; either version 2 of the License, or
12
#(at your option) any later version.
14
#This program is distributed in the hope that it will be useful,
15
#but WITHOUT ANY WARRANTY; without even the implied warranty of
16
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
#GNU General Public License for more details.
19
#You should have received a copy of the GNU General Public License
20
#along with this program; if not, write to the Free Software
21
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
##################################################################################
25
#The script was written for 2 main reasons:
26
# 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user.
27
# 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them.
29
#Set the locale (this may or may not be a good idea.. let me know)
32
#Change the PATH variable, so we can run lspci (needed for some distros)
33
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
34
BGTITLE="ALSA-Info v $SCRIPT_VERSION"
35
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
36
#Define some simple functions
39
[[ $UPLOAD = "no" ]] && return
41
if [[ -z $PASTEBIN ]]; then
42
[[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
44
[[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
49
SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
50
wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
51
REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
52
if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
57
dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to install it?\nNOTICE: The original file $0 will be overwritten!" 0 0
59
if [[ $DIALOG_EXIT_CODE = 0 ]]; then
63
if [ -z "$OVERWRITE" ]; then
64
dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to download it?" 0 0
67
if [[ $DIALOG_EXIT_CODE = 0 ]]
69
echo "Newer version detected: $REMOTE_VERSION"
70
echo "To view the ChangeLog, please visit $CHANGELOG"
71
if [ "$OVERWRITE" = "yes" ]; then
73
echo "ALSA-Info script has been updated to v $REMOTE_VERSION"
74
echo "Please re-run the script"
75
rm $SHFILE 2>/dev/null
77
echo "ALSA-Info script has been downloaded as $SHFILE."
78
echo "Please re-run the script from new location."
82
rm $SHFILE 2>/dev/null
85
echo "Newer version detected: $REMOTE_VERSION"
86
echo "To view the ChangeLog, please visit $CHANGELOG"
88
echo "The original file $0 will be overwritten!"
89
echo -n "If you do not like to proceed, press Ctrl-C now.." ; read inp
91
echo "ALSA-Info script has been updated. Please re-run it."
92
rm $SHFILE 2>/dev/null
94
echo "ALSA-Info script has been downloaded $SHFILE."
95
echo "Please, re-run it from new location."
100
rm $SHFILE 2>/dev/null
105
if [ -n "$TEMPDIR" -a "$KEEP_FILES" != "yes" ]; then
106
rm -rf "$TEMPDIR" 2>/dev/null
108
test -n "$KEEP_OUTPUT" || rm -f "$NFILE"
113
echo "!!Aplay/Arecord output" >> $FILE
114
echo "!!------------" >> $FILE
116
echo "APLAY" >> $FILE
118
aplay -l >> $FILE 2>&1
120
echo "ARECORD" >> $FILE
122
arecord -l >> $FILE 2>&1
127
echo "!!All Loaded Modules" >> $FILE
128
echo "!!------------------" >> $FILE
130
lsmod |awk {'print $1'} >> $FILE
136
echo "!!Amixer output" >> $FILE
137
echo "!!-------------" >> $FILE
139
for i in `grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1} '` ; do
140
CARD_NAME=`grep "^ *$i " $TEMPDIR/alsacards.tmp|awk {'print $2'}`
141
echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE
143
amixer -c$i info>> $FILE 2>&1
144
amixer -c$i>> $FILE 2>&1
151
echo "!!Alsactl output" >> $FILE
152
echo "!!-------------" >> $FILE
155
if [ -x /usr/sbin/alsactl ]; then
156
exe="/usr/sbin/alsactl"
158
if [ -x /usr/local/sbin/alsactl ]; then
159
exe="/usr/local/sbin/alsactl"
161
if [ -z "$exe" ]; then
162
exe=`whereis alsactl | cut -d ' ' -f 2`
164
$exe -f $TEMPDIR/alsactl.tmp store
165
echo "--startcollapse--" >> $FILE
166
cat $TEMPDIR/alsactl.tmp >> $FILE
167
echo "--endcollapse--" >> $FILE
173
echo "!!ALSA Device nodes" >> $FILE
174
echo "!!-----------------" >> $FILE
176
ls -la /dev/snd/* >> $FILE
182
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] || [[ -e $HOME/.asoundrc.asoundconf ]]
184
echo "!!ALSA configuration files" >> $FILE
185
echo "!!------------------------" >> $FILE
188
#Check for ~/.asoundrc
189
if [[ -e $HOME/.asoundrc ]]
191
echo "!!User specific config file (~/.asoundrc)" >> $FILE
193
cat $HOME/.asoundrc >> $FILE
197
#Check for .asoundrc.asoundconf (seems to be Ubuntu specific)
198
if [[ -e $HOME/.asoundrc.asoundconf ]]
200
echo "!!asoundconf-generated config file" >> $FILE
202
cat $HOME/.asoundrc.asoundconf >> $FILE
206
#Check for /etc/asound.conf
207
if [[ -e /etc/asound.conf ]]
209
echo "!!System wide config file (/etc/asound.conf)" >> $FILE
211
cat /etc/asound.conf >> $FILE
221
for i in /sys/class/sound/*; do
224
if [ -f $i/init_pin_configs ]; then
225
if [ -z "$printed" ]; then
226
echo "!!Sysfs Files" >> $FILE
227
echo "!!-----------" >> $FILE
230
for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs; do
231
echo "$i/$f:" >> $FILE
240
if [ -n "$printed" ]; then
246
echo "!!ALSA/HDA dmesg" >> $FILE
247
echo "!!------------------" >> $FILE
249
dmesg | grep -C1 -E 'ALSA|HDA|HDMI|sound|hda.codec|hda.intel' >> $FILE
265
get_alsa_library_version() {
266
ALSA_LIB_VERSION=`grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null|awk {'print $3'}|sed 's/"//g'`
268
if [ -z "$ALSA_LIB_VERSION" ]; then
269
if [ -f /etc/lsb-release ]; then
271
case "$DISTRIB_ID" in
273
if which dpkg > /dev/null ; then
274
ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -`
277
if [ "$ALSA_LIB_VERSION" = "<none>" ]; then
286
elif [ -f /etc/debian_version ]; then
287
if which dpkg > /dev/null ; then
288
ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -`
291
if [ "$ALSA_LIB_VERSION" = "<none>" ]; then
300
#Run checks to make sure the programs we need are installed.
301
LSPCI=$(which lspci 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null);
302
TPUT=$(which tput 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null);
303
DIALOG=$(which dialog 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
305
#Check to see if sysfs is enabled in the kernel. We'll need this later on
306
SYSFS=$(mount |grep sysfs|awk {'print $3'});
308
#Check modprobe config files for sound related options
309
SNDOPTIONS=$(modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p')
315
WWWSERVICE="www.alsa-project.org"
320
while [ -z "$REPEAT" ]; do
323
--update|--help|--about)
337
WWWSERVICE="pastebin"
354
#Script header output.
355
if [ "$WELCOME" = "yes" ]; then
358
This script visits the following commands/files to collect diagnostic
359
information about your ALSA installation and sound related hardware.
371
See '$0 --help' for command line options.
373
if [[ -n "$DIALOG" ]]; then
374
dialog --backtitle "$BGTITLE" \
375
--title "ALSA-Info script v $SCRIPT_VERSION" \
376
--msgbox "$greeting_message" 20 80
378
echo "ALSA Information Script v $SCRIPT_VERSION"
379
echo "--------------------------------"
380
echo "$greeting_message"
385
TEMPDIR=`mktemp -t -d alsa-info.XXXXXXXXXX` || exit 1
386
FILE="$TEMPDIR/alsa-info.txt"
387
if [ -z "$NFILE" ]; then
388
NFILE=`mktemp -t alsa-info.txt.XXXXXXXXXX` || exit 1
393
if [ "$PROCEED" = "yes" ]; then
397
echo "This script requires lspci. Please install it, and re-run this script."
401
#Fetch the info and store in temp files/variables
402
DISTRO=`grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus" /etc/{issue,*release,*version}`
403
KERNEL_VERSION=`uname -r`
404
KERNEL_PROCESSOR=`uname -p`
405
KERNEL_MACHINE=`uname -m`
407
[[ `uname -v |grep SMP` ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No"
408
ALSA_DRIVER_VERSION=`cat /proc/asound/version |head -n1|awk {'print $7'} |sed 's/\.$//'`
409
get_alsa_library_version
410
ALSA_UTILS_VERSION=`amixer -v |awk {'print $3'}`
411
VENDOR_ID=`lspci -vn |grep 040[1-3] | awk -F':' '{print $3}'|awk {'print substr($0, 2);}' >$TEMPDIR/vendor_id.tmp`
412
DEVICE_ID=`lspci -vn |grep 040[1-3] | awk -F':' '{print $4}'|awk {'print $1'} >$TEMPDIR/device_id.tmp`
413
LAST_CARD=$((`grep "]: " /proc/asound/cards | wc -l` - 1 ))
415
ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
416
PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
417
ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
418
JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
419
DMIDECODE=$(which dmidecode 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
422
if [ -d /sys/class/dmi/id ]; then
423
# No root privileges are required when using sysfs method
424
DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)
425
DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
426
elif [ -x $DMIDECODE ]; then
427
DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
428
DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
431
cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
432
cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
433
lspci |grep -i "multi\|audio">$TEMPDIR/lspci.tmp
435
#Check for HDA-Intel cards codec#*
436
cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null
438
#Check for AC97 cards codec
439
cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null
440
cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null
442
#Fetch the info, and put it in $FILE in a nice readable format.
443
if [[ -z $PASTEBIN ]]; then
444
echo "upload=true&script=true&cardinfo=" > $FILE
446
echo "name=$USER&type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content=" > $FILE
448
echo "!!################################" >> $FILE
449
echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE
450
echo "!!################################" >> $FILE
452
echo "!!Script ran on: `LANG=C TZ=UTC date`" >> $FILE
455
echo "!!Linux Distribution" >> $FILE
456
echo "!!------------------" >> $FILE
458
echo $DISTRO >> $FILE
461
echo "!!DMI Information" >> $FILE
462
echo "!!---------------" >> $FILE
464
echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE
465
echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
468
echo "!!Kernel Information" >> $FILE
469
echo "!!------------------" >> $FILE
471
echo "Kernel release: $KERNEL_VERSION" >> $FILE
472
echo "Operating System: $KERNEL_OS" >> $FILE
473
echo "Architecture: $KERNEL_MACHINE" >> $FILE
474
echo "Processor: $KERNEL_PROCESSOR" >> $FILE
475
echo "SMP Enabled: $KERNEL_SMP" >> $FILE
478
echo "!!ALSA Version" >> $FILE
479
echo "!!------------" >> $FILE
481
echo "Driver version: $ALSA_DRIVER_VERSION" >> $FILE
482
echo "Library version: $ALSA_LIB_VERSION" >> $FILE
483
echo "Utilities version: $ALSA_UTILS_VERSION" >> $FILE
486
echo "!!Loaded ALSA modules" >> $FILE
487
echo "!!-------------------" >> $FILE
489
cat $TEMPDIR/alsamodules.tmp >> $FILE
492
echo "!!Sound Servers on this system" >> $FILE
493
echo "!!----------------------------" >> $FILE
495
if [[ -n $PAINST ]];then
496
[[ `pgrep '^(.*/)?pulseaudio$'` ]] && PARUNNING="Yes" || PARUNNING="No"
497
echo "Pulseaudio:" >> $FILE
498
echo " Installed - Yes ($PAINST)" >> $FILE
499
echo " Running - $PARUNNING" >> $FILE
502
if [[ -n $ESDINST ]];then
503
[[ `pgrep '^(.*/)?esd$'` ]] && ESDRUNNING="Yes" || ESDRUNNING="No"
504
echo "ESound Daemon:" >> $FILE
505
echo " Installed - Yes ($ESDINST)" >> $FILE
506
echo " Running - $ESDRUNNING" >> $FILE
509
if [[ -n $ARTSINST ]];then
510
[[ `pgrep '^(.*/)?artsd$'` ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No"
511
echo "aRts:" >> $FILE
512
echo " Installed - Yes ($ARTSINST)" >> $FILE
513
echo " Running - $ARTSRUNNING" >> $FILE
516
if [[ -n $JACKINST ]];then
517
[[ `pgrep '^(.*/)?jackd$'` ]] && JACKRUNNING="Yes" || JACKRUNNING="No"
518
echo "Jack:" >> $FILE
519
echo " Installed - Yes ($JACKINST)" >> $FILE
520
echo " Running - $JACKRUNNING" >> $FILE
523
if [[ -z "$PAINST" && -z "$ESDINST" && -z "$ARTSINST" && -z "$JACKINST" ]];then
524
echo "No sound servers found." >> $FILE
528
echo "!!Soundcards recognised by ALSA" >> $FILE
529
echo "!!-----------------------------" >> $FILE
531
cat $TEMPDIR/alsacards.tmp >> $FILE
534
echo "!!PCI Soundcards installed in the system" >> $FILE
535
echo "!!--------------------------------------" >> $FILE
537
cat $TEMPDIR/lspci.tmp >> $FILE
540
echo "!!Advanced information - PCI Vendor/Device/Susbsystem ID's" >> $FILE
541
echo "!!--------------------------------------------------------" >> $FILE
543
lspci -vvn |grep -A1 040[1-3] >> $FILE
549
echo "!!Modprobe options (Sound related)" >> $FILE
550
echo "!!--------------------------------" >> $FILE
552
modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> $FILE
559
echo "!!Loaded sound module options" >> $FILE
560
echo "!!--------------------------" >> $FILE
562
for mod in `cat /proc/asound/modules|awk {'print $2'}`;do
563
echo "!!Module: $mod" >> $FILE
564
for params in `echo $SYSFS/module/$mod/parameters/*`; do
566
echo "$params : `cat $params`" | sed 's:.*/::';
573
if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]
575
echo "!!HDA-Intel Codec information" >> $FILE
576
echo "!!---------------------------" >> $FILE
577
echo "--startcollapse--" >> $FILE
579
cat $TEMPDIR/alsa-hda-intel.tmp >> $FILE
580
echo "--endcollapse--" >> $FILE
585
if [ -s "$TEMPDIR/alsa-ac97.tmp" ]
587
echo "!!AC97 Codec information" >> $FILE
588
echo "!!---------------------------" >> $FILE
589
echo "--startcollapse--" >> $FILE
591
cat $TEMPDIR/alsa-ac97.tmp >> $FILE
593
cat $TEMPDIR/alsa-ac97-regs.tmp >> $FILE
594
echo "--endcollapse--" >> $FILE
600
#If no command line options are specified, then run as though --with-all was specified
610
#loop through command line arguments, until none are left.
639
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
663
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
665
echo "!!ALSA configuration files" >> $FILE
666
echo "!!------------------------" >> $FILE
669
#Check for ~/.asoundrc
670
if [[ -e $HOME/.asoundrc ]]
672
echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE
674
cat $HOME/.asoundrc >> $FILE
679
#Check for /etc/asound.conf
680
if [[ -e /etc/asound.conf ]]
682
echo "!!System wide config file (/etc/asound.conf)" >> $FILE
684
cat /etc/asound.conf >> $FILE
697
echo "Written/Tested by the following users of #alsa on irc.freenode.net:"
699
echo " wishie - Script author and developer / Testing"
700
echo " crimsun - Various script ideas / Testing"
701
echo " gnubien - Various script ideas / Testing"
702
echo " GrueMaster - HDA Intel specific items / Testing"
703
echo " olegfink - Script update function"
704
echo " TheMuso - display to stdout functionality"
708
echo "alsa-info.sh version $SCRIPT_VERSION"
710
echo "Available options:"
711
echo " --with-aplay (includes the output of aplay -l)"
712
echo " --with-amixer (includes the output of amixer)"
713
echo " --with-alsactl (includes the output of alsactl)"
714
echo " --with-configs (includes the output of ~/.asoundrc and"
715
echo " /etc/asound.conf if they exist)"
716
echo " --with-devices (shows the device nodes in /dev/snd/)"
717
echo " --with-dmesg (shows the ALSA/HDA kernel messages)"
719
echo " --output FILE (specify the file to output for no-upload mode)"
720
echo " --update (check server for script updates)"
721
echo " --upload (upload contents to remote server)"
722
echo " --no-upload (do not upload contents to remote server)"
723
echo " --pastebin (use http://pastebin.ca) as remote server"
724
echo " instead www.alsa-project.org"
725
echo " --stdout (print alsa information to standard output"
726
echo " instead of a file)"
727
echo " --about (show some information about the script)"
728
echo " --debug (will run the script as normal, but will not"
729
echo " delete $FILE)"
737
if [ "$PROCEED" = "no" ]; then
741
if [ "$UPLOAD" = "ask" ]; then
742
if [[ -n "$DIALOG" ]]; then
743
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
745
if [ $DIALOG_EXIT_CODE != 0 ]; then
751
echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : "
753
if [ "$CONFIRM" != "y" ]; then
762
if [ "$UPLOAD" = "no" ]; then
764
if [ -z "$TOSTDOUT" ]; then
765
mv -f $FILE $NFILE || exit 1
771
if [[ -n $PBERROR ]]; then
772
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
774
dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
779
if [[ -n $PBERROR ]]; then
780
echo "An error occurred while contacting the $WWWSERVICE."
781
echo "Your information was NOT automatically uploaded."
783
echo "Your ALSA information is in $NFILE"
786
if [ -z "$TOSTDOUT" ]; then
788
echo "Your ALSA information is in $NFILE"
798
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
800
WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
806
if [[ -z $PASTEBIN ]]; then
807
wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
808
{ for i in 10 20 30 40 50 60 70 80 90; do
812
echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0
814
wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
815
{ for i in 10 20 30 40 50 60 70 80 90; do
819
echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0
822
dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
824
if [ $DIALOG_EXIT_CODE = 0 ]; then
825
grep -v "alsa-info.txt" $FILE >$TEMPDIR/uploaded.txt
826
dialog --backtitle "$BGTITLE" --textbox $TEMPDIR/uploaded.txt 0 0
834
if [[ -z $PASTEBIN ]]; then
835
echo -n "Uploading information to www.alsa-project.org ... "
836
wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp &
838
echo -n "Uploading information to www.pastebin.ca ... "
839
wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp &
842
#Progess spinner for wget transfer.
846
while pgrep wget &>/dev/null
848
echo -en "\b${sp:i++%${#sp}:1}"
856
#See if tput is available, and use it if it is.
859
if [[ -z $PASTEBIN ]]; then
860
FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0`
862
FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp |sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p';tput sgr0`
865
if [[ -z $PASTEBIN ]]; then
866
FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2`
868
FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp |sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'`
872
#Output the URL of the uploaded file.
873
echo "Your ALSA information is located at $FINAL_URL"
874
echo "Please inform the person helping you."
877
#We couldnt find a suitable wget, so tell the user to upload manually.
879
mv -f $FILE $NFILE || exit 1
883
if [[ -z $PASTEBIN ]]; then
885
echo "Could not automatically upload output to http://www.alsa-project.org"
886
echo "Possible reasons are:"
887
echo " 1. Couldnt find 'wget' in your PATH"
888
echo " 2. Your version of wget is less than 1.8.2"
890
echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post."
894
echo "Could not automatically upload output to http://www.pastebin.ca"
895
echo "Possible reasons are:"
896
echo " 1. Couldnt find 'wget' in your PATH"
897
echo " 2. Your version of wget is less than 1.8.2"
899
echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post."
903
if [[ -z $PASTEBIN ]]; then
904
dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible 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
906
dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible 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