Use mkarchroot for package installation

Switch from running pacman directly. This requires root, and thus
fakeroot use has been removed.

Signed-off-by: Simo Leone <simo@archlinux.org>
This commit is contained in:
Simo Leone 2007-10-06 04:20:26 -05:00 committed by Dan McGee
parent 0ed7712017
commit db2a9699bd

View File

@ -13,7 +13,11 @@ isoname=""
PKGDIR="." PKGDIR="."
APPNAME=$(basename "${0}") APPNAME=$(basename "${0}")
ALL_ARGS="${@}" #for fakeroot usage
if [ "$EUID" != "0" ]; then
echo "This script must be run as root."
exit 1
fi
usage () usage ()
{ {
@ -70,12 +74,6 @@ fi
isoroot="${work_dir}/iso" isoroot="${work_dir}/iso"
instroot="${work_dir}/install" instroot="${work_dir}/install"
if [ -z $FAKEROOTKEY ]; then
echo "Switching to fakeroot environment"
fakeroot ${0} ${ALL_ARGS}
exit $?
fi
_kversion () _kversion ()
{ {
source ${instroot}/etc/mkinitcpio.d/kernel26.kver source ${instroot}/etc/mkinitcpio.d/kernel26.kver
@ -84,35 +82,20 @@ _kversion ()
_pacman () _pacman ()
{ {
#depmod causes fakechroot to coredump - it's harmless, but makes the output ugly if ! mkarchroot -f ${instroot} $*; then
fkchroot=""
if [ "${1}" = "-safe" ]; then
fkchroot=""
shift 1
fi
FAKEROOTSAV=$FAKEROOTKEY; unset FAKEROOTKEY
#TODO this grep is a tad weird...
if ! eval "${fkchroot} pacman -Sf --noconfirm -r \"${instroot}\" $*"; then
exit 1 exit 1
fi fi
FAKEROOTKEY=$FAKEROOTSAV
} }
install_pkgfile () install_pkgfile ()
{ {
safe=""
if [ "${1}" = "-safe" ]; then
safe="-safe"
shift 1
fi
if [ -e "${1}" ]; then if [ -e "${1}" ]; then
toinstall="" toinstall=""
while read pkg; do while read pkg; do
echo $ignorepkgs | grep "\<$pkg\>" >/dev/null 2>&1 && continue echo $ignorepkgs | grep "\<$pkg\>" >/dev/null 2>&1 && continue
toinstall="${toinstall} ${pkg}" toinstall="${toinstall} ${pkg}"
done < ${1} done < ${1}
_pacman "${safe}" "${toinstall}" _pacman "${toinstall}"
fi fi
} }
@ -125,13 +108,6 @@ if [ "${command_name}" = "install" -o "${command_name}" = "all" ]; then
mkdir -p "${isoroot}" mkdir -p "${isoroot}"
mkdir -p "${instroot}" mkdir -p "${instroot}"
FAKEROOTSAV=$FAKEROOTKEY; unset FAKEROOTKEY
if ! pacman -Sy -r "${instroot}" | grep -v "cannot open logfile"; then
echo "Error, failed to sync pacman... aborting."
exit 1
fi
FAKEROOTKEY=$FAKEROOTSAV
echo "Installing 'base' packages..." echo "Installing 'base' packages..."
install_pkgfile "${PKGDIR}/base.packages" install_pkgfile "${PKGDIR}/base.packages"
@ -147,12 +123,10 @@ if [ "${command_name}" = "install" -o "${command_name}" = "all" ]; then
done done
echo "Installing kernel '${kernelpkg}'" echo "Installing kernel '${kernelpkg}'"
FAKEROOTSAV=$FAKEROOTKEY; unset FAKEROOTKEY if ! _pacman "${kernelpkg}" ; then
if ! _pacman -safe "${kernelpkg}" ; then
echo "pacman failed to install '${kernelpkg}', aborting..." echo "pacman failed to install '${kernelpkg}', aborting..."
exit 1 exit 1
fi fi
FAKEROOTKEY=$FAKEROOTSAV
kernelver=$(_kversion) kernelver=$(_kversion)
kernelsuffix=${kernelver##*-} kernelsuffix=${kernelver##*-}
echo "Kernel Version ${kernelver} (${kernelsuffix}) installed - installing modules..." echo "Kernel Version ${kernelver} (${kernelsuffix}) installed - installing modules..."