Skip to content

Commit

Permalink
builddeb: Enable rootless builds
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
guillemj authored and masahir0y committed Oct 9, 2020
1 parent 51ccdbf commit 3e85418
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/package/builddeb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 () {
Expand Down
1 change: 1 addition & 0 deletions scripts/package/mkdebian
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Source: $sourcename
Section: kernel
Priority: optional
Maintainer: $maintainer
Rules-Requires-Root: no
Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends
Homepage: https://www.kernel.org/
Expand Down

0 comments on commit 3e85418

Please sign in to comment.