xbps-src: require sudo to build packages.

The reason is that fakeroot can't read files that have restrictive
perms and you'd have to change them before the src installation, and
restoring them at binpkg pre-installation.

I prefer to avoid all this and build the pkg with appropiate perms.

--HG--
extra : convert_revision : 8a5086049ab575962913eda0cb2ace0c211b97f1
This commit is contained in:
Juan RP 2009-02-16 17:36:21 +01:00
parent 4094879d4d
commit 1802997b0b
8 changed files with 14 additions and 13 deletions

View file

@ -76,7 +76,7 @@ To install binary packages, firstly a repository must be created as well as
some binary packages for it. The flow for this task is:
1- xbps-src install <package>
2- xbps-src build-pkg all
2- xbps-src build-pkg all [requires sudo access]
3- xbps-src genindex
4- xbps-repo add $XBPS_PACKAGES
5- xbps-bin install -r /rootdir <package>

View file

@ -43,6 +43,7 @@ xbps binary/source packages:
* wget
* libarchive (development package)
* perl
* sudo
Super-user privileges are required as well, because all packages are built
in a chroot (except the ones that are included in a virtual package to be

View file

@ -2,7 +2,8 @@
REQUIREMENTS
-----------------------------------------------------------------------------
To be able to build packages the following software is required:
To be able to build packages from source the following software is required
in the host system:
* GNU Binutils
* GNU Bison
@ -20,8 +21,6 @@ Super-user privileges are required as well, because all packages are built
in a chroot (except the ones that are included in a virtual package to be
able to build a minimal system for the chroot).
PLEASE NOTE THAT fakechroot or fakeroot-ng DO NOT WORK.
------------------------------------------------------------------------------
HOW TO BUILD/HANDLE PACKAGES FROM SOURCE
------------------------------------------------------------------------------

View file

@ -16,8 +16,6 @@ xbps-cmpver:
Packages:
* fix mpfr hardcoded rpath for gmp.
* Fix sudo permissions for /etc/sudoers. This must be 644 to be able to
build the binary package.
xbps-bin:
* Add support to handle conf_files and keep_dirs from package metadata.

View file

@ -165,7 +165,7 @@ xbps_make_binpkg()
binpkg=$pkgname-$version.$arch.xbps
pkgdir=$XBPS_PACKAGESDIR/$arch
run_rootcmd tar cfjp $XBPS_DESTDIR/$binpkg .
run_rootcmd yes tar cfjp $XBPS_DESTDIR/$binpkg .
if [ $? -eq 0 ]; then
[ ! -d $pkgdir ] && mkdir -p $pkgdir
mv -f $XBPS_DESTDIR/$binpkg $pkgdir

View file

@ -39,12 +39,19 @@ run_func()
run_rootcmd()
{
local lenv=
local usesudo="$1"
[ -n "$in_chroot" ] && unset fakeroot_cmd
lenv="XBPS_DESTDIR=$XBPS_DESTDIR"
lenv="XBPS_DISTRIBUTIONDIR=$XBPS_DISTRIBUTIONDIR $lenv"
env ${lenv} ${fakeroot_cmd} $@
shift
if [ -n "$usesudo" -a -z "$in_chroot" ]; then
sudo env ${lenv} $@
else
env ${lenv} ${fakeroot_cmd} $@
fi
}
msg_error()

View file

@ -106,7 +106,7 @@ make_install()
#
# Install package via make.
#
run_rootcmd ${make_cmd} ${make_install_target} ${make_install_args}
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args}
if [ "$?" -ne 0 ]; then
msg_error "installing $pkgname-$version."
exit 1

View file

@ -32,8 +32,4 @@ session optional pam_xauth.so
session required pam_env.so
session required pam_unix.so
_EOF
chmod 644 $destdir/etc/pam.d/sudo
chmod 644 $destdir/usr/libexec/sudo/sudo_noexec.so
chmod 755 $destdir/usr/bin/sudo* $destdir/usr/sbin/visudo
chmod 644 $destdir/etc/sudoers
}