aboutsummaryrefslogtreecommitdiffstats
path: root/prefdm
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2005-04-15 17:44:24 +0000
committerBill Nottingham <notting@redhat.com>2005-04-15 17:44:24 +0000
commit8986e4b2efaf6df516a813b362a7c26d5f67dcaf (patch)
tree7f2e5b6e0bc970ef43f44f7d4000695cafec8181 /prefdm
parentabd75be1e982ff40055179f66fec5df07ade479e (diff)
downloadinitscripts-8986e4b2efaf6df516a813b362a7c26d5f67dcaf.tar
initscripts-8986e4b2efaf6df516a813b362a7c26d5f67dcaf.tar.gz
initscripts-8986e4b2efaf6df516a813b362a7c26d5f67dcaf.tar.bz2
initscripts-8986e4b2efaf6df516a813b362a7c26d5f67dcaf.tar.xz
initscripts-8986e4b2efaf6df516a813b362a7c26d5f67dcaf.zip
early-login support
Diffstat (limited to 'prefdm')
-rwxr-xr-xprefdm37
1 files changed, 32 insertions, 5 deletions
diff --git a/prefdm b/prefdm
index 303bfd2d..490e8462 100755
--- a/prefdm
+++ b/prefdm
@@ -2,7 +2,6 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
-
# shut down any graphical boot that might exist
if [ -x /usr/bin/rhgb-client ]; then
/usr/bin/rhgb-client -quit
@@ -26,12 +25,40 @@ fi
shopt -s execfail
-[ -n "$preferred" ] && exec $preferred "$@" >/dev/null 2>&1
+# If we're in early-login mode and something is running, bail out
+if grep -q early-login /proc/cmdline 2> /dev/null ; then
+ if [ -n "$preferred" ]; then
+ pidof $preferred >/dev/null 2>&1 && exit 0
+ fi
+ pidof gdm-binary >/dev/null 2>&1 && exit 0
+ pidof kdm >/dev/null 2>&1 && exit 0
+ pidof xdm >/dev/null 2>&1 && exit 0
+fi
+
+if [ -n "$preferred" ]; then
+ $preferred "$@" >/dev/null 2>&1
+ if [ $? -ne 127 ]; then
+ exec $0 "$@"
+ exit $?
+ fi
+fi
# Fallbacks, in order
-exec gdm "$@" >/dev/null 2>&1
-exec kdm "$@" >/dev/null 2>&1
-exec xdm "$@" >/dev/null 2>&1
+gdm "$@" >/dev/null 2>&1
+if [ $? -ne 127 ]; then
+ exec $0 "$@"
+ exit $?
+fi
+kdm "$@" >/dev/null 2>&1
+if [ $? -ne 127 ]; then
+ exec $0 "$@"
+ exit $?
+fi
+xdm "$@" >/dev/null 2>&1
+if [ $? -ne 127 ]; then
+ exec $0 "$@"
+ exit $?
+fi
# catch all exit error
exit 1