#260952 s-s-d: Please allow test mode to be enabled via environment variable

Package:
dpkg
Source:
dpkg
Description:
Debian package management system
Submitter:
Date:
2017-12-07 22:33:04 UTC
Severity:
wishlist
#260952#5
Date:
2004-07-22 23:47:03 UTC
From:
To:
when working with a chroot, it would be most useful if start-stop-daemon
could have a no-action mode defined by an environment variable, such as:

START_STOP_DAEMON_NO_ACT=true

if the environment variable were present, start-stop-daemon should
merely report something like:

"NOTE: start-stop-daemon called in no act mode, exiting"

and exit with status 0

this would be useful for packages such as debootstrap so that it
wouldn't have to move aside the start-stop-daemon during base
installation.

lessdisks-terminal is another package which could make use of this
feature.

#260952#12
Date:
2005-08-18 08:53:33 UTC
From:
To:
[Vagrant Cascadian]

If this feature is implemented in the start-stop-daemon itself, we
would be able to use it in debian-installer, replacing code
implementing our own start-stop-daemon with the simple setting of an
evironment variable.

At the moment we have code like this in apt-install (from
debian-installer-utils):

  # Create a policy-rc.d to stop maintainer scripts using invoke-rc.d from
  # running init scripts. In case of maintainer scripts that don't use
  # invoke-rc.d, add a dummy start-stop-daemon.
  disable_daemons () {
          cat > /target/usr/sbin/policy-rc.d <<EOF
  #!/bin/sh
  exit 101
  EOF
          chmod a+rx /target/usr/sbin/policy-rc.d

          if [ -e /target/sbin/start-stop-daemon ]; then
                  mv /target/sbin/start-stop-daemon /target/sbin/start-stop-daemon.REAL
          fi
          cat > /target/sbin/start-stop-daemon <<EOF
  #!/bin/sh
  echo 1>&2
  echo 'Warning: Fake start-stop-daemon called, doing nothing.' 1>&2
  exit 0
  EOF
          chmod a+rx /target/sbin/start-stop-daemon
  }

  enable_daemons () {
          rm -f /target/usr/sbin/policy-rc.d

          rm /target/sbin/start-stop-daemon
          mv /target/sbin/start-stop-daemon.REAL /target/sbin/start-stop-daemon
  }

I also had to do similar things when I made a script to test upgrades.
In that script I used divert.

  make_dummy_start_stop_daemon() {
      cat > $target/sbin/start-stop-daemon.dummy <<EOF
  #!/bin/sh
  echo 1>&2
  echo 'Warning: Fake start-stop-daemon called, doing nothing.' 1>&2
  exit 0
  EOF
      chmod a+rx $target/sbin/start-stop-daemon.dummy
      chroot $target dpkg-divert --add --local --rename /sbin/start-stop-daemon
      ln -s start-stop-daemon.dummy $target/sbin/start-stop-daemon
  }

So there are workarounds, but it would be better if the functionallity
was in the normal start-stop-daemon.