diff options
author | Dan Nicholson <nicholson@endlessm.com> | 2019-01-03 11:31:45 -0600 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2020-08-06 10:24:20 +0200 |
commit | dbba0d39667032277400ead7e2d08b9caa9ac2c2 (patch) | |
tree | e6ab90af4b0a47e49ba24a191b5f56d7bef411a8 | |
parent | f3ac9ceceea5983377dd5486ebdd3d851ae66f3f (diff) |
deb: Install policy-rc.d to prevent services from starting
Per invoke-rc.d(8), a local policy script can be created at
/usr/sbin/policy-rc.d to influence how services are started. When this
script exits with code 101, the requested service is not started. This
is independent of init system and is respected by all maintainer
scripts that comply with debian policy.
This is how debootstrap prevents services from running in the chroot. On
more recent debian and ubuntu releases where systemd is in use, it will
prevent services from starting by detecting that it's in a chroot, but
this method works independently of the init system. In our case this
fixes builds on Ubuntu Trusty where upstart is init. This change likely
makes the hack to replace /sbin/start with a symlink to /sbin/true
unnecessary. That hack is not comprehensive since it only handles the
start action and not stop, restart, reload, etc.
Forwarded: https://github.com/openSUSE/obs-build/pull/484
Applied-upstream: commit:fdb38b34afa8c91eaad37582ab5cedbd06a7817d
Gbp-Pq: Name deb-Install-policy-rc.d-to-prevent-services-from-starting.patch
-rw-r--r-- | build-pkg-deb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/build-pkg-deb b/build-pkg-deb index c5959c0..4437149 100644 --- a/build-pkg-deb +++ b/build-pkg-deb @@ -48,6 +48,16 @@ deb_setup() { :>> $BUILD_ROOT/var/lib/dpkg/available :>> $BUILD_ROOT/var/log/dpkg.log :>> $BUILD_ROOT/etc/ld.so.conf + + # Install a policy so that services are not started. See + # https://manpages.debian.org/unstable/init-system-helpers/invoke-rc.d.8.en.html + # for details. + mkdir -p $BUILD_ROOT/usr/sbin + cat > $BUILD_ROOT/usr/sbin/policy-rc.d <<EOF +#!/bin/sh +exit 101 +EOF + chmod 755 $BUILD_ROOT/usr/sbin/policy-rc.d } pkg_initdb_deb() { |