# Exit on error:
set -e

wget http://ftp.clfs.org/pub/clfs/conglomeration/bootscripts-cross-lfs/bootscripts-cross-lfs-2.0.0.tar.xz
tar xf bootscripts-cross-lfs-2.0.0.tar.xz
cd bootscripts-cross-lfs-2.0-pre2

CC=/static/bin/musl-gcc \
    LDFLAGS='-s -L/static/lib -static -static-libgcc' \
    DESTDIR=/static \
    make install-bootscripts

CC=/static/bin/musl-gcc \
    LDFLAGS='-s -L/static/lib -static -static-libgcc' \
    DESTDIR=/static \
    make install-network

cd ..
rm -rf bootscripts-cross-lfs-2.0-pre2
rm bootscripts-cross-lfs-2.0.0.tar.xz

exit 0
