From patchwork Fri Jan 3 17:55:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ward X-Patchwork-Id: 193985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0612FC2D0C2 for ; Fri, 3 Jan 2020 17:59:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 867D7215A4 for ; Fri, 3 Jan 2020 17:59:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="QHNaRrNS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 867D7215A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ll.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8BDA81772; Fri, 3 Jan 2020 18:58:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8BDA81772 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578074373; bh=P9iOWZcR2nygeSsmsaByeCeHSgk2n9s+1zJdetn7MsI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QHNaRrNSmrzv0MDFd2+uKbMleh2zoGJ3duwYwFXhB7DfoPU41ZBKevwmGLFObUDp7 /Uc2XmXnVnxJDhPyGB5aBQYxHC6Uic3ax6fC+HRHYIt1x0t8Wf+vZ5RwcyQUz3mFgH PPoJoleEe9ZQ7ErHfW1MTr2sovdWSVsKDRqUr3uA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 56882F80279; Fri, 3 Jan 2020 18:56:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CF2A1F8013E; Fri, 3 Jan 2020 18:56:21 +0100 (CET) Received: from llmx3.ll.mit.edu (llmx3.ll.mit.edu [129.55.12.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 66146F8013E for ; Fri, 3 Jan 2020 18:56:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 66146F8013E Received: from LLE2K16-MBX01.mitll.ad.local (LLE2K16-MBX01.mitll.ad.local) by llmx3.ll.mit.edu (unknown) with ESMTPS id 003HuGtZ011841; Fri, 3 Jan 2020 12:56:16 -0500 From: David Ward To: Takashi Iwai , Date: Fri, 3 Jan 2020 12:55:50 -0500 Message-ID: <1578074158-30328-4-git-send-email-david.ward@ll.mit.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> References: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-01-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001030164 Cc: David Ward Subject: [alsa-devel] [PATCH v2 alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Read card names directly from individual procfs files, and pass them to amixer using the '-c' option. Signed-off-by: David Ward --- 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 From patchwork Fri Jan 3 17:55:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ward X-Patchwork-Id: 193984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2003C2D0CE for ; Fri, 3 Jan 2020 18:00:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6ADE322522 for ; Fri, 3 Jan 2020 18:00:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Mc0C/u9A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6ADE322522 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ll.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A3D0B17A2; Fri, 3 Jan 2020 18:59:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A3D0B17A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578074438; bh=KBKwpWtW6cBCRODHbfjCpZRkZ/B0BUWQo2soKTrh6mo=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Mc0C/u9A6aBWoU4yMxKxEN7T2nG2sHRrnPkeDfsjo4U58bwoisvD9UmdHppNRoW/I x0FAmJA4jWG9i1eSPM9n63ei7kk8H8/VvUw2h3+9VmUherpdc5gyxGIHYOZ0UTr3KX +P9LBxlvXL+iXLW3S8Zf8PHrl9/osXChgtYHihhw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D19AFF8015C; Fri, 3 Jan 2020 18:56:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 096F2F80274; Fri, 3 Jan 2020 18:56:24 +0100 (CET) Received: from llmx3.ll.mit.edu (llmx3.ll.mit.edu [129.55.12.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AA4CDF8015C for ; Fri, 3 Jan 2020 18:56:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AA4CDF8015C Received: from LLE2K16-MBX01.mitll.ad.local (LLE2K16-MBX01.mitll.ad.local) by llmx3.ll.mit.edu (unknown) with ESMTPS id 003HuJHL011845; Fri, 3 Jan 2020 12:56:19 -0500 From: David Ward To: Takashi Iwai , Date: Fri, 3 Jan 2020 12:55:52 -0500 Message-ID: <1578074158-30328-6-git-send-email-david.ward@ll.mit.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> References: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-01-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001030164 Cc: David Ward Subject: [alsa-devel] [PATCH v2 alsa-utils 05/11] alsa-info.sh: Exit script after writing information to stdout X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The '--stdout' option is mutually exclusive with uploading the file. Signed-off-by: David Ward --- 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 From patchwork Fri Jan 3 17:55:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ward X-Patchwork-Id: 193983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E392C2D0C2 for ; Fri, 3 Jan 2020 18:02:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0CC7215A4 for ; Fri, 3 Jan 2020 18:02:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="k0e1dqGL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0CC7215A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ll.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E27EC179B; Fri, 3 Jan 2020 19:01:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E27EC179B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578074527; bh=1ZFW7I9YBd1KEjXHGhDpeqNvLJXr5rPJwMGJeyfhU38=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=k0e1dqGLLlXhORRI5wAWFPCzjd+hzjSWK+M3QhTDa36oHOZZwKCgvhh6POmVE/Mtq sgaRNAtpW7UGuuINDM5stNPdlNnIDub7i4APSVihSUTbN08d91ZpaNQ90QoS33eBRs aLEvEbtWV3KsCB+YqC0z5gYi5E6zC2+pLDpzBgQc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C6354F8029A; Fri, 3 Jan 2020 18:56:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B924FF8028B; Fri, 3 Jan 2020 18:56:27 +0100 (CET) Received: from llmx3.ll.mit.edu (llmx3.ll.mit.edu [129.55.12.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E10F4F8015C for ; Fri, 3 Jan 2020 18:56:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E10F4F8015C Received: from LLE2K16-MBX01.mitll.ad.local (LLE2K16-MBX01.mitll.ad.local) by llmx3.ll.mit.edu (unknown) with ESMTPS id 003HuMXh011855; Fri, 3 Jan 2020 12:56:22 -0500 From: David Ward To: Takashi Iwai , Date: Fri, 3 Jan 2020 12:55:54 -0500 Message-ID: <1578074158-30328-8-git-send-email-david.ward@ll.mit.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> References: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-01-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001030164 Cc: David Ward Subject: [alsa-devel] [PATCH v2 alsa-utils 07/11] alsa-info.sh: Remove progress spinner during upload without dialog X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- 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 From patchwork Fri Jan 3 17:55:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ward X-Patchwork-Id: 193982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B780AC2D0C2 for ; Fri, 3 Jan 2020 18:03:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35047215A4 for ; Fri, 3 Jan 2020 18:03:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="gVYm57kO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35047215A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ll.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 504234E; Fri, 3 Jan 2020 19:02:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 504234E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578074606; bh=sCaxrpoD/19CZrCif24EAad6PyrK2iu1gO8bMUW3VfQ=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gVYm57kOJHDV253vSqVFcLhleF+szAWSlJQlHJupJgfLL3Ikmvv29SRsFwwdaxStI Kox2SaY6Kgpua2pt7r+H3CATb6jU4nfkdC7Wy64jGulq86wEVZQgkHlMggH7aoZOuv h7emqoMBi5TZz2lnGqsoS3WVu6bKa3H+8OaREWOs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5B66EF802DF; Fri, 3 Jan 2020 18:56:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3B253F8028D; Fri, 3 Jan 2020 18:56:30 +0100 (CET) Received: from llmx3.ll.mit.edu (llmx3.ll.mit.edu [129.55.12.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 99B02F80278 for ; Fri, 3 Jan 2020 18:56:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 99B02F80278 Received: from LLE2K16-MBX01.mitll.ad.local (LLE2K16-MBX01.mitll.ad.local) by llmx3.ll.mit.edu (unknown) with ESMTPS id 003HuOO2011866; Fri, 3 Jan 2020 12:56:24 -0500 From: David Ward To: Takashi Iwai , Date: Fri, 3 Jan 2020 12:55:56 -0500 Message-ID: <1578074158-30328-10-git-send-email-david.ward@ll.mit.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> References: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-01-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001030164 Cc: David Ward Subject: [alsa-devel] [PATCH v2 alsa-utils 09/11] alsa-info.sh: Condense nested commands for formatting upload result X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Signed-off-by: David Ward --- 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&encryptpw=blahblah" &>$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. From patchwork Fri Jan 3 17:55:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ward X-Patchwork-Id: 193981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27380C2D0C2 for ; Fri, 3 Jan 2020 18:04:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A706C215A4 for ; Fri, 3 Jan 2020 18:04:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="jjTOdgIX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A706C215A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ll.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 011E717AF; Fri, 3 Jan 2020 19:03:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 011E717AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578074685; bh=aMuhIELzZOoqx9CqpWKImnjrwZAL6wiy1GlRS9QhSn0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jjTOdgIXSqIDl3vVSMSiIFQgZoXU5nMVcvbRVV2Mdcet72e0pnjuaweHWQ3ZSB8oI RdbFGi1iUKjzpCli9C0MjihNXLIGpRnCCGZRI9SnvKmVYf9rRNE6C5KSwv5IzIf8nx kxc+GpiB8Yd9PDR2TY3PNonmf/ijZhBR5nkoYaJA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 40DEFF802F8; Fri, 3 Jan 2020 18:56:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 42C8EF802A2; Fri, 3 Jan 2020 18:56:33 +0100 (CET) Received: from llmx3.ll.mit.edu (llmx3.ll.mit.edu [129.55.12.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD731F8028D for ; Fri, 3 Jan 2020 18:56:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD731F8028D Received: from LLE2K16-MBX01.mitll.ad.local (LLE2K16-MBX01.mitll.ad.local) by llmx3.ll.mit.edu (unknown) with ESMTPS id 003HuRPV011874; Fri, 3 Jan 2020 12:56:28 -0500 From: David Ward To: Takashi Iwai , Date: Fri, 3 Jan 2020 12:55:58 -0500 Message-ID: <1578074158-30328-12-git-send-email-david.ward@ll.mit.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> References: <1578074158-30328-1-git-send-email-david.ward@ll.mit.edu> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-01-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001030164 Cc: David Ward Subject: [alsa-devel] [PATCH v2 alsa-utils 11/11] alsa-info.sh: Warn after actual upload failure; do not ping server X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- 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&encryptpw=blahblah" &>$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&encryptpw=blahblah" &>$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