diff --git a/.gitignore b/.gitignore index a6883c2..3ae85aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ deploy/* work/* -config postrun.sh SKIP SKIP_IMAGES diff --git a/Dockerfile b/Dockerfile index 35f483a..d91556d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM debian:buster +# Workaround: Use 32-bit base image because building buster images +# on 64-bit hosts is currently broken +# https://github.com/RPi-Distro/pi-gen/issues/271#issuecomment-556812205 +FROM i386/debian:buster ENV DEBIAN_FRONTEND noninteractive diff --git a/config b/config new file mode 100644 index 0000000..5bfd4eb --- /dev/null +++ b/config @@ -0,0 +1,9 @@ +export IMG_NAME=moab_fw +export TARGET_HOSTNAME=moab +export LOCALE_DEFAULT=en_US.UTF-8 +export TIMEZONE_DEFAULT="America/Los_Angeles" +export DEFAULT_TIMEZONE=America/Los_Angeles +export FIRST_USER_NAME=pi +export FIRST_USER_PASS="raspberry" +export ENABLE_SSH=1 +export STAGE_LIST="stage0 stage1 stage2" \ No newline at end of file diff --git a/export-image/prerun.sh b/export-image/prerun.sh index 8bbc566..01f1e74 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -39,6 +39,10 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B) ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B) ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B) +# Ensures that freshly created loop devices are available to mount +# https://github.com/RPi-Distro/pi-gen/issues/320#issuecomment-518484064 +sleep 5 + BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}") ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}") echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH" diff --git a/stage2/04-custom-tweaks/01-run.sh b/stage2/04-custom-tweaks/01-run.sh new file mode 100755 index 0000000..e5ff853 --- /dev/null +++ b/stage2/04-custom-tweaks/01-run.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +# Install Docker using default installation script +# and perform post-install steps to not require +# sudo for docker commands +echo "Installing docker..." +on_chroot << EOF +curl -sSL get.docker.com | sh +usermod -aG docker ${FIRST_USER_NAME} +EOF + +# Ensure ${FIRST_USER_NAME} is set up for auto-login +echo "Setting up ${FIRST_USER_NAME} for auto-login" +on_chroot << EOF + SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_boot_behaviour B4 +EOF \ No newline at end of file