vinaigrette/images/make-images

56 lines
1.5 KiB
Text
Raw Normal View History

2018-04-26 15:50:46 +02:00
#!/bin/bash
# For some reason, building images for buster from stretch requires libdebian-installer4 0.119 instead of 0.110, c.f. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904699 ... installed it by manually downloading and dpkg -i the .deb
readonly DISTRIB=buster
2018-04-26 15:50:46 +02:00
readonly INIT_DIR=$PWD
readonly ARCHS="amd64"
#readonly ARCHS="amd64 i386 armhf armel arm64"
2018-04-26 15:50:46 +02:00
function main()
{
for ARCH in $ARCHS
do
build_image $ARCH
done
}
function build_image()
{
local ARCH=$1
local CHROOT=chroot-${DISTRIB}-${ARCH}
2018-04-26 18:17:56 +02:00
echo ""
echo "Starting build for $ARCH"
echo ""
2018-04-26 15:50:46 +02:00
cd /tmp/
cdebootstrap --arch=${ARCH} --foreign ${DISTRIB} ./$CHROOT http://deb.debian.org/debian/
cp /usr/bin/qemu-arm-static $CHROOT/usr/bin/
cp /usr/bin/qemu-aarch64-static $CHROOT/usr/bin/
cp /etc/resolv.conf $CHROOT/etc/resolv.conf
chroot $CHROOT apt update
chroot $CHROOT apt dist-upgrade
chroot $CHROOT apt install -y build-essential debhelper cmake wget devscripts
2018-04-26 18:36:13 +02:00
if [ "$ARCH" == "amd64" ];
then
chroot $CHROOT wget https://github.com/tj/n/archive/v4.1.0.tar.gz
chroot $CHROOT tar -xvzf v4.1.0.tar.gz
chroot $CHROOT /bin/bash -c "cd n-4.1.0; make install"
chroot $CHROOT n 10 # We take nodjes version 10 because idk
2018-04-26 18:36:13 +02:00
fi
2018-04-26 15:50:46 +02:00
chroot $CHROOT apt clean
2018-04-26 15:50:46 +02:00
cd $CHROOT
echo "Now creating tarball with the filesystem ..."
2018-04-26 15:50:46 +02:00
tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./*
2018-04-26 18:17:56 +02:00
echo ""
echo "Output image should be available as $INIT_DIR/${DISTRIB}-${ARCH}.tgz"
echo ""
2018-04-26 15:50:46 +02:00
}
main