[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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.
--- /etc/init.d/kdm	2009-03-12 01:13:36.000000000 +0200
+++ kdm	2009-05-09 11:58:06.000000000 +0300
@@ -30,6 +30,7 @@
 PIDFILE=/var/run/kdm.pid
 UPGRADEFILE=/var/run/kdm.upgrade
 
+setup_kdm_config () {
 # parameters to support kdm customization
 KDMRC=/etc/kde4/kdm/kdmrc
 BACKGROUNDRC=/etc/kde4/kdm/backgroundrc
@@ -86,6 +87,7 @@
 [ -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
+}
 
 # 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
@@ -111,6 +113,7 @@
 
 case "$1" in
   start)
+    setup_kdm_config
     if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
        [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
        [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then

Reply to: