aboutsummaryrefslogtreecommitdiffstats
path: root/prefdm
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2009-03-24 16:42:37 -0400
committerBill Nottingham <notting@redhat.com>2009-03-24 16:42:37 -0400
commit7fed044885fb2eeb92fe59cec649318caff7e382 (patch)
tree1c453c3557829ab99b52dddcfdde3714385aaf6f /prefdm
parent5c8995665e71133cd840dc8f5b1b48a9333e9706 (diff)
downloadinitscripts-7fed044885fb2eeb92fe59cec649318caff7e382.tar
initscripts-7fed044885fb2eeb92fe59cec649318caff7e382.tar.gz
initscripts-7fed044885fb2eeb92fe59cec649318caff7e382.tar.bz2
initscripts-7fed044885fb2eeb92fe59cec649318caff7e382.tar.xz
initscripts-7fed044885fb2eeb92fe59cec649318caff7e382.zip
Do a generic fallback based on provides of 'service(graphical-login)' (#485751, essentially.)
This removes hardcoded fallbacks.
Diffstat (limited to 'prefdm')
-rwxr-xr-xprefdm14
1 files changed, 9 insertions, 5 deletions
diff --git a/prefdm b/prefdm
index 57cfafc9..10b679d5 100755
--- a/prefdm
+++ b/prefdm
@@ -35,10 +35,14 @@ shopt -s execfail
[ -n "$preferred" ] && exec $preferred "$@" >/dev/null 2>&1 </dev/null
-# Fallbacks, in order
-exec gdm "$@" >/dev/null 2>&1 </dev/null
-exec kdm "$@" >/dev/null 2>&1 </dev/null
-exec wdm "$@" >/dev/null 2>&1 </dev/null
-exec xdm "$@" >/dev/null 2>&1 </dev/null
+for pkg in $(rpm -q --qf "%{NAME}\n" --whatprovides "service(graphical-login)") ; do
+ dm=$(rpm -q --provides $pkg | awk '/^service\(graphical-login\)/ { print $3 ; exit }')
+ if [ -n "$dm" ]; then
+ exec $dm "$@" >/dev/null 2>&1 </dev/null
+ else
+ exec $pkg "$@" >/dev/null 2>&1 </dev/null
+ fi
+done
+
# catch all exit error
exit 1