#!/usr/bin/sudo /bin/sh
set -x
if [ -z "$BUILD_HOSTNAME" ]; then
. ./rpi2-settings.sh
fi
umount ${INSTALL_DEVICE}p*
cat rpi2-create-fdisk-keys_with_swap | fdisk "${INSTALL_DEVICE}"
partprobe -s "${INSTALL_DEVICE}"
umount "${INSTALL_DEVICE}p1"
mkfs.vfat "${INSTALL_DEVICE}p1"
swapoff "${INSTALL_DEVICE}p2"
mkswap "${INSTALL_DEVICE}p2"
umount "${INSTALL_DEVICE}p3"
resize2fs "${INSTALL_DEVICE}p3"
mkfs.ext4 "${INSTALL_DEVICE}p3"
MOUNTDIR="$BUILDDIR/mount"
mkdir -p "${MOUNTDIR}"
mount "${INSTALL_DEVICE}p3" "${MOUNTDIR}"
mkdir -p "${MOUNTDIR}/boot/firmware"
mount "${INSTALL_DEVICE}p1" "${MOUNTDIR}/boot/firmware"
rsync -a "${R}/" "${MOUNTDIR}/" 2> /dev/null
# Entladen der Mounts:
sync
umount "${MOUNTDIR}/boot/firmware"
umount "${MOUNTDIR}"