Fixed external config vars to carry through to spawned shells correctly by writing a .customvars file passed in via --env-file during docker run. Trying to move the sleep in prerun.sh to ensure loop devices are mountable (probably a WIP). Should work fine on re-run with CONTINUE=1 (and other custom vars). Installing pip3 the right way in 00-package instead of the run scripts.
This commit is contained in:
parent
8ce3b79422
commit
37eee9b183
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ postrun.sh
|
|||
.pc
|
||||
*-pc
|
||||
apt-cacher-ng/
|
||||
.customvars
|
||||
|
|
|
@ -5,6 +5,10 @@ BUILD_OPTS="$*"
|
|||
|
||||
DOCKER="docker"
|
||||
|
||||
# Ensure that any config variables we passed in are written to an env_file
|
||||
# so invocations in subsquent shells preserve these values
|
||||
printenv | grep 'FWVERSION=\|SERIAL=\|ROOTUSER\|ROOTUSERPASS' > "$DIR/.customvars"
|
||||
|
||||
if ! ${DOCKER} ps >/dev/null 2>&1; then
|
||||
DOCKER="sudo docker"
|
||||
fi
|
||||
|
@ -79,6 +83,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then
|
|||
time ${DOCKER} run --rm --privileged \
|
||||
--volume "${CONFIG_FILE}":/config:ro \
|
||||
-e "GIT_HASH=${GIT_HASH}" \
|
||||
--env-file=${DIR}/.customvars \
|
||||
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
|
||||
pi-gen \
|
||||
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
||||
|
@ -90,6 +95,7 @@ else
|
|||
time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \
|
||||
--volume "${CONFIG_FILE}":/config:ro \
|
||||
-e "GIT_HASH=${GIT_HASH}" \
|
||||
--env-file=${DIR}/.customvars \
|
||||
pi-gen \
|
||||
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
|
||||
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
|
||||
|
|
8
config
Normal file → Executable file
8
config
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
|||
# Override these values by setting FWVERSION, SERIAL, ROOTUSER
|
||||
# and ROOTUSERPASS before invoking build(-docker).sh like so:
|
||||
# FWVERSION=3 SERIAL=0001 ./build-docker.sh
|
||||
# Override these values by optionally setting FWVERSION, SERIAL,
|
||||
# ROOTUSER and ROOTUSERPASS before invoking build(-docker).sh like so:
|
||||
# FWVERSION="XX.YY.ZZZ" SERIAL="XXXXXXXXXXXX" ./build-docker.sh
|
||||
|
||||
export IMG_NAME="moab-fw-${FWVERSION:=dev}"
|
||||
echo "IMG_NAME is $IMG_NAME"
|
||||
|
@ -12,7 +12,7 @@ TIMEZONE=$(cat /etc/timezone)
|
|||
export TIMEZONE_DEFAULT=$TIMEZONE
|
||||
echo "TIMEZONE_DEFAULT is $TIMEZONE_DEFAULT"
|
||||
|
||||
export LOCALE_DEFAULT=$(cat /etc/default/locale)
|
||||
export LOCALE_DEFAULT=${LANG:="en_US.UTF-8"}
|
||||
echo "LOCALE_DEFAULT is $LOCALE_DEFAULT"
|
||||
|
||||
export FIRST_USER_NAME=${ROOTUSER:="pi"}
|
||||
|
|
|
@ -39,10 +39,6 @@ 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"
|
||||
|
@ -57,6 +53,10 @@ done
|
|||
mkdosfs -n boot -F 32 -v "$BOOT_DEV" > /dev/null
|
||||
mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null
|
||||
|
||||
# Ensures that freshly created loop devices are available to mount
|
||||
# https://github.com/RPi-Distro/pi-gen/issues/320#issuecomment-518484064
|
||||
sleep 5
|
||||
|
||||
mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4
|
||||
mkdir -p "${ROOTFS_DIR}/boot"
|
||||
mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot" -t vfat
|
||||
|
|
1
stage2/04-custom-tweaks/00-packages
Normal file
1
stage2/04-custom-tweaks/00-packages
Normal file
|
@ -0,0 +1 @@
|
|||
python3-pip
|
|
@ -7,4 +7,13 @@ echo "Installing docker..."
|
|||
on_chroot << EOF
|
||||
curl -sSL get.docker.com | sh
|
||||
usermod -aG docker ${FIRST_USER_NAME}
|
||||
EOF
|
||||
EOF
|
||||
|
||||
# Install docker-compose
|
||||
echo "Installing docker-compose"
|
||||
on_chroot << EOF
|
||||
pip3 install docker-compose
|
||||
|
||||
# Ensure it's in PATH
|
||||
ln -sfn /home/${FIRST_USER_NAME}/.local/bin/docker-compose /usr/bin/docker-compose
|
||||
EOF
|
||||
|
|
Loading…
Reference in New Issue
Block a user