#!/bin/bash

mkdir -p /etc/setup

export DEBIAN_FRONTEND=noninteractive

# install bash and only bash so that the setup scripts can assume bash
apt update
apt install -y bash

if [ ! -e /etc/setup/setup-done ]; then
    /bin/bash << 'EOF'
    for FILE in /boot/setup-scripts/*.sh; do
        echo "running '$FILE'" | logger -s -t setup-scripts
        /bin/bash $FILE 2>&1 | logger -s -t setup-scripts
    done
EOF
    echo "system init complete" | logger -s -t setup-scripts
    touch /etc/setup/setup-done
fi

