Bug#527896: allow /etc/init.d/kdm status as non-root user
Package: kdm
Version: 4:4.2.2-2
Severity: wishlist
Tags: patch
User: petere@debian.org
Usertags: initd-status-support
It would be nice if the status actions of init.d scripts worked reasonably
when run as non-root user. With kdm, this doesn't work because the init
script unconditionally performs the kdm configuration setup. I have attached
a rough patch that executes this setup only when the start action is
requested. I think it works OK, but you may want to double check it.
[31m--- /etc/init.d/kdm 2009-03-12 01:13:36.000000000 +0200[m
[32m+++ kdm 2009-05-09 11:58:06.000000000 +0300[m
[34m@@ -30,6 +30,7 @@[m
PIDFILE=/var/run/kdm.pid
UPGRADEFILE=/var/run/kdm.upgrade
[32m+setup_kdm_config () {[m
# parameters to support kdm customization
KDMRC=/etc/kde4/kdm/kdmrc
BACKGROUNDRC=/etc/kde4/kdm/backgroundrc
[34m@@ -86,6 +87,7 @@[m
[ -n "$AUTOLOGINDELAY" ] && sed -i "s|^#\?AutoLoginDelay=.*|AutoLoginDelay=$AUTOLOGINDELAY|" $KDMCFG
[ -n "$AUTOLOGINAGAIN" ] && sed -i "s|^#\?AutoLoginAgain=.*|AutoLoginAgain=$AUTOLOGINAGAIN|" $KDMCFG
[ -n "$AUTOLOGINLOCKED" ] && sed -i "s|^#\?AutoLoginLocked=.*|AutoLoginLocked=$AUTOLOGINLOCKED|" $KDMCFG
[32m+}[m
# If we upgraded the daemon, we can't use the --exec argument to
# start-stop-daemon since the inode will have changed. The risk here is that
[34m@@ -111,6 +113,7 @@[m
case "$1" in
start)
[32m+ setup_kdm_config[m
if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
[ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
[ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
Reply to: