Thorsten Glaser wrote:
> On Sun, 11 May 2014, Marc Haber wrote:
[...]
> On Sun, 11 May 2014, Cyril Brulebois wrote:
> 
> > Marc Haber <mh+debian-de...@zugschlus.de> (2014-05-11):
> > > Just curious as the maintainer of another package using su in an
> > > init script since 2001, how am I supposed to start a non-root
> > > process from an init script?
> > 
> > start-stop-daemon has:
> > 
> >        -c, --chuid username|uid[:group|gid]
> 
> But the start-stop-daemon documentation seems to imply (please
> correct me if I’m wrong) that it’s for starting (and stopping)
> specific executables, as dæmons, with pidfiles, etc. – not for
> just running some shell code (which may or may not start other
> processes and/or dæmons) as another user.
> 
> Taking dirmngr as example again:
> 
> output=$(su -c ". /lib/lsb/init-functions && umask 027 &&
> start_daemon -p $PIDFILE $DAEMON --daemon --sh" dirmngr) || return 1
> eval "$output" || return 1
> 
> Before preparing the NMU¹, I searched long and wide for something
> using start-stop-daemon which could replace this piece of code,
> and found it not.

I've prepared a NMU to replace su by start-stop-daemon and the change
was pretty straightforward:

 output=$(start-stop-daemon --start --quiet --exec $DAEMON --oknodo --pidfile 
$PIDFILE --umask 027 --chuid dirmngr -- --daemon --sh) || return 1
 eval "$output" || return 1

Cheers,

Laurent Bigonville

> 
> ① Note I did NMU dirmngr to remove the -l from the su call,
>   which was causing problems.


--
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140513011414.0dad6...@fornost.bigon.be

Reply via email to