diff --git a/bakery/repositories/core/layers/alpine-3-20.toml b/bakery/repositories/core/layers/alpine-3-20.toml new file mode 100644 index 0000000..b93a1e3 --- /dev/null +++ b/bakery/repositories/core/layers/alpine-3-20.toml @@ -0,0 +1,8 @@ +root = true + +recipes = [ + "alpine-bootstrap", +] + +[parameters."alpine-bootstrap"] +version = "3.20" diff --git a/bakery/repositories/core/layers/raspios-bookworm.arm64.toml b/bakery/repositories/core/layers/raspios-bookworm.arm64.toml index 1d28e00..8b6e5bc 100644 --- a/bakery/repositories/core/layers/raspios-bookworm.arm64.toml +++ b/bakery/repositories/core/layers/raspios-bookworm.arm64.toml @@ -1,2 +1,2 @@ name = "Raspberry Pi OS (Bookworm)" -url = "https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz" \ No newline at end of file +url = "https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-03-15/2024-03-15-raspios-bookworm-arm64-lite.img.xz" \ No newline at end of file diff --git a/bakery/repositories/core/layers/raspios-bookworm.armhf.toml b/bakery/repositories/core/layers/raspios-bookworm.armhf.toml index e3cbf0b..a94aa4e 100644 --- a/bakery/repositories/core/layers/raspios-bookworm.armhf.toml +++ b/bakery/repositories/core/layers/raspios-bookworm.armhf.toml @@ -1,2 +1,2 @@ name = "Raspberry Pi OS (Bookworm)" -url = "https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz" \ No newline at end of file +url = "https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf-lite.img.xz" \ No newline at end of file diff --git a/bakery/repositories/core/layers/raspios-bullseye.arm64.toml b/bakery/repositories/core/layers/raspios-bullseye.arm64.toml index 166ff12..bbfed36 100644 --- a/bakery/repositories/core/layers/raspios-bullseye.arm64.toml +++ b/bakery/repositories/core/layers/raspios-bullseye.arm64.toml @@ -1,2 +1,2 @@ name = "Raspberry Pi OS (Bullseye)" -url = "https://downloads.raspberrypi.com/raspios_oldstable_lite_arm64/images/raspios_oldstable_lite_arm64-2023-12-06/2023-12-05-raspios-bullseye-arm64-lite.img.xz" \ No newline at end of file +url = "https://downloads.raspberrypi.com/raspios_oldstable_lite_arm64/images/raspios_oldstable_lite_arm64-2024-03-12/2024-03-12-raspios-bullseye-arm64-lite.img.xz" \ No newline at end of file diff --git a/bakery/repositories/core/layers/raspios-bullseye.armhf.toml b/bakery/repositories/core/layers/raspios-bullseye.armhf.toml index 5ad6d8a..0b3faa1 100644 --- a/bakery/repositories/core/layers/raspios-bullseye.armhf.toml +++ b/bakery/repositories/core/layers/raspios-bullseye.armhf.toml @@ -1,2 +1,2 @@ name = "Raspberry Pi OS (Bullseye)" -url = "https://downloads.raspberrypi.com/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2023-12-06/2023-12-05-raspios-bullseye-armhf-lite.img.xz" \ No newline at end of file +url = "https://downloads.raspberrypi.com/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2024-03-12/2024-03-12-raspios-bullseye-armhf-lite.img.xz" \ No newline at end of file diff --git a/bakery/repositories/core/recipes/alpine-bootstrap/steps/00-run.sh b/bakery/repositories/core/recipes/alpine-bootstrap/steps/00-run.sh index 2529950..804a293 100755 --- a/bakery/repositories/core/recipes/alpine-bootstrap/steps/00-run.sh +++ b/bakery/repositories/core/recipes/alpine-bootstrap/steps/00-run.sh @@ -9,17 +9,18 @@ case ${RUGPI_ARCH} in "arm64") ALPINE_ARCH="aarch64" ;; + "armv7") + ALPINE_ARCH="armv7" + ;; "armhf") ALPINE_ARCH="armhf" ;; *) - echo "Unsupported architecture ${RUGPI_ARCH}." + echo "Unsupported architecture '${RUGPI_ARCH}'." exit 1 esac -wget -O /tmp/alpine-rootfs.tar.gz \ - "https://dl-cdn.alpinelinux.org/alpine/v${RECIPE_PARAM_VERSION}/releases/${ALPINE_ARCH}/alpine-minirootfs-${RECIPE_PARAM_VERSION}.0-${ALPINE_ARCH}.tar.gz" - - mkdir -p "${RUGPI_ROOT_DIR}" -tar -xvf /tmp/alpine-rootfs.tar.gz -C "${RUGPI_ROOT_DIR}" + +wget -O- "https://dl-cdn.alpinelinux.org/alpine/v${RECIPE_PARAM_VERSION}/releases/${ALPINE_ARCH}/alpine-minirootfs-${RECIPE_PARAM_VERSION}.0-${ALPINE_ARCH}.tar.gz" \ + | tar -xzvf - -C "${RUGPI_ROOT_DIR}" diff --git a/bakery/repositories/core/recipes/alpine-grub-setup/files/second.grub.cfg b/bakery/repositories/core/recipes/alpine-grub-setup/files/second.grub.cfg new file mode 100644 index 0000000..893124f --- /dev/null +++ b/bakery/repositories/core/recipes/alpine-grub-setup/files/second.grub.cfg @@ -0,0 +1,3 @@ +linux /vmlinuz ro modules=sd-mod,usb-storage,ext4,vfat init=/usr/bin/rugpi-ctrl root=/dev/sda${rugpi_syspart} +initrd /initrd.img +boot diff --git a/bakery/repositories/core/recipes/alpine-grub-setup/recipe.toml b/bakery/repositories/core/recipes/alpine-grub-setup/recipe.toml new file mode 100644 index 0000000..e28ac70 --- /dev/null +++ b/bakery/repositories/core/recipes/alpine-grub-setup/recipe.toml @@ -0,0 +1,5 @@ +description = "setup Alpine for `generic-grub-*` targets" +dependencies = [] + +[parameters] +with_firmware = { default = "true" } diff --git a/bakery/repositories/core/recipes/alpine-grub-setup/steps/00-install.sh b/bakery/repositories/core/recipes/alpine-grub-setup/steps/00-install.sh new file mode 100755 index 0000000..8f0627f --- /dev/null +++ b/bakery/repositories/core/recipes/alpine-grub-setup/steps/00-install.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -eu + +apk update + +BOOT_DIR="${RUGPI_LAYER_DIR}/boot" + +mkdir -p "${BOOT_DIR}" + +echo "Installing kernel..." +apk add linux-lts + +if [ "${RECIPE_PARAM_WITH_FIRMWARE}" = "true" ]; then + echo "Installing firmware..." + apk add linux-firmware +fi + +echo "Copying kernel and initrd..." +cp -L /boot/vmlinuz-lts "${BOOT_DIR}/vmlinuz" +cp -L /boot/initramfs-lts "${BOOT_DIR}/initrd.img" + +echo "Installing second stage boot script..." +cp "${RECIPE_DIR}/files/second.grub.cfg" "${BOOT_DIR}" diff --git a/bakery/repositories/core/recipes/apt-cleanup/steps/00-install.sh b/bakery/repositories/core/recipes/apt-cleanup/steps/00-install.sh deleted file mode 100755 index 47c068d..0000000 --- a/bakery/repositories/core/recipes/apt-cleanup/steps/00-install.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -export DEBIAN_FRONTEND=noninteractive - -if [ "${RECIPE_PARAM_AUTOREMOVE}" = "true" ]; then - apt-get autoremove -y -fi - -apt-get clean -y -rm -rf /var/lib/apt/lists/* diff --git a/bakery/repositories/core/recipes/apt-update/recipe.toml b/bakery/repositories/core/recipes/apt-update/recipe.toml deleted file mode 100644 index fceed13..0000000 --- a/bakery/repositories/core/recipes/apt-update/recipe.toml +++ /dev/null @@ -1,3 +0,0 @@ -description = "apt: update package lists" -priority = 900_000 # Execute before everything else. -dependencies = ["apt-cleanup"] \ No newline at end of file diff --git a/bakery/repositories/core/recipes/apt-update/steps/00-install.sh b/bakery/repositories/core/recipes/apt-update/steps/00-install.sh deleted file mode 100755 index 1e2ea38..0000000 --- a/bakery/repositories/core/recipes/apt-update/steps/00-install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -export DEBIAN_FRONTEND=noninteractive - -apt-get update -y \ No newline at end of file diff --git a/bakery/repositories/core/recipes/apt-upgrade/recipe.toml b/bakery/repositories/core/recipes/apt-upgrade/recipe.toml deleted file mode 100644 index 611f8d2..0000000 --- a/bakery/repositories/core/recipes/apt-upgrade/recipe.toml +++ /dev/null @@ -1,3 +0,0 @@ -description = "apt: upgrade all packages" -priority = 899_900 # Execute before everything else but after `apt-update`. -dependencies = ["apt-update"] \ No newline at end of file diff --git a/bakery/repositories/core/recipes/apt-upgrade/steps/00-install.sh b/bakery/repositories/core/recipes/apt-upgrade/steps/00-install.sh deleted file mode 100755 index 8407a73..0000000 --- a/bakery/repositories/core/recipes/apt-upgrade/steps/00-install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -export DEBIAN_FRONTEND=noninteractive - -apt-get upgrade -y \ No newline at end of file diff --git a/bakery/repositories/core/recipes/debian-bootstrap/steps/00-run.sh b/bakery/repositories/core/recipes/debian-bootstrap/steps/00-run.sh index c9c6304..fe84fd5 100755 --- a/bakery/repositories/core/recipes/debian-bootstrap/steps/00-run.sh +++ b/bakery/repositories/core/recipes/debian-bootstrap/steps/00-run.sh @@ -2,7 +2,25 @@ set -euo pipefail +case "${RUGPI_ARCH}" in + "amd64") + DEBIAN_ARCH="amd64" + ;; + "arm64") + DEBIAN_ARCH="arm64" + ;; + "armv7") + DEBIAN_ARCH="armhf" + ;; + "arm") + DEBIAN_ARCH="armel" + ;; + *) + echo "Unsupported architecture '${RUGPI_ARCH}'." + exit 1 +esac + mmdebstrap \ - --architectures="${RUGPI_ARCH}" \ + --architectures="${DEBIAN_ARCH}" \ "${RECIPE_PARAM_SUITE}" \ "${RUGPI_ROOT_DIR}" diff --git a/bakery/repositories/core/recipes/debian-grub-setup/files/second.grub.cfg b/bakery/repositories/core/recipes/debian-grub-setup/files/second.grub.cfg new file mode 100644 index 0000000..33faa75 --- /dev/null +++ b/bakery/repositories/core/recipes/debian-grub-setup/files/second.grub.cfg @@ -0,0 +1,3 @@ +linux /vmlinuz ro init=/usr/bin/rugpi-ctrl root=/dev/sda${rugpi_syspart} +initrd /initrd.img +boot diff --git a/bakery/repositories/core/recipes/debian-grub-setup/recipe.toml b/bakery/repositories/core/recipes/debian-grub-setup/recipe.toml new file mode 100644 index 0000000..52e9d86 --- /dev/null +++ b/bakery/repositories/core/recipes/debian-grub-setup/recipe.toml @@ -0,0 +1,6 @@ +description = "setup Debian for `generic-grub-*` targets" +dependencies = [] + +[parameters] +with_firmware = { default = "true" } +with_nonfree = { default = "true" } \ No newline at end of file diff --git a/bakery/repositories/core/recipes/debian-grub-setup/steps/00-install.sh b/bakery/repositories/core/recipes/debian-grub-setup/steps/00-install.sh new file mode 100755 index 0000000..4e5fbed --- /dev/null +++ b/bakery/repositories/core/recipes/debian-grub-setup/steps/00-install.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -euo pipefail + +apt-get update -y + +BOOT_DIR="${RUGPI_LAYER_DIR}/boot" + +mkdir -p "${BOOT_DIR}" + +echo "Installing kernel..." +case "${RUGPI_ARCH}" in + "amd64") + apt-get install -y \ + linux-image-amd64 \ + linux-headers-amd64 + ;; + "arm64") + apt-get install -y \ + linux-image-arm64 \ + linux-headers-arm64 + ;; + *) + echo "Unsupported architecture '${RUGPI_ARCH}'." + exit 1 +esac + +if [ "${RECIPE_PARAM_WITH_FIRMWARE}" == "true" ]; then + echo "Installing free firmware..." + apt-get install -y firmware-linux-free +fi + +if [ "${RECIPE_PARAM_WITH_NONFREE}" == "true" ]; then + # Make sure that the non-free sources are available. + sed -i '/main/!b; /non-free/b; s/$/ non-free/' /etc/apt/sources.list + sed -i '/main/!b; /non-free-firmware/b; s/$/ non-free-firmware/' /etc/apt/sources.list + + apt-get update -y + + if [ "${RECIPE_PARAM_WITH_FIRMWARE}" == "true" ]; then + echo "Installing nonfree firmware..." + apt-get install -y firmware-linux + fi +fi + +echo "Copying kernel and initrd..." +cp -L /vmlinuz "${BOOT_DIR}" +cp -L /initrd.img "${BOOT_DIR}" + +echo "Installing second stage boot script..." +cp "${RECIPE_DIR}/files/second.grub.cfg" "${BOOT_DIR}" diff --git a/bakery/repositories/core/recipes/apt-cleanup/recipe.toml b/bakery/repositories/core/recipes/pkg-cleanup/recipe.toml similarity index 62% rename from bakery/repositories/core/recipes/apt-cleanup/recipe.toml rename to bakery/repositories/core/recipes/pkg-cleanup/recipe.toml index c5b4cf1..1dbb826 100644 --- a/bakery/repositories/core/recipes/apt-cleanup/recipe.toml +++ b/bakery/repositories/core/recipes/pkg-cleanup/recipe.toml @@ -1,4 +1,4 @@ -description = "apt: cleanup cache and delete package lists" +description = "cleanup cache and delete package lists" priority = -900_000 # Execute after everything else. [parameters] diff --git a/bakery/repositories/core/recipes/pkg-cleanup/steps/00-install.sh b/bakery/repositories/core/recipes/pkg-cleanup/steps/00-install.sh new file mode 100755 index 0000000..6fd5867 --- /dev/null +++ b/bakery/repositories/core/recipes/pkg-cleanup/steps/00-install.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -eu + +if [ "${RECIPE_PARAM_AUTOREMOVE}" = "true" ]; then + if command -v apt-get; then + apt-get autoremove -y + fi +fi + +if command -v apt-get; then + apt-get clean -y + rm -rf /var/lib/apt/lists/* +fi + +if command -v apk; then + rm -rf /var/cache/apk/* +fi diff --git a/bakery/repositories/core/recipes/pkg-update/recipe.toml b/bakery/repositories/core/recipes/pkg-update/recipe.toml new file mode 100644 index 0000000..1383c2e --- /dev/null +++ b/bakery/repositories/core/recipes/pkg-update/recipe.toml @@ -0,0 +1,3 @@ +description = "update package lists" +priority = 900_000 # Execute before everything else. +dependencies = ["pkg-cleanup"] \ No newline at end of file diff --git a/bakery/repositories/core/recipes/pkg-update/steps/00-install.sh b/bakery/repositories/core/recipes/pkg-update/steps/00-install.sh new file mode 100755 index 0000000..7e1eedd --- /dev/null +++ b/bakery/repositories/core/recipes/pkg-update/steps/00-install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eu + +if command -v apt-get; then + apt-get update -y +fi + +if command -v apk; then + apk update +fi diff --git a/bakery/repositories/core/recipes/pkg-upgrade/recipe.toml b/bakery/repositories/core/recipes/pkg-upgrade/recipe.toml new file mode 100644 index 0000000..699ec4f --- /dev/null +++ b/bakery/repositories/core/recipes/pkg-upgrade/recipe.toml @@ -0,0 +1,3 @@ +description = "upgrade all packages" +priority = 899_900 # Execute before everything else but after `pkg-update`. +dependencies = ["pkg-update"] \ No newline at end of file diff --git a/bakery/repositories/core/recipes/pkg-upgrade/steps/00-install.sh b/bakery/repositories/core/recipes/pkg-upgrade/steps/00-install.sh new file mode 100755 index 0000000..05cbf6e --- /dev/null +++ b/bakery/repositories/core/recipes/pkg-upgrade/steps/00-install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eu + +if command -v apt-get; then + apt-get upgrade -y +fi + +if command -v apk; then + apk upgrade +fi diff --git a/bakery/repositories/core/recipes/rpi-raspios-setup/recipe.toml b/bakery/repositories/core/recipes/rpi-raspios-setup/recipe.toml index 9aa6cae..31fd135 100644 --- a/bakery/repositories/core/recipes/rpi-raspios-setup/recipe.toml +++ b/bakery/repositories/core/recipes/rpi-raspios-setup/recipe.toml @@ -1,2 +1,2 @@ description = "Raspberry Pi meta recipe" -dependencies = ["pi-cleanup", "persist-fake-hwclock", "disable-swap", "rugpi-ctrl", "apt-upgrade"] \ No newline at end of file +dependencies = ["rpi-raspios-cleanup", "persist-fake-hwclock"] \ No newline at end of file diff --git a/bakery/repositories/core/recipes/rugpi-ctrl/recipe.toml b/bakery/repositories/core/recipes/rugpi-ctrl/recipe.toml index 831fc21..ddf857a 100644 --- a/bakery/repositories/core/recipes/rugpi-ctrl/recipe.toml +++ b/bakery/repositories/core/recipes/rugpi-ctrl/recipe.toml @@ -1,5 +1,6 @@ description = "install and configure Rugpi Ctrl" priority = 700_000 # Execute very early. +dependencies = ["pkg-update"] [parameters] rugpi_admin = { default = false } diff --git a/bakery/templates/alpine-grub-efi/layers/alpine-base.toml b/bakery/templates/alpine-grub-efi/layers/alpine-base.toml deleted file mode 100644 index ffaecb6..0000000 --- a/bakery/templates/alpine-grub-efi/layers/alpine-base.toml +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -recipes = [ - "core/alpine-bootstrap", - "core/rugpi-ctrl", -] - -[parameters."core/alpine-bootstrap"] -version = "3.20" diff --git a/bakery/templates/alpine-grub-efi/layers/customized.toml b/bakery/templates/alpine-grub-efi/layers/customized.toml index 144fe3b..3e09229 100644 --- a/bakery/templates/alpine-grub-efi/layers/customized.toml +++ b/bakery/templates/alpine-grub-efi/layers/customized.toml @@ -1,3 +1,11 @@ -parent = "alpine-base" +# We use Alpine Linux 3.20 as a basis. +parent = "core/alpine-3-20" -recipes = ["setup"] \ No newline at end of file +recipes = [ + # Setup Alpine for booting via Grub. + "core/alpine-grub-setup", + # Install Rugpi Ctrl into the image. + "core/rugpi-ctrl", + # Install a static website. + "hello-world", +] diff --git a/bakery/templates/alpine-grub-efi/recipes/hello-world/html/index.html b/bakery/templates/alpine-grub-efi/recipes/hello-world/html/index.html new file mode 100644 index 0000000..37325a9 --- /dev/null +++ b/bakery/templates/alpine-grub-efi/recipes/hello-world/html/index.html @@ -0,0 +1,32 @@ + + +
+ + +This is an example static web site served from a customized Rugpi system.
+ + \ No newline at end of file diff --git a/bakery/templates/alpine-grub-efi/recipes/hello-world/recipe.toml b/bakery/templates/alpine-grub-efi/recipes/hello-world/recipe.toml new file mode 100644 index 0000000..f46ea4d --- /dev/null +++ b/bakery/templates/alpine-grub-efi/recipes/hello-world/recipe.toml @@ -0,0 +1,5 @@ +description = "example recipe for installing a static website" +dependencies = [ + # Update the package lists such that we can install Nginx. + "core/pkg-update" +] diff --git a/bakery/templates/alpine-grub-efi/recipes/hello-world/steps/00-install.sh b/bakery/templates/alpine-grub-efi/recipes/hello-world/steps/00-install.sh new file mode 100755 index 0000000..4c97224 --- /dev/null +++ b/bakery/templates/alpine-grub-efi/recipes/hello-world/steps/00-install.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -euo pipefail + +# This recipe follows the guide from the Alpine Linux wiki. +# https://wiki.alpinelinux.org/wiki/Nginx + +apk add nginx + +adduser -D -g 'www' www + +chown -R www:www /var/lib/nginx + +cat >/etc/nginx/nginx.conf <