Fix the init script a little for FreeBSD again.
authorRoy Marples <uberlord@gentoo.org>
Thu, 5 Apr 2007 15:30:19 +0000 (15:30 +0000)
committerRoy Marples <uberlord@gentoo.org>
Thu, 5 Apr 2007 15:30:19 +0000 (15:30 +0000)
Package-Manager: portage-2.1.2.3

x11-apps/xinit/ChangeLog
x11-apps/xinit/Manifest
x11-apps/xinit/files/startDM.sh
x11-apps/xinit/files/xdm.initd

index eb4c6832cde599b9aac9815fde834f5f5645b710..9a5d80afbabe35f9751fd7d6845780170112af85 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for x11-apps/xinit
 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/ChangeLog,v 1.78 2007/04/03 16:41:03 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/ChangeLog,v 1.79 2007/04/05 15:30:19 uberlord Exp $
+
+  05 Apr 2007; Roy Marples <uberlord@gentoo.org> files/startDM.sh,
+  files/xdm.initd:
+  Fix the init script a little for FreeBSD again.
 
 *xinit-1.0.3-r2 (03 Apr 2007)
 
index 5dc96bb3a7ed1f8c3f4019f17b0536b513a40d4d..789b2b86e6ee0aa66ec23c20dd9a099850ada290 100644 (file)
@@ -1,6 +1,3 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
 AUX Xsession 2187 RMD160 ffb290e9a8656b17d7744797456a45df53cafd79 SHA1 8ba8de5114871f8500f428a03f87a42714d0ce14 SHA256 bdf2cceaafb71762bc1c6491f9bd8cc24089dea7ef65b0a030acadf7f4aa4ab3
 MD5 a0ce0f1c8a5771a1194f5895211a3f66 files/Xsession 2187
 RMD160 ffb290e9a8656b17d7744797456a45df53cafd79 files/Xsession 2187
@@ -17,18 +14,18 @@ AUX nolisten-tcp-and-black-background.patch 381 RMD160 f767995059b6b3826e662ad71
 MD5 8d14d094be7182b9870a0727a5d8e87b files/nolisten-tcp-and-black-background.patch 381
 RMD160 f767995059b6b3826e662ad71fd9348609383dc2 files/nolisten-tcp-and-black-background.patch 381
 SHA256 481252dd205a0eefcfdf1a265b2c359280363ceaf1460ca5eab42b9eb3b3c826 files/nolisten-tcp-and-black-background.patch 381
-AUX startDM.sh 790 RMD160 2cc4b6a5db871bb547d7e4b12eaa5eb9cc3adadb SHA1 3cbc0434c0279397d8722988fd57b060999c3500 SHA256 73a59da800e0c6087173dad56ec6ec1f3ad27b31751f2a694b71dd629dfd9b73
-MD5 e95ffb0d833d4c378e3e40ecaaa8c886 files/startDM.sh 790
-RMD160 2cc4b6a5db871bb547d7e4b12eaa5eb9cc3adadb files/startDM.sh 790
-SHA256 73a59da800e0c6087173dad56ec6ec1f3ad27b31751f2a694b71dd629dfd9b73 files/startDM.sh 790
+AUX startDM.sh 858 RMD160 d7ef866ddd09e3d4117b3363aaa6382a9b8cd153 SHA1 1b826dfb4d5a184d6d7cc1995d685b55c9c188ac SHA256 a7aca1e37e5b8fecb49aa96c4e2850547a47e154edabcdbd1cfcb8ab49337549
+MD5 42e1e329b9566a4756c7931d3f4c301b files/startDM.sh 858
+RMD160 d7ef866ddd09e3d4117b3363aaa6382a9b8cd153 files/startDM.sh 858
+SHA256 a7aca1e37e5b8fecb49aa96c4e2850547a47e154edabcdbd1cfcb8ab49337549 files/startDM.sh 858
 AUX xdm.confd 668 RMD160 336b367da62beb39bcf4ce60efc07c7c00dc7133 SHA1 57e33bae408f1ae3d41169dfc83fcfca91df6083 SHA256 d8b6828dae11bd2e632c9000b087d59c66192e1e21183124e7bf90ddee09f128
 MD5 1ef321642c38bfb020e92723722319fb files/xdm.confd 668
 RMD160 336b367da62beb39bcf4ce60efc07c7c00dc7133 files/xdm.confd 668
 SHA256 d8b6828dae11bd2e632c9000b087d59c66192e1e21183124e7bf90ddee09f128 files/xdm.confd 668
-AUX xdm.initd 4365 RMD160 6d07b8f236a1128828a25c532d2bbc48ae18a60d SHA1 f3edb64e0b5eb76b65b112ef4173694750e1d164 SHA256 48be5e6fe6cd56a53d2213173fd217928933b87e6ae9f3dcaf87d4ac4f2c0d52
-MD5 224fd9fa7880c215dcaba5730b146930 files/xdm.initd 4365
-RMD160 6d07b8f236a1128828a25c532d2bbc48ae18a60d files/xdm.initd 4365
-SHA256 48be5e6fe6cd56a53d2213173fd217928933b87e6ae9f3dcaf87d4ac4f2c0d52 files/xdm.initd 4365
+AUX xdm.initd 4601 RMD160 862f9f63e38fbccc05af5b78047df85c484769b6 SHA1 e648b57f668456b9066d89bf18cbfdba0be97fa4 SHA256 56dd0b6a4df7f9b57a1ed0506989d6117033e347460ae9c8b5d29a1d2cac27ff
+MD5 536c9b80dff6f857629d2c7a61aaa796 files/xdm.initd 4601
+RMD160 862f9f63e38fbccc05af5b78047df85c484769b6 files/xdm.initd 4601
+SHA256 56dd0b6a4df7f9b57a1ed0506989d6117033e347460ae9c8b5d29a1d2cac27ff files/xdm.initd 4601
 AUX xdm.start 3974 RMD160 67f3b69fc9c006146999271935e1ae06d093130a SHA1 12763e84e31632c0421159e8feca2f9855966b7b SHA256 151b697f62e335850118a5d7d113d83fb37f2a75407985cd1e433de93eb55ded
 MD5 5dd1b14c1942c59025be5fa7d470f281 files/xdm.start 3974
 RMD160 67f3b69fc9c006146999271935e1ae06d093130a files/xdm.start 3974
@@ -59,10 +56,10 @@ EBUILD xinit-1.0.3.ebuild 1336 RMD160 4395f36048cc77b18430f512172cb11340a942e4 S
 MD5 24a82969244654b6d5f3c7fbf05b102b xinit-1.0.3.ebuild 1336
 RMD160 4395f36048cc77b18430f512172cb11340a942e4 xinit-1.0.3.ebuild 1336
 SHA256 aea3003858e5cec5d12e116e9a20496662c9d443193ca10a46d568b9af663c99 xinit-1.0.3.ebuild 1336
-MISC ChangeLog 12753 RMD160 e9e6cf0e2799b34696c5f80cada1430d66964935 SHA1 73ed56518759856b19c0c506ba3262a8fc701345 SHA256 3e7f49379b35323610888589d55290fc9cfcebebb829dd33432f3612ce5ae310
-MD5 9128c589a3099a5a17e56274cf022378 ChangeLog 12753
-RMD160 e9e6cf0e2799b34696c5f80cada1430d66964935 ChangeLog 12753
-SHA256 3e7f49379b35323610888589d55290fc9cfcebebb829dd33432f3612ce5ae310 ChangeLog 12753
+MISC ChangeLog 12892 RMD160 1f4927419477fe6b53d87b7805172bd0fa1a70b9 SHA1 f7599183860946754dc9369feb1483ffacb73ddd SHA256 bd43a62ac7aa0333e28322a1b8b378f9fb6eaf6572824c6e8453800e99e9c2db
+MD5 39609ea893fe98677dc6d27ae5f92532 ChangeLog 12892
+RMD160 1f4927419477fe6b53d87b7805172bd0fa1a70b9 ChangeLog 12892
+SHA256 bd43a62ac7aa0333e28322a1b8b378f9fb6eaf6572824c6e8453800e99e9c2db ChangeLog 12892
 MISC metadata.xml 156 RMD160 c1274bdccf57603d580de0075ba07a35b7509560 SHA1 6f78f604e3d079d39189b40aaaa1ddb06182ad91 SHA256 5101ab0d4cc8c7125eea733c44e86962769bd77acaf53b69223b9cadcdd29055
 MD5 a37bab73e2f24b213932c30997d3d360 metadata.xml 156
 RMD160 c1274bdccf57603d580de0075ba07a35b7509560 metadata.xml 156
@@ -76,10 +73,3 @@ SHA256 a37b78e123e42af15479c362d492e682e687a13cb9c1f038ec3e395f12612242 files/di
 MD5 273fc0942d2b4ea4d51a2447ba6b1c77 files/digest-xinit-1.0.3-r2 235
 RMD160 427f07a6108e50a618c487041421ba91e25f146f files/digest-xinit-1.0.3-r2 235
 SHA256 a37b78e123e42af15479c362d492e682e687a13cb9c1f038ec3e395f12612242 files/digest-xinit-1.0.3-r2 235
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.3 (GNU/Linux)
-
-iD8DBQFGEoNSoeSe8B0zEfwRAqUmAKCAdz+odQiakcDE2JP97yRSWSrA2ACfdYQR
-q9E8PHnm8hIiX/7xJJ8xZwU=
-=hQrS
------END PGP SIGNATURE-----
index d2132348372d8e18e76645a13c2d6c7d503c669c..9775b07ff7a5cb9565fb5ba8a51d03a35ce9a2ba 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2
-# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/startDM.sh,v 1.3 2007/03/11 02:01:24 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/startDM.sh,v 1.4 2007/04/05 15:30:19 uberlord Exp $
 
 # We need to source /etc/profile for stuff like $LANG to work
 # bug #10190.
@@ -21,8 +21,10 @@ export GDK_USE_XFT=1
 export SVCNAME=xdm
 EXEC="$(get_options service)"
 NAME="$(get_options name)"
+PIDFILE="$(get_options pidfile)"
 
-start-stop-daemon --start --exec ${EXEC} ${NAME:+--name }${NAME} || \
+start-stop-daemon --start --exec ${EXEC} \
+${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} || \
 eerror "ERROR: could not start the Display Manager"
 
 # vim:ts=4
index a285b77303c144e3bc62dd5e14c2ec6b56c5f25d..8f2d2db112899cce7c17774db8354e2793a81c90 100755 (executable)
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2
-# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/xdm.initd,v 1.2 2007/04/03 16:41:03 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/xdm.initd,v 1.3 2007/04/05 15:30:19 uberlord Exp $
 
 # This is here to serve as a note to myself, and future developers.
 #
@@ -50,23 +50,29 @@ depend() {
        before alsasound
 
        # Start before X
-       use acpid hald xfs consolekit
+       use acpid consolekit hald xfs
 }
 
 setup_dm() {
-       source /etc/profile.env
-       export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
+       local MY_XDM="$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')"
+
+       # Load our root path from profile.env
+       # Needed for kdm
+       PATH="${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")"
 
-       local MY_XDM="$(echo ${DISPLAYMANAGER} | tr '[:upper:]' '[:lower:]')"
        case "${MY_XDM}" in
                kdm|kde|kde2|kde3)
                        EXE="$(which kdm)"
+                       PIDFILE=/var/run/kdm.pid
                        ;;
                entrance*)
-                       EXE="$(which entranced)"
+                       EXE=/usr/sbin/enranced
+                       PIDFILE=/var/lib/entranced.pid
                        ;;
                gdm|gnome)
                        EXE=/usr/bin/gdm
+                       [ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+                       PIDFILE=/var/run/gdm.pid
                        ;;
                wdm)
                        EXE=/usr/bin/wdm
@@ -80,55 +86,41 @@ setup_dm() {
                        ;;
        esac
 
-       test ! -x "${EXE}" && EXE=/usr/bin/xdm
+       [ -x "${EXE}" ] || EXE=/usr/bin/xdm
 }
 
 cmdline_opt() {
-       if [[ "$#" -ne 1 || ! -e /proc/cmdline ]]; then
+       if [ $# -ne 1 -o ! -r /proc/cmdline ]; then
                return 1
        fi
 
-       for opt in $(</proc/cmdline); do
-               case ${opt} in
-                       ${1}) eval ${1}="true" ;;
-               esac
+       for opt in $(cat /proc/cmdline) ; do
+               [ "${opt}" = "${1}" ] && return 0
        done
 }
 
-nox() {
-       # Don't start X if we were passed 'nox' at boot (#83680)
-       cmdline_opt nox
-
-       if [[ "$?" -ne 0 ]]; then
-               return 1
-       fi
-
-       if [[ -n "${nox}" ]]; then
-               return 0
-       else
-               return 1
-       fi
-}
-
 start() {
+       local EXE= NAME= PIDFILE=
        setup_dm
        
-       if nox; then
+       if cmdline_opt nox ; then
                einfo "Skipping ${EXE}, received 'nox'"
        else
                ebegin "Setting up ${EXE##*/}"
                #save the prefered DM
                save_options "service" "${EXE}"
+               save_options "name"    "${NAME}"
+               save_options "pidfile" "${PIDFILE}"
 
                # Start as soon as possible if XSTATICVT is set
                # or if we don't have telinit (as on BSD)
-               if [ "${XSTATICVT}" = "yes" ] || [ ! -x /sbin/telinit ] ; then
+               if [ "${XSTATICVT}" = "yes" -o ! -x /sbin/telinit ] ; then
                        /etc/X11/startDM.sh
                else
                        #tell init to run /etc/X11/startDM.sh after current
                        #runlevel is finished (should *not* be in the "boot"
                        #                      runlevel).
-                       /sbin/telinit a &>/dev/null
+                       /sbin/telinit a >/dev/null 2>/dev/null
                fi
                eend 0
        fi
@@ -138,40 +130,37 @@ start() {
 stop() {
        local retval=0
        local curvt=
-       if [ -t 0 ]
-       then
-               if [ -n $(type -p fgconsole) ]
-               then
+       if [ -t 0 ] ; then
+               if type fgconsole >/dev/null 2>/dev/null ; then
                        curvt="$(fgconsole 2>/dev/null)"
                else
                        curvt="$(tty)"
-                       if [ "${curvt}" == /dev/ttyv[0-9]* ]
-                       then
-                               curvt="${curvt#/dev/ttyv*}"
-                       else
-                               curvt=
-                       fi
+                       case "${curvt}" in
+                               /dev/ttyv[0-9]*) curvt="${curvt#/dev/ttyv*}" ;;
+                               *) curvt= ;;
+                       esac
                fi
        fi
        local myexe="$(get_options "service")"
-       local myservice="${myexe##*/}"
+       local myname="$(get_options "name")"
+       local mypidfile="$(get_options "pidfile")"
+       local myservice=${myexe##*/}
        
        ebegin "Stopping ${myservice}"
 
-       if start-stop-daemon --quiet --test --stop --exec "${myexe}" >/dev/null
-       then
-               start-stop-daemon --quiet --stop --exec "${myexe}" --retry TERM/5/TERM/5
+       if start-stop-daemon --quiet --test --stop --exec "${myexe}" ; then
+               start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+                       ${mypidfile:+--pidfile} ${mypidfile} \
+                       ${myname:+--name} ${myname}
                retval=$?
        fi
 
        #switch back to original vt
-       if [ -n "${curvt}" ]
-       then
-               if [ -n $(type -p chvt) ]
-               then
-                       chvt "${curvt}" &>/dev/null
+       if [ -n "${curvt}" ] ; then
+               if type chvt >/dev/null 2>/dev/null ; then
+                       chvt "${curvt}"
                else
-                       vidcontrol -s "${curvt}"        
+                       vidcontrol -s "$((${curvt} + 1))"       
                fi
        fi
        eend ${retval} "Error stopping ${myservice}"
@@ -179,5 +168,4 @@ stop() {
        return ${retval}
 }
 
-
 # vim:ts=4