mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:25:41 +01:00
alsa-info.sh: command -v cleanups
Inspired in https://github.com/alsa-project/alsa-utils/pull/29 . Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
56f2064bb4
commit
7fbd2311e2
1 changed files with 18 additions and 19 deletions
|
@ -34,8 +34,8 @@ PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
|
||||||
BGTITLE="ALSA-Info v $SCRIPT_VERSION"
|
BGTITLE="ALSA-Info v $SCRIPT_VERSION"
|
||||||
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
|
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
|
||||||
|
|
||||||
WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)
|
WGET=$(command -v wget)
|
||||||
REQUIRES="mktemp grep pgrep whereis awk date uname cat sort dmesg amixer alsactl"
|
REQUIRES="mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Define some simple functions
|
# Define some simple functions
|
||||||
|
@ -241,10 +241,10 @@ withdmesg() {
|
||||||
withpackages() {
|
withpackages() {
|
||||||
local RPM
|
local RPM
|
||||||
local DPKG
|
local DPKG
|
||||||
RPM="$(which rpmquery 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)"
|
RPM="$(command -v rpmquery)"
|
||||||
DPKG="$(which dpkg 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)"
|
DPKG="$(command -v dpkg)"
|
||||||
[ -n "$RPM$DPKG" ] || return
|
[ -n "$RPM$DPKG" ] || return
|
||||||
local PATTERN='(alsa-(lib|oss|plugins|tools|(topology|ucm)-conf|utils)|libalsa|tinycompress)'
|
local PATTERN='(alsa-(lib|oss|plugins|tools|(topology|ucm)-conf|utils|sof-firmware)|libalsa|tinycompress|sof-firmware)'
|
||||||
{
|
{
|
||||||
echo "!!Packages installed"
|
echo "!!Packages installed"
|
||||||
echo "!!--------------------"
|
echo "!!--------------------"
|
||||||
|
@ -278,7 +278,7 @@ get_alsa_library_version() {
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
case "$DISTRIB_ID" in
|
case "$DISTRIB_ID" in
|
||||||
Ubuntu)
|
Ubuntu)
|
||||||
if which dpkg > /dev/null ; then
|
if command -v dpkg > /dev/null ; then
|
||||||
ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
|
ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ get_alsa_library_version() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
elif [ -f /etc/debian_version ]; then
|
elif [ -f /etc/debian_version ]; then
|
||||||
if which dpkg > /dev/null ; then
|
if command -v dpkg > /dev/null ; then
|
||||||
ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
|
ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ get_alsa_library_version() {
|
||||||
|
|
||||||
# Basic requires
|
# Basic requires
|
||||||
for prg in $REQUIRES; do
|
for prg in $REQUIRES; do
|
||||||
t=$(which $prg 2> /dev/null)
|
t=$(command -v $prg)
|
||||||
if test -z "$t"; then
|
if test -z "$t"; then
|
||||||
echo "This script requires $prg utility to continue."
|
echo "This script requires $prg utility to continue."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -314,9 +314,9 @@ for prg in $REQUIRES; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run checks to make sure the programs we need are installed.
|
# Run checks to make sure the programs we need are installed.
|
||||||
LSPCI=$(which lspci 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
|
LSPCI="$(command -v lspci)"
|
||||||
TPUT=$(which tput 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
|
TPUT="$(command -v tput)"
|
||||||
DIALOG=$(which dialog 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
|
DIALOG="$(command -v dialog)"
|
||||||
|
|
||||||
# Check to see if sysfs is enabled in the kernel. We'll need this later on
|
# Check to see if sysfs is enabled in the kernel. We'll need this later on
|
||||||
SYSFS=$(mount | grep sysfs | awk '{ print $3 }');
|
SYSFS=$(mount | grep sysfs | awk '{ print $3 }');
|
||||||
|
@ -409,7 +409,6 @@ if [ "$PROCEED" = "yes" ]; then
|
||||||
if [ -z "$LSPCI" ]; then
|
if [ -z "$LSPCI" ]; then
|
||||||
if [ -d /sys/bus/pci ]; then
|
if [ -d /sys/bus/pci ]; then
|
||||||
echo "This script requires lspci. Please install it, and re-run this script."
|
echo "This script requires lspci. Please install it, and re-run this script."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -425,12 +424,12 @@ ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' |
|
||||||
get_alsa_library_version
|
get_alsa_library_version
|
||||||
ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }')
|
ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }')
|
||||||
|
|
||||||
ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
ESDINST=$(command -v esd)
|
||||||
PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
PAINST=$(command -v pulseaudio)
|
||||||
ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
ARTSINST=$(command -v artsd)
|
||||||
JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
JACKINST=$(command -v jackd)
|
||||||
ROARINST=$(which roard 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
ROARINST=$(command -v roard)
|
||||||
DMIDECODE=$(which dmidecode 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
DMIDECODE=$(command -v dmidecode)
|
||||||
|
|
||||||
#Check for DMI data
|
#Check for DMI data
|
||||||
if [ -d /sys/class/dmi/id ]; then
|
if [ -d /sys/class/dmi/id ]; then
|
||||||
|
|
Loading…
Reference in a new issue