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

Re: not starting a daemon upon installation



On Sun, 2020-03-08 at 18:50 +0100, Marc Haber wrote:
> On Sun, 08 Mar 2020 14:58:01 +0000, jnqnfe@gmail.com wrote:
> > how live-build achieves this is essentially the same as happens to
> > be
> > discussed in the linked page for Debian's debootstrap package (the
> > tool
> > for building the base filesystem).
> > 
> > that is to use dpkg-divert to temporarily replace the /sbin/start-
> > stop-
> > daemon binary with something that essentially just exits with
> > success
> > (i.e. 0).
> 
> debootstrap's files don't contain the string "divert". They do,
> however, dump "exit 101" to $TARGET/usr/sbin/poliy-rc.d.

I had not looked at debootstrap's approach until just now. their's is
indeed partially to use the policy-rc.d solution as you say, but also
to do similar to the dpkg-divert solution only without actually using
dpkg-divert, they just move the original file.

extracting from debootstrap's scripts/debian-common:
```
	echo \
"#!/bin/sh
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
	chmod 755 "$TARGET/usr/sbin/policy-rc.d"

	mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-
daemon.REAL"
	echo \
"#!/bin/sh
echo
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" >
"$TARGET/sbin/start-stop-daemon"
	chmod 755 "$TARGET/sbin/start-stop-daemon"
```

I also found the following entry in debootstrap's changelog which is
interesting wrt. this discussion, from v1.0.52 (May 2013):
```
  * scripts/sid, scripts/gutsy: Add a policy-rc.d, matching that in
    debian-installer-utils.  This is the primary way to disable daemon
    startup.
```


Reply to: