Added native utilities to mount/umount/chroot via capabilities(7).

Three new helpers will now be installed into ${libexecdir}:
 - xbps-src-capchroot needs to have set CAP_SYS_CHROOT ep.
 - xbps-src-chroot-cap{,u}mount: needs to have set CAP_SYS_ADMIN ep.

That means that libcap and setcap(8) are now required to install
xbps-src and use it as normal user.

--HG--
extra : convert_revision : 586d6526079e085f86bf3e393459d429f6f0ef99
This commit is contained in:
Juan RP 2010-04-26 14:15:49 +02:00
parent 6673252679
commit e3dc3e3066
9 changed files with 293 additions and 34 deletions

View file

@ -38,8 +38,6 @@ if [ "${chroot_cmd}" = "chroot" ]; then
echo "Root permissions are required for the chroot, try again."
exit 1
fi
else
chroot_cmd_args="--"
fi
. $XBPS_SHUTILSDIR/builddep_funcs.sh
@ -154,7 +152,7 @@ prepare_binpkg_repos()
{
if [ ! -f "$XBPS_MASTERDIR/.xbps_added_local_repo" ]; then
msg_normal "Registering local binpkg repo..."
${chroot_cmd} $XBPS_MASTERDIR ${chroot_cmd_args} \
${chroot_cmd} $XBPS_MASTERDIR \
xbps-repo.static add /xbps_packagesdir
[ $? -eq 0 ] && touch -f $XBPS_MASTERDIR/.xbps_added_local_repo
fi
@ -233,12 +231,12 @@ xbps_chroot_handler()
# Reinstall xbps-src in the chroot
if [ ! -f $XBPS_MASTERDIR/usr/local/sbin/xbps-src ]; then
env in_chroot=yes LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR ${chroot_cmd_args} sh -c \
"cd /xbps/xbps-src && make install clean"
${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/xbps-src && make IN_CHROOT=1 install clean"
fi
if [ "$action" = "chroot" ]; then
env in_chroot=yes LANG=C PATH=$path \
env in_chroot=yes IN_CHROOT=1 LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR /bin/sh
else
local lenv
@ -247,8 +245,7 @@ xbps_chroot_handler()
[ -n "$norm_builddir" ] && \
action="-C $action"
env in_chroot=yes LANG=C PATH=$path \
${lenv} ${chroot_cmd} $XBPS_MASTERDIR \
${chroot_cmd_args} sh -c \
${lenv} ${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action"
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."