diff options
author | Lucas N. Ferreira <lnf07@c3sl.ufpr.br> | 2010-08-07 17:26:36 -0300 |
---|---|---|
committer | Lucas N. Ferreira <lnf07@c3sl.ufpr.br> | 2010-08-07 17:26:36 -0300 |
commit | ac9b50db1fa87028ecaca579608ac7bb3f461284 (patch) | |
tree | fb1ce4bc10726c61f8515cad360dc221f4c0e42b | |
parent | e8740dce96b1968b9db946daba380b2df3b306aa (diff) |
Fixed the name of seat, display and session.
-rw-r--r-- | etc/ConsoleKit/displays.d/usbseat.display | 2 | ||||
-rw-r--r-- | etc/ConsoleKit/seats.d/00-primary.seat | 4 | ||||
-rw-r--r-- | etc/ConsoleKit/seats.d/01-usbseat.seat | 8 | ||||
-rw-r--r-- | etc/ConsoleKit/sessions.d/usbseat.session | 3 | ||||
-rwxr-xr-x | src/usbseat.sh | 54 |
5 files changed, 34 insertions, 37 deletions
diff --git a/etc/ConsoleKit/displays.d/usbseat.display b/etc/ConsoleKit/displays.d/usbseat.display index 50eb60d..3c8128c 100644 --- a/etc/ConsoleKit/displays.d/usbseat.display +++ b/etc/ConsoleKit/displays.d/usbseat.display @@ -2,4 +2,4 @@ Type=X11 [X11] -Exec=/usr/bin/X -config /tmp/xorg.conf.seat $display -br -audit 0 -verbose -auth $auth -nolisten tcp +Exec=/usr/bin/X -config /tmp/xorg.conf.tmp $display -br -audit 0 -verbose -auth $auth -nolisten tcp diff --git a/etc/ConsoleKit/seats.d/00-primary.seat b/etc/ConsoleKit/seats.d/00-primary.seat index b8affdb..8ad10f3 100644 --- a/etc/ConsoleKit/seats.d/00-primary.seat +++ b/etc/ConsoleKit/seats.d/00-primary.seat @@ -1,8 +1,8 @@ -[Seat Entry] +[eat Entry] Version=1.0 Name=Primary seat # Specified Seat ID, if this value is NULL, ConsoleKit will decide one. -# The ID only contain the ASICC characters "[A-Z][a-z][0-9]_" +# The ID only contain the ASICC characters "[A-Z][a-z][0-9]_" ID=StaticSeat1 Description=start one static local display at :0 diff --git a/etc/ConsoleKit/seats.d/01-usbseat.seat b/etc/ConsoleKit/seats.d/01-usbseat.seat index 84966da..70aefd4 100644 --- a/etc/ConsoleKit/seats.d/01-usbseat.seat +++ b/etc/ConsoleKit/seats.d/01-usbseat.seat @@ -1,11 +1,11 @@ [Seat Entry] Version=1.0 -Name=Primary seat -ID=Seat1 -Description=Seat 1 +Name=usbseat +ID=usbseat +Description=usbseat Hidden=false Devices= -Sessions=seat1; +Sessions=usbseat; diff --git a/etc/ConsoleKit/sessions.d/usbseat.session b/etc/ConsoleKit/sessions.d/usbseat.session index 7b88ccb..f055e7a 100644 --- a/etc/ConsoleKit/sessions.d/usbseat.session +++ b/etc/ConsoleKit/sessions.d/usbseat.session @@ -2,8 +2,7 @@ Name=Local Type=LoginWindow Description=Local Login Screen -DisplayTemplate=Seat1 +DisplayTemplate=usbseat [Local] display=:0 -config_file=/etc/X11/xorg.conf.seat1 diff --git a/src/usbseat.sh b/src/usbseat.sh index 80e3b5c..b64f4f0 100755 --- a/src/usbseat.sh +++ b/src/usbseat.sh @@ -3,51 +3,49 @@ # Takes the "seat name" as parameter $1 SEAT_NAME=$1 +SEAT_NUMBER=${SEAT_NAME#seat} CK_LIST_SESSION="/usr/bin/ck-list-sessions" CK_SEAT_TOOL="/usr/sbin/ck-seat-tool" XORG_CONF_USBSEAT="/etc/X11/xorg.conf.usbseat" -SESSION_TYPE="usbseat" -DISPLAY_TYPE="usbseat" +XORG_CONF_TMP="/tmp/xorg.conf.tmp" if [[ ! -n `/bin/pidof gdm-binary` ]]; then exit 0 fi -SEAT_RUNNING=`ck-list-sessions | grep "seat = '${SEAT_NAME}'"` +SEAT_RUNNING=$(ck-list-sessions | grep "seat = '${SEAT_NAME}'") + +echo "UDEV ACTION: $ACTION" >> /var/log/usbseat.log # $ACTION environment variable is set by udev subsystem -case "$ACTION" in +if [[ $ACTION == "remove" && -n "$SEAT_RUNNING" ]]; then - 'remove') + echo "Seat removed, removing session" >> /var/log/usbseat.log - if [[ -n "{$seat_running}" ]]; then + $CK_SEAT_TOOL -d --sesion-id Session${SEAT_NUMBER} +else - SEAT_NUMBER=${SEAT_NAME#seat} - $CK_SEAT_TOOL -d --sesion-id Session${SEAT_NUMBER} - fi - ;; + # A device which might be part of a seat has been added + # if we already have a running seat for this #, exit + if [[ -n "$SEAT_RUNNING" ]]; then - *) - # A device which might be part of a seat has been added - # if we already have a running seat for this #, exit - if [[ -n "$SEAT_RUNNING" ]]; then + echo "Seat $SEAT_RUNNING is already running. Does not start it" \ + >> /var/log/usbseat.log + exit 0 + fi - exit 0 - fi + echo "Starting Seat${SEAT_NUMBER}" >> /var/log/usbseat.log - if [[ -e /dev/usbseat/$SEAT_NAME/keyboard && \ - -e /dev/usbseat/$SEAT_NAME/mouse && \ - -e /dev/usbseat/$SEAT_NAME/display ]]; then + if [[ -e /dev/usbseat/$SEAT_NAME/keyboard && \ + -e /dev/usbseat/$SEAT_NAME/mouse && \ + -e /dev/usbseat/$SEAT_NAME/display ]]; then - # We have a newly complete seat. Start it. - sed "s/%ID_SEAT%/$SEAT_NAME/g" < $XORG_CONF_USBSEAT \ - > /tmp/xorg.conf.seat + # We have a newly complete seat. Start it. + sed "s/%ID_SEAT%/$SEAT_NAME/g" < $XORG_CONF_USBSEAT \ + > /tmp/xorg.conf.tmp - $CK_SEAT_TOOL -a --session-type $SESSION_TYPE --display-type $DISPLAY_TYPE \ + $CK_SEAT_TOOL -a --session-type usbseat --display-type usbseat \ --seat-id $SEAT_NAME - fi - ;; -esac - -exit 0 + fi +fi |