From: Rudi Heitbaum Date: Sat, 20 Dec 2025 05:59:00 +0000 (+0000) Subject: alsa-info.sh: remove some bashisms to allow run with busybox X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=5b44c57e899c1897dfaaa342574f951c66680a8d;p=alsa-utils.git alsa-info.sh: remove some bashisms to allow run with busybox Closes: https://github.com/alsa-project/alsa-utils/pull/316 Signed-off-by: Rudi Heitbaum Signed-off-by: Jaroslav Kysela --- diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 77ca624..1628e60 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -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;;