From a41760637497f19009818f539717c629d7b7805d Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Sun, 8 Dec 2024 13:33:42 +0000 Subject: [PATCH] Enable building as non-root (Closes: #1089291) Rather than doing a check-for-being root and then explicitly chowning things to root during the build, instead make use of dpkg's --root-owner-group which has been in dpkg since 1.19.0, before oldoldstable. --- debian/control | 1 + debian/rules | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/debian/control b/debian/control index de5fbd7..e33fc1a 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: Matthew Vernon Build-Depends: libreadline-dev, debhelper-compat (= 12) Standards-Version: 4.5.1 +Rules-Requires-Root: no Package: bible-kjv Architecture: any diff --git a/debian/rules b/debian/rules index 57e8174..6a1fd52 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,7 @@ clean: -rm -rf debian/tmp debian/files* bible debian/bible-kjv-text \ debian/randverse debian/substvars randverse -binary-indep: checkroot build +binary-indep: build $(checkdir) -rm -fr debian/tmp debian/bible-kjv-text/ install -d debian/tmp/usr @@ -55,11 +55,10 @@ binary-indep: checkroot build cd debian/tmp && \ mv `cat ../bible-kjv-text.files` ../bible-kjv-text/usr/lib dpkg-gencontrol -pbible-kjv-text -Pdebian/bible-kjv-text -isp - chown -R root.root debian/bible-kjv-text chmod -R go=rX debian/bible-kjv-text - dpkg --build debian/bible-kjv-text .. + dpkg-deb --build --root-owner-group debian/bible-kjv-text .. -binary-arch: checkroot build +binary-arch: build $(checkdir) -rm -rf debian/tmp debian/bible-kjv-text/ install -d debian/tmp debian/tmp/DEBIAN @@ -87,9 +86,8 @@ binary-arch: checkroot build rm `cat ../bible-kjv-text.files` dpkg-shlibdeps bible dpkg-gencontrol -pbible-kjv -Pdebian/tmp -isp - chown -R root.root debian/tmp chmod -R g-ws debian/tmp - dpkg --build debian/tmp .. + dpkg-deb --build --root-owner-group debian/tmp .. binary: binary-indep binary-arch @@ -100,8 +98,4 @@ endef source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false -checkroot: - $(checkdir) - test root = "`whoami`" - -.PHONY: binary binary-arch binary-indep clean checkroot build-arch build-indep +.PHONY: binary binary-arch binary-indep clean build-arch build-indep -- 2.30.2