[kde-solaris] KDM on Solaris

Ian Reinhart Geiser kde-solaris@mail.kde.org
Mon Nov 11 23:08:01 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings, 
	I have a working script that will cause KDM to be used instead of dtlogin.
	Anyone care to test it out?  All it is missing is to get console messages to 
go to an XConsole or KWrited channel.

#!/bin/sh
#
# based upon dtlogin.rc
#  (c) Copyright 1993, 1994 Hewlett-Packard Company
#  (c) Copyright 1993, 1994 International Business Machines Corp.
#  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
#  (c) Copyright 1993, 1994 Novell, Inc.
#
# When placed in the /etc/rc2.d directory and named appropriately, such as
# "S99kdm", this script will automatically start the kdm window
# after the Solaris(TM) system boots to its multi-user level.
#
KDEDIR=/usr/local/kde
QTDIR=/qt3
PATH=$QTDIR/bin:$KDEDIR/bin:/opt/sfw/bin:/opt/sfw/sbin:/usr/X/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib:/opt/sfw/lib:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH PATH QTDIR KDEDIR

DAEMON=/usr/local/kde/bin/kdm

mode=$1

usage_error() {
      echo "  $0 start             (start kdm process)"
      echo "  $0 stop              (stop kdm process)"
      echo "  $0 reset             (reset kdm process)"
      echo "  $0 update_printers   (update print actions)"
      echo " "
}

if [ ! -d /usr/bin ]
then                    # /usr not mounted
        exit 1
fi

set `/usr/bin/id`
if [ $1 != "uid=0(root)" ]; then
        echo "$0: must be run as root"
        exit 1
fi


# update_printers()
#
# Add print actions to workstation's database for all printer's known
# to this workstation if action is not already present in the database.

update_printers() {
   if [ -x /usr/dt/bin/dtprintinfo ] ; then
            /usr/dt/bin/dtprintinfo -populate &
   fi
}

#
# Find login server pid from the process tree

#
login_server_pid()
{
  grep=/usr/bin/grep
  ps=/usr/bin/ps
  cut=/usr/bin/cut
  awk=/usr/bin/awk

# In following grep for "kdm" processes, explictly exclude any matches
# on this shell file named "kdm.rc"

  $ps -u 0 -l | $grep -v kdm. | $grep kdm | $cut -c1-24 | $awk '{print $4 " " 
$5}' |
  while read pid ppid; do
    parent_login_ps=`$ps -p $ppid | $grep kdm`
    if [ -z "$parent_login_ps" ]; then
      echo "$pid"
      break
    fi
  done
}

get_login_server_pid()
{
        if [ -x /usr/bin/pgrep ]
        then
                /usr/bin/pgrep -u 0 -P 1 -x kdm
        else
                login_server_pid
        fi
}

kill_kdm()
{
        if [ "$1" != "" ]
        then
                SIGNAL=-$1
        fi

        if [ -x /usr/bin/pkill ]
        then
                /usr/bin/pkill $SIGNAL -u 0 -P 1 -x kdm
        else
#               get kdm pid

                kdm_pid=`login_server_pid`

#               kill kdm process

                if [ "$kdm_pid" != "" ] ; then
                        /usr/bin/kill $SIGNAL $kdm_pid
                fi
        fi
}

case "$mode" in

'start')
        update_printers

        if [ -x $DAEMON ] ; then
                $DAEMON -daemon
        fi
        ;;


'stop')
        kill_kdm
        ;;

'reset')
        kill_kdm HUP
        ;;

'update_printers')
        update_printers
        ;;

'get_server_pid')
        get_login_server_pid
        ;;

*)
        usage_error
        exit 1
        ;;
esac

exit 0

Cheers
	-ian reinhart geiser
- -- 
========================================
There is no time like the present for postponing what you ought to be
doing.
========================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE90CoxPy62TRm8dvgRAmJXAKCVH4StHuXEk0dg3yX+O26fJJzIUQCgvBU2
1z08ZCOr+Tm0+u/KUW/GZ8I=
=GcWS
-----END PGP SIGNATURE-----