|
1 From 86af425cff12da4d1e53d9688e1130f7981648de Mon Sep 17 00:00:00 2001 |
|
2 From: Alan Coopersmith <[email protected]> |
|
3 Date: Tue, 29 Dec 2015 16:13:34 -0800 |
|
4 Subject: [PATCH 08/19] audio-settings-restore |
|
5 |
|
6 Bug 15424062/SUNBT6606096 volume control preferences don't remain after reboot |
|
7 Original date:2010-02-15 owner:yippi type:feature bugster:6606096 |
|
8 |
|
9 Includes followup fix for: |
|
10 |
|
11 Bug 18899731 - GDM: permissions for .audioctl and audioctl device file are |
|
12 not set as expected. |
|
13 Original date:2014-07-11 owner:abhijit type:bug bugdb:18899731 |
|
14 --- |
|
15 data/PostSession.in | 26 ++++++++++++++++++++++++++ |
|
16 data/Xsession.in | 24 ++++++++++++++++++++++++ |
|
17 2 files changed, 50 insertions(+) |
|
18 |
|
19 diff --git a/data/PostSession.in b/data/PostSession.in |
|
20 index c52d3c2..83e23d1 100755 |
|
21 --- a/data/PostSession.in |
|
22 +++ b/data/PostSession.in |
|
23 @@ -1,3 +1,29 @@ |
|
24 #!/bin/sh |
|
25 +PATH="@SCRIPT_PATH@" |
|
26 + |
|
27 +AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname` |
|
28 +AUDIOCTL_SAVE_DIR="$HOME/.audioctl" |
|
29 +AUDIOCTL_SAVE_DEVICE="" |
|
30 +AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U` |
|
31 + |
|
32 +# Only set audio settings if logindevperm has set the owner of the audio device |
|
33 +# to this user. |
|
34 +# |
|
35 +if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then |
|
36 + if test -x "/usr/bin/audioctl" ; then |
|
37 + AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'` |
|
38 + fi |
|
39 + |
|
40 + if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then |
|
41 + if test ! -d "$AUDIOCTL_SAVE_DIR" ; then |
|
42 + /usr/bin/su "$USER" -c "/usr/bin/mkdir $AUDIOCTL_SAVE_DIR; /usr/bin/chmod 700 $AUDIOCTL_SAVE_DIR" |
|
43 + fi |
|
44 + |
|
45 + if test -d "$AUDIOCTL_SAVE_DIR" ; then |
|
46 + AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE" |
|
47 + /usr/bin/su "$USER" -c "/usr/bin/audioctl save-controls -f $AUDIOCTL_SAVE_FILE; /usr/bin/chmod 600 $AUDIOCTL_SAVE_FILE" |
|
48 + fi |
|
49 + fi |
|
50 +fi |
|
51 |
|
52 exit 0 |
|
53 diff --git a/data/Xsession.in b/data/Xsession.in |
|
54 index f253375..fda4b16 100755 |
|
55 --- a/data/Xsession.in |
|
56 +++ b/data/Xsession.in |
|
57 @@ -70,6 +70,30 @@ gdmwhich () { |
|
58 echo "$OUTPUT" |
|
59 } |
|
60 |
|
61 +# Reload audio settings after sourcing the user's .profile to ensure that any |
|
62 +# AUDIODEV settings defined by the user are honored. |
|
63 +# |
|
64 +AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname` |
|
65 +AUDIOCTL_SAVE_DEVICE="" |
|
66 +AUDIOCTL_SAVE_DIR="$HOME/.audioctl" |
|
67 +AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U` |
|
68 + |
|
69 +# Only set audio settings if logindevperm has set the owner of the audio |
|
70 +# device to this user. |
|
71 +# |
|
72 +if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then |
|
73 + if test -x "/usr/bin/audioctl" ; then |
|
74 + AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'` |
|
75 + fi |
|
76 + |
|
77 + if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then |
|
78 + AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE" |
|
79 + if test -f "$AUDIOCTL_SAVE_FILE" ; then |
|
80 + /usr/bin/audioctl load-controls $AUDIOCTL_SAVE_FILE |
|
81 + fi |
|
82 + fi |
|
83 +fi |
|
84 + |
|
85 zenity=`gdmwhich zenity` |
|
86 |
|
87 # Note: ~/.xsession-errors is now done in the daemon so that it |
|
88 -- |
|
89 2.7.4 |
|
90 |