patches/gdm-18-audio-default.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 18225 b45d97b2f2c6
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18225
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     1
--- gdm-2.30.0/data/Xsession.in-orig	2010-04-07 15:12:25.882247407 -0500
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     2
+++ gdm-2.30.0/data/Xsession.in	2010-04-07 15:12:57.139892497 -0500
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     3
@@ -70,6 +70,30 @@ gdmwhich () {
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     4
   echo "$OUTPUT"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     5
 }
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     6
 
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     7
+# Reload audio settings after sourcing the user's .profile to ensure that any
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     8
+# AUDIODEV settings defined by the user are honored.
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     9
+#
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    10
+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    11
+AUDIOCTL_SAVE_DEVICE=""
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    12
+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    13
+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    14
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    15
+# Only set audio settings if logindevperm has set the owner of the audio
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    16
+# device to this user.
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    17
+#
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    18
+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    19
+  if test -x "/usr/bin/audioctl" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    20
+    AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    21
+  fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    22
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    23
+  if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    24
+    AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    25
+    if test -f "$AUDIOCTL_SAVE_FILE" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    26
+      /usr/bin/audioctl load-controls $AUDIOCTL_SAVE_FILE
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    27
+    fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    28
+  fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    29
+fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    30
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    31
 zenity=`gdmwhich zenity`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    32
 
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    33
 # Note: ~/.xsession-errors is now done in the daemon so that it
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    34
--- gdm-2.30.0/data/PostSession.in-orig	2010-04-07 15:11:36.882431156 -0500
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    35
+++ gdm-2.30.0/data/PostSession.in	2010-04-07 15:13:18.268798760 -0500
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    36
@@ -1,4 +1,31 @@
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    37
 #!/bin/sh
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    38
 PATH="@SCRIPT_PATH@"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    39
 
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    40
+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    41
+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    42
+AUDIOCTL_SAVE_DEVICE=""
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    43
+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    44
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    45
+# Only set audio settings if logindevperm has set the owner of the audio device
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    46
+# to this user.
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    47
+#
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    48
+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    49
+  if test -x "/usr/bin/audioctl" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    50
+    AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    51
+  fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    52
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    53
+  if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    54
+    if test ! -d "$AUDIOCTL_SAVE_DIR" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    55
+      /usr/bin/su "$USER" -c "/usr/bin/mkdir $AUDIOCTL_SAVE_DIR"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    56
+      /usr/bin/chmod 700 $AUDIOCTL_SAVE_DIR
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    57
+    fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    58
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    59
+    if test -d "$AUDIOCTL_SAVE_DIR" ; then
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    60
+      AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    61
+      /usr/bin/su "$USER" -c "/usr/bin/audioctl save-controls -f $AUDIOCTL_SAVE_FILE"
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    62
+      /usr/bin/chmod 600 $AUDIOCTL_SAVE_FILE
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    63
+    fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    64
+  fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    65
+fi
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    66
+
b45d97b2f2c6 2010-07-13 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    67
 exit 0