#!/bin/bash
#set -e -u

device="akna"
codename="unstable"
FSSIZEMB=${FSSIZEMB:-1024}

ARGS="$@"

tempcfg="mkos-${device}-installer.mstrap"
tempmount="mkos-${device}-installer.fs"
cfgfile=/usr/share/mkos-${device}/$tempcfg

# Generate the multistrap config file.
mkos-mlo-config -i $cfgfile -o $tempcfg -t mkos-${device}.tar.gz -p device-${device}-base $ARGS

# Run the pre-multistrap hooks, then produce the filesystem directory.
#
# Additional hooks inside of multistrap will create the tgz, repo, manifest,
# ISO, and IMG files.
mkos-mlo-prehooks $tempmount $@ &&
    FSSIZEMB=$FSSIZEMB fakeroot /usr/sbin/multistrap -f $tempcfg -d $tempmount

