2019-04-11 16:03:56 +02:00
|
|
|
#!/bin/bash
|
2015-04-10 00:53:46 +02:00
|
|
|
#
|
|
|
|
# build.sh
|
|
|
|
|
2015-04-15 11:23:37 +02:00
|
|
|
if [ "$1" != "$2" ]; then
|
|
|
|
arch="-a $2"
|
2015-04-10 00:53:46 +02:00
|
|
|
fi
|
|
|
|
|
2019-03-06 02:47:54 +01:00
|
|
|
# Tell xbps-src what is our arch, this is done when doing
|
|
|
|
# binary-bootstrap, but we need to do it every time since
|
|
|
|
# our masterdir is ethereal.
|
2019-04-11 16:03:56 +02:00
|
|
|
# /bin/echo -e '\x1b[32mWriting bootstrap arch into .xbps_chroot_init of masterdir\x1b[0m'
|
|
|
|
# echo "$1" > /hostrepo/masterdir/.xbps_chroot_init
|
|
|
|
|
|
|
|
/bin/echo -e '\x1b[32mPreparing chroot with chroot_prepare()\x1b[0m'
|
|
|
|
source hostrepo/common/xbps-src/shutils/chroot.sh || {
|
|
|
|
echo "Failed to source chroot.sh for chroot_prepare()" >&2 ;
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
XBPS_SRCPKGDIR=/hostrepo/srcpkgs XBPS_MASTERDIR=/ chroot_prepare $1 || {
|
|
|
|
echo "Failed to prepare chroot!" >&2 ;
|
|
|
|
exit 1
|
|
|
|
}
|
2019-03-06 02:47:54 +01:00
|
|
|
|
2019-06-16 21:40:40 +02:00
|
|
|
# Two times due to updating xbps itself
|
|
|
|
/hostrepo/xbps-src -H "$HOME"/hostdir bootstrap-update
|
2019-06-12 12:42:47 +02:00
|
|
|
/hostrepo/xbps-src -H "$HOME"/hostdir bootstrap-update
|
|
|
|
|
2019-03-06 02:47:54 +01:00
|
|
|
PKGS=$(/hostrepo/xbps-src sort-dependencies $(cat /tmp/templates))
|
2015-08-16 10:53:30 +02:00
|
|
|
|
2019-06-04 12:09:53 +02:00
|
|
|
NPROCS=1
|
|
|
|
if [ -r /proc/cpuinfo ]; then
|
|
|
|
NPROCS=$(grep ^proc /proc/cpuinfo|wc -l)
|
|
|
|
fi
|
|
|
|
|
2015-08-16 10:53:30 +02:00
|
|
|
for pkg in ${PKGS}; do
|
2019-06-04 12:09:53 +02:00
|
|
|
/hostrepo/xbps-src -j$NPROCS -H "$HOME"/hostdir $arch pkg "$pkg"
|
2015-04-10 11:38:13 +02:00
|
|
|
[ $? -eq 1 ] && exit 1
|
2015-04-10 00:53:46 +02:00
|
|
|
done
|
|
|
|
|
2015-04-10 14:38:49 +02:00
|
|
|
exit 0
|