7199N/AFrom 86af425cff12da4d1e53d9688e1130f7981648de Mon Sep 17 00:00:00 2001
7199N/AFrom: Alan Coopersmith <alan.coopersmith@oracle.com>
7199N/ADate: Tue, 29 Dec 2015 16:13:34 -0800
7199N/ASubject: [PATCH 08/19] audio-settings-restore
7199N/A
7199N/ABug 15424062/SUNBT6606096 volume control preferences don't remain after reboot
7199N/AOriginal date:2010-02-15 owner:yippi type:feature bugster:6606096
7199N/A
7199N/AIncludes followup fix for:
7199N/A
7199N/ABug 18899731 - GDM: permissions for .audioctl and audioctl device file are
7199N/A not set as expected.
7199N/AOriginal date:2014-07-11 owner:abhijit type:bug bugdb:18899731
7199N/A---
7199N/A data/PostSession.in | 26 ++++++++++++++++++++++++++
7199N/A data/Xsession.in | 24 ++++++++++++++++++++++++
7199N/A 2 files changed, 50 insertions(+)
7199N/A
7199N/Adiff --git a/data/PostSession.in b/data/PostSession.in
7199N/Aindex c52d3c2..83e23d1 100755
7199N/A--- a/data/PostSession.in
7199N/A+++ b/data/PostSession.in
7199N/A@@ -1,3 +1,29 @@
7199N/A #!/bin/sh
7199N/A+PATH="@SCRIPT_PATH@"
7199N/A+
7199N/A+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
7199N/A+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
7199N/A+AUDIOCTL_SAVE_DEVICE=""
7199N/A+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
7199N/A+
7199N/A+# Only set audio settings if logindevperm has set the owner of the audio device
7199N/A+# to this user.
7199N/A+#
7199N/A+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
7199N/A+ if test -x "/usr/bin/audioctl" ; then
7199N/A+ AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
7199N/A+ fi
7199N/A+
7199N/A+ if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
7199N/A+ if test ! -d "$AUDIOCTL_SAVE_DIR" ; then
7199N/A+ /usr/bin/su "$USER" -c "/usr/bin/mkdir $AUDIOCTL_SAVE_DIR; /usr/bin/chmod 700 $AUDIOCTL_SAVE_DIR"
7199N/A+ fi
7199N/A+
7199N/A+ if test -d "$AUDIOCTL_SAVE_DIR" ; then
7199N/A+ AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
7199N/A+ /usr/bin/su "$USER" -c "/usr/bin/audioctl save-controls -f $AUDIOCTL_SAVE_FILE; /usr/bin/chmod 600 $AUDIOCTL_SAVE_FILE"
7199N/A+ fi
7199N/A+ fi
7199N/A+fi
7199N/A
7199N/A exit 0
7199N/Adiff --git a/data/Xsession.in b/data/Xsession.in
7199N/Aindex f253375..fda4b16 100755
7199N/A--- a/data/Xsession.in
7199N/A+++ b/data/Xsession.in
7199N/A@@ -70,6 +70,30 @@ gdmwhich () {
7199N/A echo "$OUTPUT"
7199N/A }
7199N/A
7199N/A+# Reload audio settings after sourcing the user's .profile to ensure that any
7199N/A+# AUDIODEV settings defined by the user are honored.
7199N/A+#
7199N/A+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
7199N/A+AUDIOCTL_SAVE_DEVICE=""
7199N/A+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
7199N/A+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
7199N/A+
7199N/A+# Only set audio settings if logindevperm has set the owner of the audio
7199N/A+# device to this user.
7199N/A+#
7199N/A+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
7199N/A+ if test -x "/usr/bin/audioctl" ; then
7199N/A+ AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
7199N/A+ fi
7199N/A+
7199N/A+ if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
7199N/A+ AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
7199N/A+ if test -f "$AUDIOCTL_SAVE_FILE" ; then
7199N/A+ /usr/bin/audioctl load-controls $AUDIOCTL_SAVE_FILE
7199N/A+ fi
7199N/A+ fi
7199N/A+fi
7199N/A+
7199N/A zenity=`gdmwhich zenity`
7199N/A
7199N/A # Note: ~/.xsession-errors is now done in the daemon so that it
7199N/A--
7199N/A2.7.4
7199N/A