[23865] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # This is the xinit script for the kiosk user. |
---|
| 4 | |
---|
[24213] | 5 | datadir=/usr/share/debathena-kiosk |
---|
[23865] | 6 | |
---|
| 7 | # The rkiosk extension's unique ID, and the location of its xpi file. |
---|
| 8 | rkiosk_id="{4D498D0A-05AD-4fdb-97B5-8A0AABC1FC5B}" |
---|
[24213] | 9 | rkiosk_xpi=$datadir/r-kiosk.xpi |
---|
[23865] | 10 | |
---|
| 11 | # File with preferences to set in the firefox profile. |
---|
[24213] | 12 | prefs="$datadir/prefs.js" |
---|
[23865] | 13 | |
---|
| 14 | # User chrome (UI customizations) file. |
---|
[24213] | 15 | chrome="$datadir/userChrome.css" |
---|
[23865] | 16 | |
---|
| 17 | cd || exit 1 |
---|
| 18 | |
---|
| 19 | exec > xinit.log 2>&1 |
---|
| 20 | |
---|
| 21 | XAUTHORITY=$HOME/.Xauthority |
---|
| 22 | export XAUTHORITY |
---|
| 23 | |
---|
| 24 | # Run a window manager so that firefox fullscreen mode works. |
---|
| 25 | metacity --sm-disable & |
---|
| 26 | |
---|
[24839] | 27 | choice=$(zenity --title="What would you like to do?" --text="Select the task y\ |
---|
| 28 | ou wish to perform, then click \"OK\"" --list --column="task" --column="Activ\ |
---|
| 29 | ity" --hide-column=1 "reg" "Register for Account" "web" "Browse the Web") |
---|
| 30 | [ $? -eq 0 ] || exit 0 |
---|
| 31 | if [ "$choice" = "reg" ]; then |
---|
[24842] | 32 | errtext="An error occurred while trying to launch the registration applet. Please try another workstation." |
---|
[24839] | 33 | classzip="/afs/athena.mit.edu/system/register/java/regclasses.zip" |
---|
| 34 | if [ ! -r "$classzip" ]; then |
---|
[24842] | 35 | zenity --error --text="${errtext}\n\n(could not unzip class file)" |
---|
[24839] | 36 | exit 0 |
---|
| 37 | fi |
---|
| 38 | unzip $classzip |
---|
[24842] | 39 | java -Dhost="moira.mit.edu" regapplet.Regapplet || zenity --error --text="${errtext}\n\n(could not launch java)" |
---|
[24839] | 40 | exit 0 |
---|
| 41 | fi |
---|
| 42 | |
---|
[23865] | 43 | # Create a new firefox profile. |
---|
| 44 | rm -rf .mozilla |
---|
| 45 | firefox -CreateProfile default > /dev/null || exit 1 |
---|
| 46 | profdir=$(find .mozilla/firefox -type d -name \*.default) |
---|
| 47 | |
---|
| 48 | # Add the rkiosk extension. |
---|
[24578] | 49 | rkiosk_dir="$profdir/extensions/$rkiosk_id" |
---|
| 50 | mkdir -p "$rkiosk_dir" |
---|
| 51 | (cd "$rkiosk_dir" && unzip "$rkiosk_xpi") || exit 1 |
---|
[23865] | 52 | cat <<EOF >> "$profdir/extensions.ini" |
---|
| 53 | [ExtensionDirs] |
---|
[24578] | 54 | Extension0=$rkiosk_dir |
---|
[23865] | 55 | EOF |
---|
| 56 | |
---|
[24578] | 57 | # Firefox 3.6+ requires a chrome.manifest for the extension. |
---|
| 58 | if [ ! -e "$rkiosk_dir/chrome.manifest" ]; then |
---|
| 59 | cp "$datadir/chrome.manifest.r-kiosk" "$rkiosk_dir/chrome.manifest" || exit 1 |
---|
| 60 | fi |
---|
| 61 | |
---|
[23865] | 62 | # Apply our preference settings and UI customizations. |
---|
| 63 | cat "$prefs" >> "$profdir/prefs.js" || exit 1 |
---|
| 64 | cp "$chrome" "$profdir/chrome/userChrome.css" || exit 1 |
---|
| 65 | |
---|
| 66 | # Launch firefox. |
---|
| 67 | firefox |
---|
| 68 | |
---|
| 69 | # Clean up. |
---|
| 70 | rm -rf .mozilla |
---|