vinaigrette/images/make-images
2018-04-26 18:36:13 +02:00

51 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
readonly DISTRIB=stretch
readonly INIT_DIR=$PWD
readonly ARCHS="amd64 i386 armhf armel arm64"
function main()
{
for ARCH in $ARCHS
do
build_image $ARCH
done
}
function build_image()
{
local ARCH=$1
local CHROOT=chroot-${DISTRIB}-${ARCH}
echo ""
echo "Starting build for $ARCH"
echo ""
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-get update
chroot $CHROOT apt-get dist-upgrade
chroot $CHROOT apt-get install -y build-essential debhelper cmake wget devscripts
if [ "$ARCH" == "amd64" ];
then
chroot $CHROOT wget -q -O /tmp/setup_nodejs https://deb.nodesource.com/setup_4.x
chroot $CHROOT bash /tmp/setup_nodejs
chroot $CHROOT apt-get install -y nodejs
fi
chroot $CHROOT apt-get clean
cd $CHROOT
tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./*
echo ""
echo "Output image should be available as $INIT_DIR/${DISTRIB}-${ARCH}.tgz"
echo ""
}
main