Add TEMP_REPO variable

This commit is contained in:
Serge Schneider 2025-04-15 11:48:57 +01:00
parent 260c17db0e
commit ca3d54e7e7
4 changed files with 16 additions and 0 deletions

View File

@ -80,6 +80,13 @@ The following environment variables are supported:
will not be included in the image, making it safe to use an `apt-cacher` or will not be included in the image, making it safe to use an `apt-cacher` or
similar package for development. similar package for development.
* `TEMP_REPO` (Default: unset)
An additional temporary apt repo to be used during the build process. This
could be useful if you require pre-release software to be included in the
image. The variable should contain sources in [one-line-style format](https://manpages.debian.org/stable/apt/sources.list.5.en.html#ONE-LINE-STYLE_FORMAT).
"RELEASE" will be replaced with the RELEASE variable.
* `BASE_DIR` (Default: location of `build.sh`) * `BASE_DIR` (Default: location of `build.sh`)
**CAUTION**: Currently, changing this value will probably break build.sh **CAUTION**: Currently, changing this value will probably break build.sh

View File

@ -222,6 +222,7 @@ export PUBKEY_SSH_FIRST_USER
export CLEAN export CLEAN
export APT_PROXY export APT_PROXY
export TEMP_REPO
export STAGE export STAGE
export STAGE_DIR export STAGE_DIR

View File

@ -1,6 +1,7 @@
#!/bin/bash -e #!/bin/bash -e
rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
rm -f "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list"
find "${ROOTFS_DIR}/var/lib/apt/lists/" -type f -delete find "${ROOTFS_DIR}/var/lib/apt/lists/" -type f -delete
on_chroot << EOF on_chroot << EOF
apt-get update apt-get update

View File

@ -12,6 +12,13 @@ else
rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
fi fi
if [ -n "$TEMP_REPO" ]; then
install -m 644 /dev/null "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list"
echo "$TEMP_REPO" | sed "s/RELEASE/$RELEASE/g" > "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list"
else
rm -f "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list"
fi
cat files/raspberrypi.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" cat files/raspberrypi.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg"
install -m 644 "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" install -m 644 "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/"
on_chroot <<- \EOF on_chroot <<- \EOF