install-chroot.sh: remove specific tmpl stuff and misc cosmetics.
--HG-- extra : convert_revision : 9437554e4066a6d29729ba8947301df5c58d8a05
This commit is contained in:
parent
86184903d4
commit
f9e72536ee
|
@ -17,11 +17,7 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "=> Preparing sandbox on $XBPS_MASTERDIR... "
|
||||
|
||||
if [ ! -x $XBPS_MASTERDIR/bin/sh ]; then
|
||||
cd $XBPS_MASTERDIR/bin && ln -s bash sh
|
||||
fi
|
||||
echo "==> Preparing chroot on $XBPS_MASTERDIR... "
|
||||
|
||||
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
|
||||
chown -R root:root $XBPS_MASTERDIR/*
|
||||
|
@ -30,31 +26,38 @@ if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
|
|||
touch $XBPS_MASTERDIR/.xbps_perms_done
|
||||
fi
|
||||
|
||||
if [ ! -h $XBPS_MASTERDIR/usr/bin/cc ]; then
|
||||
cd $XBPS_MASTERDIR/usr/bin && ln -s gcc cc
|
||||
fi
|
||||
|
||||
for f in bin sbin tmp var sys proc dev xbps; do
|
||||
[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
|
||||
done
|
||||
|
||||
for f in sys proc dev; do
|
||||
for f in sys proc dev xbps; do
|
||||
if [ ! -f $XBPS_MASTERDIR/.${f}_mount_bind_done ]; then
|
||||
mount -o bind /$f $XBPS_MASTERDIR/$f
|
||||
[ $? -eq 0 ] && touch $XBPS_MASTERDIR/.${f}_mount_bind_done
|
||||
echo -n "=> Mounting $f in chroot... "
|
||||
if [ "$f" = "xbps" ]; then
|
||||
mount -o bind $XBPS_DISTRIBUTIONDIR $XBPS_MASTERDIR/$f
|
||||
else
|
||||
mount -o bind /$f $XBPS_MASTERDIR/$f
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
touch $XBPS_MASTERDIR/.${f}_mount_bind_done
|
||||
echo "done."
|
||||
else
|
||||
echo "failed."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -f $XBPS_MASTERDIR/.xbps_mount_bind_done ]; then
|
||||
mount -o bind $XBPS_DISTRIBUTIONDIR $XBPS_MASTERDIR/xbps
|
||||
[ $? -eq 0 ] && touch $XBPS_MASTERDIR/.xbps_mount_bind_done
|
||||
fi
|
||||
|
||||
if [ ! -f $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done ]; then
|
||||
[ ! -d $XBPS_MASTERDIR/xbps-builddir ] && mkdir -p \
|
||||
$XBPS_MASTERDIR/xbps-builddir
|
||||
echo -n "=> Mounting xbps-builddir in chroot... "
|
||||
mount -o bind $XBPS_BUILDDIR $XBPS_MASTERDIR/xbps-builddir
|
||||
[ $? -eq 0 ] && touch $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done
|
||||
if [ $? -eq 0 ]; then
|
||||
touch $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done
|
||||
echo "done."
|
||||
else
|
||||
echo "failed."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "XBPS_DISTRIBUTIONDIR=/xbps" > $XBPS_MASTERDIR/etc/xbps.conf
|
||||
|
@ -65,15 +68,13 @@ echo "XBPS_SRCDISTDIR=/xbps/srcdistdir" >> $XBPS_MASTERDIR/etc/xbps.conf
|
|||
echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPS_MASTERDIR/etc/xbps.conf
|
||||
echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPS_MASTERDIR/etc/xbps.conf
|
||||
|
||||
echo "done."
|
||||
|
||||
install_chroot_pkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
|
||||
[ -z "$pkg" ] && return 1
|
||||
|
||||
echo -n "=> Rebuilding dynamic linker's cache..."
|
||||
echo -n "==> Rebuilding chroot's dynamic linker cache..."
|
||||
chroot $XBPS_MASTERDIR /sbin/ldconfig -c /etc/ld.so.conf
|
||||
chroot $XBPS_MASTERDIR /sbin/ldconfig -C /etc/ld.so.cache
|
||||
echo " done."
|
||||
|
@ -84,13 +85,26 @@ install_chroot_pkg()
|
|||
|
||||
umount_chroot_fs()
|
||||
{
|
||||
for f in sys proc dev xbps xbps-builddir; do
|
||||
umount $XBPS_MASTERDIR/$f
|
||||
for f in sys proc dev xbps; do
|
||||
[ ! -f $XBPS_MASTERDIR/.${f}_mount_bind_done ] && continue
|
||||
echo -n "=> Unmounting $f from chroot... "
|
||||
umount -f $XBPS_MASTERDIR/$f
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f $XBPS_MASTERDIR/.${f}_mount_bind_done
|
||||
echo "done."
|
||||
else
|
||||
echo "failed."
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done
|
||||
rm -f $XBPS_MASTERDIR/.xbps_mount_bind_done
|
||||
rm -f $XBPS_MASTERDIR/.sys_mount_bind_done
|
||||
rm -f $XBPS_MASTERDIR/.dev_mount_bind_done
|
||||
rm -f $XBPS_MASTERDIR/.proc_mount_bind_done
|
||||
if [ -f $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done ]; then
|
||||
echo -n "=> Unmounting xbps-builddir from chroot... "
|
||||
umount -f $XBPS_MASTERDIR/xbps-builddir
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f $XBPS_MASTERDIR/.xbps_builddir_mount_bind_done
|
||||
echo "done."
|
||||
else
|
||||
echo "failed."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue