summaryrefslogtreecommitdiff
path: root/alsa-info
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-27 21:27:05 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-27 21:29:06 +0200
commit8188c2466a7d2179aba4e243ff2b85363961f9f1 (patch)
treef955ed70c6994dd5daa3a259f434a19b03765ae3 /alsa-info
parentf3abdeea00ef7cc07cb44aa43701a278b9c4692f (diff)
downloadalsa-utils-8188c2466a7d2179aba4e243ff2b85363961f9f1.tar.gz
alsa-info: Don't try update when wget isn't available
... otherwise it overwrites a zero size file. Also add a check of zero size file in the update procedure, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'alsa-info')
-rwxr-xr-xalsa-info/alsa-info.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index acd8495..0bc4cd0 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -35,6 +35,8 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
#Define some simple functions
+WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
+
pbcheck(){
[[ $UPLOAD = "no" ]] && return
@@ -46,10 +48,12 @@ pbcheck(){
}
update() {
+ test -z "$WGET" -o ! -x "$WGET" && return
+
SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
- if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
+ if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
if [[ -n $DIALOG ]]
then
OVERWRITE=
@@ -831,8 +835,7 @@ 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 doesnt.
-if
-WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
+if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
then
if [[ -n $DIALOG ]]