summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux
diff options
context:
space:
mode:
authorChristian Rößler2018-12-04 15:44:45 +0100
committerChristian Rößler2018-12-04 15:44:45 +0100
commit2f54068fa1a4c4c17ea47eb987df213370707bca (patch)
tree035cf6f5b834c67dd6b963c090f3df19a100de5a /core/modules/run-virt/data/opt/openslx/vmchooser/data/linux
parent[run-virt] Linux scripts sound mute - aaaargh bug fixed. (diff)
downloadmltk-2f54068fa1a4c4c17ea47eb987df213370707bca.tar.gz
mltk-2f54068fa1a4c4c17ea47eb987df213370707bca.tar.xz
mltk-2f54068fa1a4c4c17ea47eb987df213370707bca.zip
[run-virt] Linux scripts: Sound vol. to 100%, if unmuted
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/data/linux')
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc23
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/70_mutesound.inc84
2 files changed, 63 insertions, 44 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc
index 4e44e076..5b69d90c 100755
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc
@@ -1,4 +1,6 @@
### Variablen #####################################
+
+##### User related#################
LOCALUSER=student
USERHOME=/home/"$LOCALUSER"
USERHOMEDIR=/home/"$LOCALUSER"/PERSISTENT
@@ -6,6 +8,8 @@ USERDESKTOP=$(su -c - $LOCALUSER "xdg-user-dir DESKTOP")
[ "$USERDESKTOP" == "" ] && USERDESKTOP="$USERHOME"
USERLOGFILE="$USERDESKTOP"/openslx.log
+
+##### Mounting, network, PW #######
DISKMOUNTDIR=/mnt/diskmount
SLXCONFIGFILE="$DISKMOUNTDIR"/openslx.ini
CONFIGFILE="$DISKMOUNTDIR"/shares.dat
@@ -20,26 +24,31 @@ if [ ! $(mount 2>/dev/null | grep -q "$DISKMOUNTDIR") ]; then
mount /dev/fd1 "$DISKMOUNTDIR" 2>/dev/null 1>&2 # Zu erl.: Fehlerfangen
fi
+# CIFSVERSIONS="3.11 3.0 2.1 2.0 1.0"
+CIFSVERSIONS="3.0 2.1 1.0 3.11 2.0"
+MOUNTCIFSPRAE="-v -t cifs -o "
+MOUNTCIFSOPTS="uid=$(id --user "$LOCALUSER"),gid=$(id --group "$LOCALUSER"),forceuid,forcegid,file_mode=0700,dir_mode=0700,nobrl,noacl"
+MOUNTNFSPRAE="-v -t nfs4 -o "
+MOUNTNFSOPTS="rw,nosuid,nodev,nolock,intr,hard,sloppy"
+
NATADDR=$(head -n 1 "$CONFIGFILE" | cut -f 1 -d$'\t')
PORT=$(head -n 1 "$CONFIGFILE" | cut -f 2 -d$'\t')
SCHLUESSEL=$(head -n 1 "$CONFIGFILE" | cut -f 4 -d$'\t')
GLOBALDOMAINUSER=$(head -n 1 "$CONFIGFILE" | cut -f 5 -d$'\t')
GLOBALUSER=$(echo "$GLOBALDOMAINUSER" | cut -d '\' -f 2)
+##### Remap #######################
REMAPMODE=$(grep '^remapMode=' "$SLXCONFIGFILE" | cut -d '=' -f 2)
CREATEMISSING=$(grep '^createMissingRemap=' "$SLXCONFIGFILE" | cut -d '=' -f 2)
+##### Script (Autostart ) #########
SCRIPTUSER=$(grep '^scriptUser=' "$SLXCONFIGFILE" | cut -d '=' -f 2)
SCRIPTVISIBILITY=$(grep '^scriptVisibility=' "$SLXCONFIGFILE" | cut -d '=' -f 2)
SCRIPTEXT=$(grep scriptExt "$DISKMOUNTDIR/openslx.ini" | cut -f 2 -d "=")
-MUTESOUND=$(grep muteSound "$DISKMOUNTDIR/openslx.ini" | cut -f 2 -d "=")
-# CIFSVERSIONS="3.11 3.0 2.1 2.0 1.0"
-CIFSVERSIONS="3.0 2.1 1.0 3.11 2.0"
+##### Sound #######################
+MUTESOUND=$(grep muteSound "$DISKMOUNTDIR/openslx.ini" | cut -f 2 -d "=")
+SOUNDVOL="100%"
-MOUNTCIFSPRAE="-v -t cifs -o "
-MOUNTCIFSOPTS="uid=$(id --user "$LOCALUSER"),gid=$(id --group "$LOCALUSER"),forceuid,forcegid,file_mode=0700,dir_mode=0700,nobrl,noacl"
-MOUNTNFSPRAE="-v -t nfs4 -o "
-MOUNTNFSOPTS="rw,nosuid,nodev,nolock,intr,hard,sloppy"
### Variablen Ende ################################
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/70_mutesound.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/70_mutesound.inc
index 3b1c4c76..542b50d7 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/70_mutesound.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/70_mutesound.inc
@@ -19,49 +19,59 @@ if [ -n "$PACTL" ]; then
x=2
# while [ $(su -c "pulseaudio --check" "$LOCALUSER") ]; do
while [ -z "$(ps aux|grep /pulseaudio|grep -v grep)" ]; do
- logger "openslx sound muter: Waiting for pulseaudio..."
if [ "$x" -gt 30 ]; then
logger "openslx sound muter: Waited $x sec for pulseaudio, giving up."
- [ -n "$AMIXER" ] && SYSTEM=alsa || SYSTEM="" # unset -v SYSTEM
break
fi
sleep $x; x=$((x + 2))
+ logger "openslx sound muter: Waited $x seconds for pulseaudio..."
done
+else
+ SYSTEM=alsa
+ logger "openslx sound muter: alsa seems to be installed..."
fi
- # MUTESOUND: Sound 1=aus, 0=an
- # This is a bit problematic as there is no way to actually know whether
- # a command works within different distributions, esp. alsamixer commands
- # tend to successfully mute but not unmute. So we (at this stage) just
- # hammer known commands through - one will work, hopefully.
- case $MUTESOUND in 0) logger "openslx sound muter: Unmuting sound, using $SYSTEM."
- case $SYSTEM in pulse) XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "pactl set-sink-mute 0 0" "$LOCALUSER"
- PACTLERR=$?
- XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$AMIXER -q -D pulse sset Master unmute" "$LOCALUSER"
- AMIXERERR=$?
- logger "openslx sound muter: Sound hopefully unmuted, pactl: $PACTLERR, amixer: $AMIXERERR."
- ;;
- alsa) "$AMIXER set Master unmute"
- AMIXERERR=$?
- logger "openslx sound muter: Sound hopefully unmuted, amixer: $AMIXERERR."
- ;;
- esac
- ;;
- 1) logger "openslx sound muter: Muting sound, using $SYSTEM"
- case $SYSTEM in pulse) XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "pactl set-sink-mute 0 1" "$LOCALUSER"
- PACTLERR=$?
- XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$AMIXER -q -D pulse sset Master mute" "$LOCALUSER"
- AMIXERERR=$?
- logger "openslx sound muter: Sound hopefully unmuted, pactl: $PACTLERR, amixer: $AMIXERERR."
- ;;
- alsa) "$AMIXER" set Master mute
- AMIXERERR=$?
- logger "openslx sound muter: Sound hopefully unmuted, amixer: $AMIXERERR."
- ;;
- esac
- ;;
- *) logger "openslx sound muter: Unknown muteSound option $MUTESOUND"
- ;;
- esac
- logger "openslx sound muter: end."
+# MUTESOUND: Sound 1=aus, 0=an
+# This is a bit problematic as there is no way to actually know whether
+# a command works within different distributions, esp. alsamixer commands
+# tend to successfully mute but not unmute. So we (at this stage) just
+# hammer known commands through - one will work, hopefully.
+case $MUTESOUND in 0)
+ logger "openslx sound muter: Unmuting sound, using $SYSTEM."
+ case $SYSTEM in pulse)
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$PACTL set-sink-mute 0 0" "$LOCALUSER"
+ PACTLMUTEERR=$?
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$AMIXER -q -D pulse sset Master unmute" "$LOCALUSER"
+ AMIXERMUTEERR=$?
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$PACTL set-sink-volume 0 100%" "$LOCALUSER"
+ PACTLVOLERR=$?
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$AMIXER -D pulse sset Master 100%" "$LOCALUSER"
+ PACTLVOLERR=$?
+ logger "openslx sound muter: Sound hopefully unmuted, pactl: $PACTLMUTEERR, amixer: $AMIXERMUTEERR."
+ logger "openslx sound muter: Volume set, pactl: $PACTLVOLERR, amixer: $AMIXERVOLERR."
+ ;;
+ alsa) "$AMIXER set Master unmute"
+ AMIXERERR=$?
+ logger "openslx sound muter: Sound hopefully unmuted, amixer: $AMIXERERR."
+ ;;
+ esac
+ ;;
+ 1)
+ logger "openslx sound muter: Muting sound, using $SYSTEM"
+ case $SYSTEM in pulse)
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$PACTL set-sink-mute 0 1" "$LOCALUSER"
+ PACTLERR=$?
+ XDG_RUNTIME_DIR=/run/user/$(id -u $LOCALUSER) su -c "$AMIXER -q -D pulse sset Master mute" "$LOCALUSER"
+ AMIXERERR=$?
+ logger "openslx sound muter: Sound hopefully unmuted, pactl: $PACTLERR, amixer: $AMIXERERR."
+ ;;
+ alsa) "$AMIXER" set Master mute
+ AMIXERERR=$?
+ logger "openslx sound muter: Sound hopefully unmuted, amixer: $AMIXERERR."
+ ;;
+ esac ;;
+ *) logger "openslx sound muter: Unknown muteSound option $MUTESOUND"
+;;
+esac
+logger "openslx sound muter: end."
}