Home | History | Annotate | Download | only in ext-sources
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 #
     24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 
     28 
     29 HAS_XSCRNSVR=0
     30 X11_BIN=/usr/X11/bin
     31 DESKTOP_SESSION=${DESKTOP_SESSION:-"xdm"}
     32 MAIL=${MAIL-"/var/mail/$USER"}
     33 SHELL=${SHELL-"/bin/sh"}
     34 DISPLAY=${DISPLAY-":0"}
     35 TERM=${TERM-"xterm"}
     36 
     37 _ () {
     38   backup_TEXTDOMAIN=$TEXTDOMAIN
     39   backup_TEXTDOMAINDIR=$TEXTDOMAINDIR
     40   TEXTDOMAIN=gnome-session-2.0
     41   TEXTDOMAINDIR=/usr/share/locale
     42   export TEXTDOMAIN
     43   export TEXTDOMAINDIR
     44 
     45   if [ -x /usr/bin/gettext ] ; then
     46     gettext "$@"
     47   else
     48     printf "%s\n" "$@"
     49   fi
     50 
     51   TEXTDOMAIN=$backup_TEXTDOMAIN
     52   TEXTDOMAINDIR=$backup_TEXTDOMAINDIR
     53   export TEXTDOMAIN
     54   export TEXTDOMAINDIR
     55 }
     56 
     57 postrun_progress_update ()
     58 {
     59   while [ 1 ] ; do
     60     I=1
     61     while [ $I -lt 99 ] ; do
     62       echo "$I"
     63       if [ `expr $I % 10` -eq 0 ] ; then
     64         /usr/lib/postrun-query -c JDS_wait -e;
     65         if [ $? -ne 0 ] ; then
     66           echo "100"
     67         fi
     68       fi
     69       I=`expr $I + 1`
     70       sleep 1
     71     done
     72   done
     73 }
     74 
     75 
     76 case $DESKTOP_SESSION in
     77 gnome|GNOME|JDS|tgnome|TGNOME|tjds|TJDS|TrustedJDS)
     78     EDITOR=${EDITOR:-"gedit"}
     79     ;;
     80 kde|KDE)
     81     EDITOR=${EDITOR:-"kedit"}
     82     ;;
     83 *)
     84     EDITOR=${EDITOR:-"vi"}
     85     ;;
     86 esac
     87 
     88 for XPATH in `/bin/echo $PATH | /bin/tr ":" " "`
     89 do
     90   if [ -x $XPATH/xscreensaver-demo ] ; then
     91     HAS_XSCRNSVR=1
     92   fi
     93 done
     94 
     95 if [ $HAS_XSCRNSVR -eq 0 -a -x $X11_BIN/xscreensaver-demo ] ; then
     96   PATH=${PATH}:$X11_BIN
     97 fi
     98 
     99 export PATH EDITOR MAIL TERM SHELL DISPLAY
    100 
    101 if xmodmap | /usr/bin/grep mod4 | /usr/bin/grep Alt > /dev/null 2>/dev/null
    102 then
    103     xmodmap -e "clear Mod1" \
    104             -e "clear Mod4" \
    105             -e "add Mod1 = Alt_L" \
    106             -e "add Mod1 = Alt_R" \
    107             -e "add Mod4 = Meta_L" \
    108             -e "add Mod4 = Meta_R"
    109 fi
    110 
    111 if [ -x /usr/lib/postrun-query ] ; then
    112   /usr/lib/postrun-query -c JDS_wait -e
    113   if [ $? -eq 0 ] ; then
    114     TEXT=`_ "Completing post install setup..."`
    115     postrun_progress_update |\
    116     zenity --progress --text "$TEXT" --percentage 0 --auto-close
    117     if [ $? -ne 0 ] ; then
    118       echo "Cancel the session"
    119       kill -9 $$
    120     fi
    121   fi
    122 fi
    123