2019-04-11 14:03:56 +00:00
|
|
|
#!/bin/bash
|
2015-04-09 22:53:46 +00:00
|
|
|
#
|
|
|
|
# build.sh
|
|
|
|
|
2015-04-15 09:23:37 +00:00
|
|
|
if [ "$1" != "$2" ]; then
|
|
|
|
arch="-a $2"
|
2015-04-09 22:53:46 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-06 01:47:54 +00: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 14:03:56 +00: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 01:47:54 +00:00
|
|
|
|
2019-06-16 19:40:40 +00:00
|
|
|
# Two times due to updating xbps itself
|
|
|
|
/hostrepo/xbps-src -H "$HOME"/hostdir bootstrap-update
|
2019-06-12 10:42:47 +00:00
|
|
|
/hostrepo/xbps-src -H "$HOME"/hostdir bootstrap-update
|
|
|
|
|
2019-03-06 01:47:54 +00:00
|
|
|
PKGS=$(/hostrepo/xbps-src sort-dependencies $(cat /tmp/templates))
|
2015-08-16 08:53:30 +00:00
|
|
|
|
2019-06-04 10:09:53 +00:00
|
|
|
NPROCS=1
|
|
|
|
if [ -r /proc/cpuinfo ]; then
|
|
|
|
NPROCS=$(grep ^proc /proc/cpuinfo|wc -l)
|
|
|
|
fi
|
|
|
|
|
2015-08-16 08:53:30 +00:00
|
|
|
for pkg in ${PKGS}; do
|
2019-06-04 10:09:53 +00:00
|
|
|
/hostrepo/xbps-src -j$NPROCS -H "$HOME"/hostdir $arch pkg "$pkg"
|
2015-04-10 09:38:13 +00:00
|
|
|
[ $? -eq 1 ] && exit 1
|
2015-04-09 22:53:46 +00:00
|
|
|
done
|
|
|
|
|
2015-04-10 12:38:49 +00:00
|
|
|
exit 0
|