ext-sources/gdmdynamic
author davelam
Wed, 24 Feb 2010 04:10:23 +0000
branchgnome-2-28
changeset 18642 478b5460cc36
parent 18454 eea00efef0b9
child 21937 d9e58c7011f2
permissions -rwxr-xr-x
add new proto file for b133
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
     1
#!/bin/ksh -p
16889
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     2
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     3
usage () {
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     4
    echo "$0 [options]"
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     5
    echo "   -h, --help     Display this help"
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     6
    echo "   -a display     Add a new Sun Ray display"
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     7
    echo "   -d display     Delete a Sun Ray display"
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     8
    echo "   -l             List all Sun Ray displays"
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
     9
    exit 1
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    10
}
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    11
16540
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    12
AWK="/usr/gnu/bin/awk"
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    13
SED="/usr/gnu/bin/sed"
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    14
SEAT_TOOL="/usr/sbin/ck-seat-tool"
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    15
LIST_TOOL="/usr/bin/ck-list-sessions"
16890
04361d5bc863 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16889
diff changeset
    16
HIST_TOOL="/usr/bin/ck-history"
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    17
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    18
optype=""
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    19
oparg=""
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    20
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    21
for i in "$@"
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    22
do
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    23
  if [ ! "x$optype" = "x" ]; then
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    24
    oparg=$i
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    25
    break
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    26
  fi
16889
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    27
  if [ "x$i" = "x-h" -o "x$i" = "x--help" ]; then
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    28
    break
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    29
  fi
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    30
  if [ "x$i" = "x-a" ]; then
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    31
    optype="add"
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    32
    continue
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    33
  fi
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    34
  if [ "x$i" = "x-d" ]; then
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    35
    optype="delete"
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    36
    continue
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    37
  fi
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    38
  if [ "x$i" = "x-l" ]; then
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    39
    optype="list"
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    40
    break
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    41
  fi
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    42
done
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    43
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    44
case $optype in
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    45
  add)
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    46
# gdmdynamic -a 10=/usr/X11/bin/Xorg
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    47
    oparg=`echo $oparg | awk -F\= '{print $1}'`
16890
04361d5bc863 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16889
diff changeset
    48
    seatid=`$HIST_TOOL --last | $AWK -v disp=":$oparg" '{if ($6 == disp) print $N0}' | head -1 | $AWK '{print $4}'`
04361d5bc863 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16889
diff changeset
    49
    if [ "x$seatid" = x ]; then
18454
eea00efef0b9 2009-12-04 Halton Huo <[email protected]>
halton
parents: 16890
diff changeset
    50
      seatid="SunraySeat$oparg"
16890
04361d5bc863 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16889
diff changeset
    51
    fi
18454
eea00efef0b9 2009-12-04 Halton Huo <[email protected]>
halton
parents: 16890
diff changeset
    52
    $SEAT_TOOL -a --display-type=Sunray --seat-id=$seatid display=:$oparg
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    53
    ;;
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    54
  delete)
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    55
# gdmdynamic -d 10
16540
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    56
    ssid=`$LIST_TOOL -f session-id,x11-display,display-type | grep Sunray | $SED -e s/\'//g | $AWK -v disp=:$oparg '{if ($2 == disp) print $1}'`
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    57
    if [ ! "x$ssid" = "x" ]; then
16540
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    58
      $SEAT_TOOL -d --session-id=$ssid
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    59
    fi
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    60
    ;;
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    61
  list)
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    62
# gdmdynamic -l
16540
e60b1f38ebfc 2009-09-11 Halton Huo <[email protected]>
halton
parents: 16234
diff changeset
    63
    sessions=`$LIST_TOOL -f session-id,x11-display,display-type | grep Sunray | $AWK '{print $2}' | $SED -e s/\'//g`
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    64
    dyps=""
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    65
    for i in $sessions
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    66
    do
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    67
      if [ ! "x$i" = "x" ]; then
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    68
         dyps="$i;$dyps"
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    69
      fi
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    70
    done
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    71
    echo $dyps
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    72
    ;;
16889
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    73
  * )
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    74
    usage
ee7ceb64bdd0 2009-10-30 Halton Huo <[email protected]>
halton
parents: 16540
diff changeset
    75
    ;;
16234
438eca6ff2af 2009-08-11 Halton Huo <[email protected]>
halton
parents:
diff changeset
    76
esac