* '''Launchpad Entry''': UbuntuSpec:customize-guest-session
 * '''Created''': 2010-09-12
 * '''Contributors''': [[GunnarHj|Gunnar Hjalmarsson]]
 * '''Packages affected''': [[http://packages.ubuntu.com/lucid/gdm-guest-session|gdm-guest-session]]

== Summary ==

To facilitate for computer owners/system admins to customize the appearance and behavior of a guest session, I suggest the addition of a hook in each of these gdm-guest-session files:

 `/usr/share/gdm/guest-session/guest-session-launch`<<BR>>
 `/usr/share/gdm/guest-session/guest-session-setup.sh`<<BR>>
 `/etc/apparmor.d/gdm-guest-session`

Details in the Code Changes section below.

== Release Note ==

Addition of a couple of hooks that make it possible to customize/configure a guest session without changing any gdm-guest-session files.

== Rationale ==

I have noticed a few feature requests with respect to gdm-guest-session, and some of them are asking for rather trivial customization possibilities. I'm demonstrating a few customization opportunities in the tutorial [[http://ubuntuforums.org/showthread.php?t=1566078|Customize guest session]], but currently the install script that is attached to that document edits some gdm-guest-session files. I would feel more comfortable with the tutorial if there was no need to alter any files in the gdm-guest-session package, and that wish would be satisfied by the hooks I suggest be implemented.

I believe that giving computer owners better control is almost always desirable.

== Assumptions ==

Implicitly I suggest that the files `/etc/guest-session/prepare.sh` and `/etc/guest-session/prefs.sh` are established as preferred files for configuration code. I also suggest that the directory `/var/guest-data` is established as the preferred place for guests to save files permanently when the admin opts to allow it.

== Implementation ==

=== Code Changes ===

These three diffs make up the specific code changes that I would like to see.

{{{
--- /usr/share/gdm/guest-session/guest-session-launch	2010-04-15 01:24:01 +0200
+++ guest-session-launch	2010-09-09 21:40:04 +0200
@@ -3,6 +3,10 @@
 # Author: Martin Pitt <martin.pitt@ubuntu.com>
 # License: GPL v2 or later
 #
+
+# prepare possible local guest session preferences
+test -f /etc/guest-session/prepare.sh && . /etc/guest-session/prepare.sh
+
 # Convenience wrapper to lock the screen and trigger a guest session
 
 if [ -z "$GDMSESSION" ] ; then
}}}

{{{
--- /usr/share/gdm/guest-session/guest-session-setup.sh	2010-04-15 01:24:01 +0200
+++ guest-session-setup.sh	2010-09-08 01:45:11 +0200
@@ -79,8 +79,11 @@
     dmrc="[Desktop]\nSession=${1}-guest-restricted"
 fi
 /bin/echo -e "$dmrc" > /var/cache/gdm/"$USER"/dmrc
 
+# set possible local guest session preferences
+test -f /etc/guest-session/prefs.sh && . /etc/guest-session/prefs.sh
+
 echo #TODO: bug workaround, gdm expects to find a newline
 
 # report user name to gdm
 echo "$USER"
}}}

{{{
--- /etc/apparmor.d/gdm-guest-session	2010-04-15 01:24:01 +0200
+++ gdm-guest-session	2010-09-08 01:45:11 +0200
@@ -40,6 +40,7 @@
   /usr/** rmixk,
   /var/ r,
   /var/** rmixk,
+  /var/guest-data/** rw, # allow to store files permanently
   /var/tmp/ rw,
   /var/tmp/** rwlkm,
   /var/run/** rmwkix, # necessary for writing to sockets, etc.
}}}

=== User information ===

I'm not sure of the best way to point users to this opportunity. Possibly the [[http://ubuntuforums.org/showthread.php?t=1566078|Customize guest session]] tutorial can play a role.

== Unresolved issues ==

Not everyone is able or likes to tweak shell code, and I'm sure that some would like to see a configuration GUI under '''System -> Preferences -> Guest Session'''. Obviously this specification does not address such wishes, but possibly the hooks will make it easier to start develop such a UI.

== Comments ==

Implemented in [[https://code.launchpad.net/~ubuntu-branches/ubuntu/natty/gdm-guest-session/natty|lp:ubuntu/gdm-guest-session]]. Thanks, [[https://launchpad.net/~pitti|Martin]]! / GunnarHj 2010-10-18

----
CategorySpec