diff options
author | Guillem Jover <guillem@hadrons.org> | 2020-09-21 00:25:54 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2020-10-09 23:59:16 +0900 |
commit | 3e8541803624678925a477a03e19e3c155b5fc12 (patch) | |
tree | 3b252c3d11cdf8f8e6c974f8632f4580160ecaf1 /scripts/package/builddeb | |
parent | 51ccdbfbed79bae4b9c2529ec980de4508455a47 (diff) |
builddeb: Enable rootless builds
This makes it possible to build the Debian packages without requiring
(pseudo-)root privileges, when the build drivers support this mode
of operation.
See-Also: /usr/share/doc/dpkg/rootless-builds.txt.gz
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/package/builddeb')
-rwxr-xr-x | scripts/package/builddeb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 30e8c6a20171..6474084c32a4 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -26,6 +26,7 @@ if_enabled_echo() { create_package() { local pname="$1" pdir="$2" + local dpkg_deb_opts mkdir -m 755 -p "$pdir/DEBIAN" mkdir -p "$pdir/usr/share/doc/$pname" @@ -36,14 +37,18 @@ create_package() { | xargs -r0 md5sum > DEBIAN/md5sums" # Fix ownership and permissions - chown -R root:root "$pdir" + if [ "$DEB_RULES_REQUIRES_ROOT" = "no" ]; then + dpkg_deb_opts="--root-owner-group" + else + chown -R root:root "$pdir" + fi chmod -R go-w "$pdir" # in case we are in a restrictive umask environment like 0077 chmod -R a+rX "$pdir" # Create the package dpkg-gencontrol -p$pname -P"$pdir" - dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. + dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. } deploy_kernel_headers () { |