Skip to contentSkip to conversation

alsa-info.sh - Add checks for device permissions

PATCH New Travis Place 1 participant 1 message Aug 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa-info.sh - Add checks for device permissions

Changelog:

1) Show if the script was run as root, or as a user.

2) Check the group permissions of the ALSA device nodes, and check to see if the user is in that group, and display a warning if they are not.

3) Bumped version to 0.4.52

Notes: Im sure this code is far from perfect, and welcome any changes to it.

alsa-info.sh.latest renamed from alsa-info.sh +8 -1
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-SCRIPT_VERSION=0.4.51
+SCRIPT_VERSION=0.4.52
 CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
 
 #################################################################################
@@ -138,6 +138,12 @@
         echo "!!-----------------" >> $FILE
         echo "" >> $FILE
         ls -la /dev/snd/* >> $FILE
+	if [[ $USER != "root" ]];then
+	echo "" >> $FILE
+	for groups in `ls -la /dev/snd/*|awk {'print $4'}`; do
+	groups $USER|grep $groups >/dev/null || echo "User not in group $groups!" >> $FILE;
+	done
+	fi
         echo "" >> $FILE
         echo "" >> $FILE
 }
@@ -312,6 +318,7 @@
 echo "!!################################" >> $FILE
 echo "" >> $FILE
 echo "!!Script ran on: `LANG=C date`" >> $FILE
+echo "!!Script ran as: `if [ $USER == "root" ];then echo 'Root'; else echo 'A User';fi`" >> $FILE
 echo "" >> $FILE
 echo "" >> $FILE
 echo "!!Linux Distribution" >> $FILE

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel