]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsa-info.sh: remove some bashisms to allow run with busybox
authorRudi Heitbaum <rudi@heitbaum.com>
Sat, 20 Dec 2025 05:59:00 +0000 (05:59 +0000)
committerJaroslav Kysela <perex@perex.cz>
Mon, 25 May 2026 10:05:44 +0000 (12:05 +0200)
Closes: https://github.com/alsa-project/alsa-utils/pull/316
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsa-info/alsa-info.sh

index 77ca624d7b466719e8e7a1dc3b7272ef6b075711..1628e603fb00269f4c10034128c5ee6f2e0a0153 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-SCRIPT_VERSION=0.5.3
+SCRIPT_VERSION=0.5.4
 CHANGELOG='https://www.alsa-project.org/alsa-info.sh.changelog'
 
 #################################################################################
@@ -35,7 +35,7 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
 PASTEBINKEY='C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc'
 
 WGET="$(command -v wget)"
-REQUIRES=(mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl)
+REQUIRES="mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl"
 
 #
 # Define some simple functions
@@ -305,7 +305,7 @@ get_alsa_library_version() {
 }
 
 # Basic requires
-for prg in "${REQUIRES[@]}"; do
+for prg in $REQUIRES; do
   t="$(command -v "$prg")"
   if test -z "$t"; then
     echo "This script requires $prg utility to continue."
@@ -414,9 +414,12 @@ fi
 
 # Fetch the info and store in temp files/variables
 TSTAMP=$(LANG=C TZ=UTC date)
-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\|ALT" /etc/{issue,*release,*version})
-read -r KERNEL_RELEASE KERNEL_MACHINE KERNEL_PROCESSOR KERNEL_OS < <(uname -rpmo)
-read -r KERNEL_VERSION < <(uname -v)
+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\|ALT" /etc/issue /etc/*release /etc/*version)
+KERNEL_RELEASE=$(uname -r)
+KERNEL_MACHINE=$(uname -m)
+KERNEL_PROCESSOR=$(uname -p)
+KERNEL_OS=$(uname -o)
+KERNEL_VERSION=$(uname -v)
 if [[ "$KERNEL_VERSION" = *SMP* ]]; then KERNEL_SMP=Yes; else KERNEL_SMP=No; fi
 ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//')
 get_alsa_library_version
@@ -465,7 +468,8 @@ fi
 if [ -d /sys/bus/acpi/devices ]; then
        for f in /sys/bus/acpi/devices/*/adr; do
                ACPI_ADR=$(cat $f 2>/dev/null);
-               if [[ "$ACPI_ADR" -ne 0 ]]; then
+               ACPI_ADR_INT=$(printf "%d" $ACPI_ADR);
+               if [[ "$ACPI_ADR_INT" -ne 0 ]]; then
                        case $ACPI_ADR in
                                0x??????025d*) echo "Realtek $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
                                0x??????01fa*) echo "Cirrus Logic $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;