diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 5195604..23a7046 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -24,9 +24,6 @@ jobs: pip install -U pip pip install -e .[lint,scripts,check] - - name: Check black formatting - run: inv lint-black - - name: Check ruff run: inv lint-ruff diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ea9b54..eae62c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Based on pi-gen `2025-10-01-raspios-trixie` +- Using offspot-config 2.x.x - Data partition block-size now ~1Mib instead of 1KiB - Data partition reserved blocks for root to 1% instead of 5% - balena service to be started before offspot-runtime - docker-compose service not started automatically (started by offspot-runtime) +### Removed + +- Support for armhf. It's a soft removal, we just don't test it anymore. Use at own risk + ## [1.3.1] - 2025-03-25 ### Changed diff --git a/builder.py b/builder.py index 4d82523..44e2825 100755 --- a/builder.py +++ b/builder.py @@ -30,9 +30,9 @@ def run(*args, **kwargs): class Defaults: supported_archs = ("armhf", "arm64") # using supported_archs indexes - pigen_versions = ( # ~ 2023-05-03-raspios-buster - "2024-03-15-raspios-bookworm", - "2024-03-15-raspios-bookworm-arm64", + pigen_versions = ( + "2025-10-01-raspios-trixie-armhf", + "2025-10-01-raspios-trixie-arm64", ) arch: str = "arm64" is_macos: bool = platform.system() == "Darwin" @@ -62,6 +62,8 @@ class Defaults: ENABLE_SSH: str = "0" PUBKEY_SSH_FIRST_USER: str = "" PUBKEY_ONLY_SSH: str = "0" + ENABLE_CLOUD_INIT: str = "0" + WPA_COUNTRY: str = "US" STAGE_LIST: str = "stage0 stage1 stage2" @property @@ -98,6 +100,10 @@ class Builder: def __init__(self, conf): self.conf = conf + if self.conf.arch == "armhf": + message = f"WARN: arch {self.conf.arch} is not tested. Use at own risk" + print(f"\033[91m{message}\033[0m", flush=True) # noqa: T201 + def run(self): # stop builder right away if target file already exists if self.conf.output.exists(): @@ -120,7 +126,7 @@ def run(self): f"starting pi-gen build with {config_path}\n{config_path.read_text()}" ) - self.build() + return self.build() def download_pigen(self): """clone requested version of Pi-gen""" diff --git a/packages b/packages index 3b1c31b..2d97e4e 100644 --- a/packages +++ b/packages @@ -11,6 +11,10 @@ + jq + tree +# replace netplan with ifupdown +- netplan.io ++ ifupdown + # docker stack: disabled in favor of balena (stage2/06-docker-tweaks) # docker-ce docker-ce-cli containerd.io docker-compose-plugin @@ -21,10 +25,10 @@ + hostapd dnsmasq # not needed on host -- pi-bluetooth v4l-utils python3-gpiozero python3-rpi.gpio python3-v4l2 +- v4l-utils python3-gpiozero python3-rpi-lgpio # disable swap -- dphys-swapfile +# - rpi-swap # continue to use dhcpcd5 (replaced by network-manager in 2023-10) # purposedly not using `dhcpcd5` as its a virtual package with conflict from raspberry-sys-mod diff --git a/pyproject.toml b/pyproject.toml index 661b4f2..5f07394 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "builder" -requires-python = ">=3.9,<3.13" +requires-python = ">=3.13,<3.14" description = "Offspot Base Image Builder" readme = "README.md" dependencies = [] @@ -12,18 +12,17 @@ version = "1.0.0.dev0" [project.optional-dependencies] scripts = [ - "invoke==2.2.0", + "invoke==2.2.1", ] lint = [ - "black==24.4.0", - "ruff==0.4.1", + "ruff==0.14.0", ] check = [ - "pyright==1.1.359", + "pyright==1.1.406", ] dev = [ - "pre-commit==3.7.0", - "ipython==8.23.0", + "pre-commit==4.3.0", + "ipython==9.6.0", "builder[scripts]", "builder[lint]", "builder[check]", diff --git a/tasks.py b/tasks.py index a95c71a..0a5ad5e 100644 --- a/tasks.py +++ b/tasks.py @@ -24,6 +24,7 @@ def report_cov(ctx: Context, *, html: bool = False): """report coverage""" ctx.run("coverage combine", warn=True, pty=use_pty) ctx.run("coverage report --show-missing", pty=use_pty) + ctx.run("coverage xml", pty=use_pty) if html: ctx.run("coverage html", pty=use_pty) @@ -41,13 +42,6 @@ def coverage(ctx: Context, args: str = "", *, html: bool = False): report_cov(ctx, html=html) -@task(optional=["args"], help={"args": "black additional arguments"}) -def lint_black(ctx: Context, args: str = "."): - args = args or "." # needed for hatch script - ctx.run("black --version", pty=use_pty) - ctx.run(f"black --check --diff {args}", pty=use_pty) - - @task(optional=["args"], help={"args": "ruff additional arguments"}) def lint_ruff(ctx: Context, args: str = "."): args = args or "." # needed for hatch script @@ -58,13 +52,12 @@ def lint_ruff(ctx: Context, args: str = "."): @task( optional=["args"], help={ - "args": "linting tools (black, ruff) additional arguments, typically a path", + "args": "linting tools (ruff) additional arguments, typically a path", }, ) def lintall(ctx: Context, args: str = "."): """Check linting""" args = args or "." # needed for hatch script - lint_black(ctx, args) lint_ruff(ctx, args) @@ -81,13 +74,6 @@ def checkall(ctx: Context, args: str = ""): check_pyright(ctx, args) -@task(optional=["args"], help={"args": "black additional arguments"}) -def fix_black(ctx: Context, args: str = "."): - """fix black formatting""" - args = args or "." # needed for hatch script - ctx.run(f"black {args}", pty=use_pty) - - @task(optional=["args"], help={"args": "ruff additional arguments"}) def fix_ruff(ctx: Context, args: str = "."): """fix all ruff rules""" @@ -98,12 +84,11 @@ def fix_ruff(ctx: Context, args: str = "."): @task( optional=["args"], help={ - "args": "linting tools (black, ruff) additional arguments, typically a path", + "args": "linting tools (ruff) additional arguments, typically a path", }, ) def fixall(ctx: Context, args: str = "."): """Fix everything automatically""" args = args or "." # needed for hatch script - fix_black(ctx, args) fix_ruff(ctx, args) lintall(ctx, args) diff --git a/tree/README.md b/tree/README.md index bacc36f..d878261 100644 --- a/tree/README.md +++ b/tree/README.md @@ -8,4 +8,7 @@ pi-gen tree replacements ```sh diff -u path/to/original path/to/updated > tree/path/to/original.patch -``` \ No newline at end of file + +# or, if working from a git copy of the original tree (I use tree-arm54.orig) +git diff --no-prefix path/to/original > ../tree/path/to/original.patch +``` diff --git a/tree/build-docker.sh.patch-arm64 b/tree/build-docker.sh.patch-arm64 index 822ad90..e51ecb7 100644 --- a/tree/build-docker.sh.patch-arm64 +++ b/tree/build-docker.sh.patch-arm64 @@ -1,36 +1,36 @@ -*** tree-arm64.orig/build-docker.sh 2023-10-26 17:06:34 ---- tree/build-docker.sh 2023-10-26 17:14:07 -*************** esac -*** 105,135 **** - ;; - esac - -- # Check if qemu-aarch64-static and /proc/sys/fs/binfmt_misc are present -- if [[ "${binfmt_misc_required}" == "1" ]]; then -- if ! qemu_arm=$(which qemu-aarch64-static) ; then -- echo "qemu-aarch64-static not found (please install qemu-user-static)" -- exit 1 -- fi -- if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then -- echo "binfmt_misc required but not mounted, trying to mount it..." -- if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then -- echo "mounting binfmt_misc failed" -- exit 1 -- fi -- echo "binfmt_misc mounted" -- fi -- if ! grep -q "^interpreter ${qemu_arm}" /proc/sys/fs/binfmt_misc/qemu-aarch64* ; then -- # Register qemu-aarch64 for binfmt_misc -- reg="echo ':qemu-aarch64-rpi:M::"\ -- "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:"\ -- "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:"\ -- "${qemu_arm}:F' > /proc/sys/fs/binfmt_misc/register" -- echo "Registering qemu-aarch64 for binfmt_misc..." -- sudo bash -c "${reg}" 2>/dev/null || true -- fi -- fi -- - trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM - time ${DOCKER} run \ - $DOCKER_CMDLINE_PRE \ ---- 105,110 ---- +diff --git build-docker.sh build-docker.sh +index 53f8cf7..b53fd9c 100755 +--- build-docker.sh ++++ build-docker.sh +@@ -105,31 +105,6 @@ case $(uname -m) in + ;; + esac + +-# Check if qemu-aarch64-static and /proc/sys/fs/binfmt_misc are present +-if [[ "${binfmt_misc_required}" == "1" ]]; then +- if ! qemu_arm=$(which qemu-aarch64-static) ; then +- echo "qemu-aarch64-static not found (please install qemu-user-static)" +- exit 1 +- fi +- if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then +- echo "binfmt_misc required but not mounted, trying to mount it..." +- if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then +- echo "mounting binfmt_misc failed" +- exit 1 +- fi +- echo "binfmt_misc mounted" +- fi +- if ! grep -q "^interpreter ${qemu_arm}" /proc/sys/fs/binfmt_misc/qemu-aarch64* ; then +- # Register qemu-aarch64 for binfmt_misc +- reg="echo ':qemu-aarch64-rpi:M::"\ +-"\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:"\ +-"\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:"\ +-"${qemu_arm}:F' > /proc/sys/fs/binfmt_misc/register" +- echo "Registering qemu-aarch64 for binfmt_misc..." +- sudo bash -c "${reg}" 2>/dev/null || true +- fi +-fi +- + trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM + time ${DOCKER} run \ + $DOCKER_CMDLINE_PRE \ diff --git a/tree/build-docker.sh.patch-armhf b/tree/build-docker.sh.patch-armhf index 0dc9966..9922e04 100644 --- a/tree/build-docker.sh.patch-armhf +++ b/tree/build-docker.sh.patch-armhf @@ -1,36 +1,36 @@ -*** tree-armhf.orig/build-docker.sh 2023-10-26 17:07:21 ---- tree/build-docker.sh 2023-10-26 17:15:32 -*************** esac -*** 114,144 **** - ;; - esac - -- # Check if qemu-arm-static and /proc/sys/fs/binfmt_misc are present -- if [[ "${binfmt_misc_required}" == "1" ]]; then -- if ! qemu_arm=$(which qemu-arm-static) ; then -- echo "qemu-arm-static not found (please install qemu-user-static)" -- exit 1 -- fi -- if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then -- echo "binfmt_misc required but not mounted, trying to mount it..." -- if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then -- echo "mounting binfmt_misc failed" -- exit 1 -- fi -- echo "binfmt_misc mounted" -- fi -- if ! grep -q "^interpreter ${qemu_arm}" /proc/sys/fs/binfmt_misc/qemu-arm* ; then -- # Register qemu-arm for binfmt_misc -- reg="echo ':qemu-arm-rpi:M::"\ -- "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:"\ -- "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:"\ -- "${qemu_arm}:F' > /proc/sys/fs/binfmt_misc/register" -- echo "Registering qemu-arm for binfmt_misc..." -- sudo bash -c "${reg}" 2>/dev/null || true -- fi -- fi -- - trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM - time ${DOCKER} run \ - $DOCKER_CMDLINE_PRE \ ---- 114,119 ---- +diff --git build-docker.sh build-docker.sh +index 9c04651..71ced83 100755 +--- build-docker.sh ++++ build-docker.sh +@@ -114,31 +114,6 @@ case $(uname -m) in + ;; + esac + +-# Check if qemu-arm-static and /proc/sys/fs/binfmt_misc are present +-if [[ "${binfmt_misc_required}" == "1" ]]; then +- if ! qemu_arm=$(which qemu-arm-static) ; then +- echo "qemu-arm-static not found (please install qemu-user-static)" +- exit 1 +- fi +- if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then +- echo "binfmt_misc required but not mounted, trying to mount it..." +- if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then +- echo "mounting binfmt_misc failed" +- exit 1 +- fi +- echo "binfmt_misc mounted" +- fi +- if ! grep -q "^interpreter ${qemu_arm}" /proc/sys/fs/binfmt_misc/qemu-arm* ; then +- # Register qemu-arm for binfmt_misc +- reg="echo ':qemu-arm-rpi:M::"\ +-"\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:"\ +-"\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:"\ +-"${qemu_arm}:F' > /proc/sys/fs/binfmt_misc/register" +- echo "Registering qemu-arm for binfmt_misc..." +- sudo bash -c "${reg}" 2>/dev/null || true +- fi +-fi +- + trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM + time ${DOCKER} run \ + $DOCKER_CMDLINE_PRE \ diff --git a/tree/export-image/05-finalise/01-run.sh.patch b/tree/export-image/05-finalise/01-run.sh.patch deleted file mode 100644 index 525534e..0000000 --- a/tree/export-image/05-finalise/01-run.sh.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- tree.orig/export-image/05-finalise/01-run.sh 2022-05-31 10:21:03.000000000 +0000 -+++ tree/export-image/05-finalise/01-run.sh 2022-07-22 12:09:02.000000000 +0000 -@@ -38,6 +38,8 @@ - - rm -f "${ROOTFS_DIR}"/var/cache/debconf/*-old - rm -f "${ROOTFS_DIR}"/var/lib/dpkg/*-old -+# remove apt lists. apt update will be necessary before any apt install -+rm -rf "${ROOTFS_DIR}"/var/lib/apt/lists/* - - rm -f "${ROOTFS_DIR}"/usr/share/icons/*/icon-theme.cache - diff --git a/tree/export-image/prerun.sh b/tree/export-image/prerun.sh index 5cf9407..bbd2e65 100755 --- a/tree/export-image/prerun.sh +++ b/tree/export-image/prerun.sh @@ -10,12 +10,12 @@ rm -rf "${ROOTFS_DIR}" mkdir -p "${ROOTFS_DIR}" BOOT_SIZE="$((512 * 1024 * 1024))" -ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) +ROOT_SIZE=$(du -x --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot/firmware --block-size=1 | cut -f 1) # use ~256Mi for data. shall be recreated by final-image creator tool DATA_SIZE="$((256 * 1024 * 1024))" # All partition sizes and starts will be aligned to this size -ALIGN="$((4 * 1024 * 1024))" +ALIGN="$((8 * 1024 * 1024))" # Add this much space to the calculated file size. This allows for # some overhead (since actual space usage is usually rounded up to the # filesystem block size) and gives some free space on the resulting diff --git a/tree/stage0/00-configure-apt/00-run.sh.patch b/tree/stage0/00-configure-apt/00-run.sh.patch index 4b12685..0a30d4f 100644 --- a/tree/stage0/00-configure-apt/00-run.sh.patch +++ b/tree/stage0/00-configure-apt/00-run.sh.patch @@ -1,25 +1,24 @@ ---- tree.orig/stage0/00-configure-apt/00-run.sh 2022-05-31 10:21:03.000000000 +0000 -+++ tree/stage0/00-configure-apt/00-run.sh 2022-07-11 17:18:28.000000000 +0000 -@@ -2,8 +2,12 @@ - - install -m 644 files/sources.list "${ROOTFS_DIR}/etc/apt/" - install -m 644 files/raspi.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" -+install -m 644 files/docker.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" - sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list" - sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.list" -+sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/docker.list" -+sed -i "s/APT_ARCH/$(dpkg --print-architecture)/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/docker.list" -+cat "${ROOTFS_DIR}/etc/apt/sources.list.d/docker.list" - +diff --git stage0/00-configure-apt/00-run.sh stage0/00-configure-apt/00-run.sh +index f3e95b0..3a51fce 100755 +--- stage0/00-configure-apt/00-run.sh ++++ stage0/00-configure-apt/00-run.sh +@@ -3,8 +3,11 @@ + true > "${ROOTFS_DIR}/etc/apt/sources.list" + install -m 644 files/debian.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/" + install -m 644 files/raspi.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/" ++install -m 644 files/docker.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/" + sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/debian.sources" + sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.sources" ++sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/docker.sources" ++ + if [ -n "$APT_PROXY" ]; then install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -@@ -12,6 +16,8 @@ - rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" +@@ -20,6 +23,7 @@ else + rm -f "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list" fi - -+mkdir -p "${ROOTFS_DIR}/etc/apt/keyrings" -+curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > "${ROOTFS_DIR}/etc/apt/keyrings/docker.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/" - on_chroot << EOF - dpkg --add-architecture arm64 + ++install -m 644 files/docker-keyring.pgp "${ROOTFS_DIR}/usr/share/keyrings/" + install -m 644 files/raspberrypi-archive-keyring.pgp "${ROOTFS_DIR}/usr/share/keyrings/" + on_chroot <<- \EOF + ARCH="$(dpkg --print-architecture)" diff --git a/tree/stage0/00-configure-apt/files/docker-keyring.pgp b/tree/stage0/00-configure-apt/files/docker-keyring.pgp new file mode 100644 index 0000000..e5dc8cf Binary files /dev/null and b/tree/stage0/00-configure-apt/files/docker-keyring.pgp differ diff --git a/tree/stage0/00-configure-apt/files/docker.sources b/tree/stage0/00-configure-apt/files/docker.sources new file mode 100644 index 0000000..a7348ad --- /dev/null +++ b/tree/stage0/00-configure-apt/files/docker.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: https://download.docker.com/linux/debian/ +Suites: trixie +Components: stable +Signed-By: /usr/share/keyrings/docker-keyring.pgp +# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-keyring.pgp diff --git a/tree/stage1/00-boot-files/files/cmdline.txt.patch b/tree/stage1/00-boot-files/files/cmdline.txt.patch new file mode 100644 index 0000000..f5512a1 --- /dev/null +++ b/tree/stage1/00-boot-files/files/cmdline.txt.patch @@ -0,0 +1,7 @@ +diff --git stage1/00-boot-files/files/cmdline.txt stage1/00-boot-files/files/cmdline.txt +index 71b90ff..b024fc9 100644 +--- stage1/00-boot-files/files/cmdline.txt ++++ stage1/00-boot-files/files/cmdline.txt +@@ -1 +1 @@ +-console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait resize ++console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait systemd.restore_state=0 rfkill.default_state=1 quiet init=/usr/sbin/offspot_bi_init_resize.sh diff --git a/tree/stage1/00-boot-files/files/config.txt.patch b/tree/stage1/00-boot-files/files/config.txt.patch index 4dfd41d..36db6a7 100644 --- a/tree/stage1/00-boot-files/files/config.txt.patch +++ b/tree/stage1/00-boot-files/files/config.txt.patch @@ -1,12 +1,9 @@ -*** tree.orig/stage1/00-boot-files/files/config.txt 2023-03-08 08:33:49 ---- tree/stage1/00-boot-files/files/config.txt 2023-03-08 08:36:04 -*************** -*** 1,6 **** ---- 1,7 ---- - # For more options and information see - # http://rptl.io/configtxt - # Some settings may impact device functionality. See link above for details -+ dtoverlay=i2c-rtc,pcf2127 - - # uncomment if you get no picture on HDMI for a default "safe" mode - #hdmi_safe=1 +diff --git i/stage1/00-boot-files/files/config.txt w/stage1/00-boot-files/files/config.txt +index fecd26f..0ea13f8 100644 +--- i/stage1/00-boot-files/files/config.txt ++++ w/stage1/00-boot-files/files/config.txt +@@ -49,3 +49,4 @@ otg_mode=1 + dtoverlay=dwc2,dr_mode=host + + [all] ++dtoverlay=i2c-rtc,pcf2127 diff --git a/tree/stage1/01-sys-tweaks/files/fstab.patch b/tree/stage1/01-sys-tweaks/files/fstab.patch index c1cc75e..f81194d 100644 --- a/tree/stage1/01-sys-tweaks/files/fstab.patch +++ b/tree/stage1/01-sys-tweaks/files/fstab.patch @@ -1,5 +1,7 @@ ---- tree.orig/stage1/01-sys-tweaks/files/fstab 2022-05-31 10:21:03.000000000 +0000 -+++ tree/stage1/01-sys-tweaks/files/fstab 2022-07-08 14:02:54.000000000 +0000 +diff --git stage1/01-sys-tweaks/files/fstab stage1/01-sys-tweaks/files/fstab +index 525c3bc..b20ddaf 100644 +--- stage1/01-sys-tweaks/files/fstab ++++ stage1/01-sys-tweaks/files/fstab @@ -1,3 +1,9 @@ proc /proc proc defaults 0 0 BOOTDEV /boot/firmware vfat defaults 0 2 diff --git a/tree/stage2/01-sys-tweaks/00-patches/07-resize-init.diff b/tree/stage2/01-sys-tweaks/00-patches/07-resize-init.diff deleted file mode 100644 index 5bd20af..0000000 --- a/tree/stage2/01-sys-tweaks/00-patches/07-resize-init.diff +++ /dev/null @@ -1,5 +0,0 @@ ---- stage2.orig/rootfs/boot/firmware/cmdline.txt -+++ stage2/rootfs/boot/firmware/cmdline.txt -@@ -1 +1 @@ --console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait -+console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait quiet init=/usr/sbin/offspot_bi_init_resize.sh diff --git a/tree/stage2/01-sys-tweaks/01-run.sh.patch b/tree/stage2/01-sys-tweaks/01-run.sh.patch index 6339cc8..9549d87 100644 --- a/tree/stage2/01-sys-tweaks/01-run.sh.patch +++ b/tree/stage2/01-sys-tweaks/01-run.sh.patch @@ -1,12 +1,18 @@ ---- tree.orig/stage2/01-sys-tweaks/01-run.sh 2022-05-31 10:21:03.000000000 +0000 -+++ tree/stage2/01-sys-tweaks/01-run.sh 2022-07-25 14:57:50.000000000 +0000 -@@ -11,9 +11,13 @@ - - install -m 755 files/rc.local "${ROOTFS_DIR}/etc/" +diff --git stage2/01-sys-tweaks/01-run.sh stage2/01-sys-tweaks/01-run.sh +index 6da2876..2a2327d 100755 +--- stage2/01-sys-tweaks/01-run.sh ++++ stage2/01-sys-tweaks/01-run.sh +@@ -1,8 +1,17 @@ + #!/bin/bash -e +install -m 755 files/offspot.yaml "${ROOTFS_DIR}/boot/firmware/" -+ +install -m 755 files/offspot_bi_init_resize.sh "${ROOTFS_DIR}/usr/sbin/" ++ ++mkdir -p "${ROOTFS_DIR}/etc/rpi/swap.conf.d/" ++install -m 644 files/disable-swap.conf "${ROOTFS_DIR}/etc/rpi/swap.conf.d/" ++ ++install -m 644 files/issue "${ROOTFS_DIR}/etc/" ++install -m 644 files/IP.issue "${ROOTFS_DIR}/etc/issue.d/" + if [ -n "${PUBKEY_SSH_FIRST_USER}" ]; then install -v -m 0700 -o 1000 -g 1000 -d "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh @@ -15,17 +21,20 @@ chown 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys chmod 0600 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys fi -@@ -47,6 +52,13 @@ - systemctl enable resize2fs_once - EOF +@@ -28,8 +37,6 @@ fi + + + on_chroot <<- EOF +- systemctl enable rpi-resize +- + for GRP in input spi i2c gpio; do + groupadd -f -r "\$GRP" + done +@@ -61,3 +68,7 @@ EOF + if [ -e "${ROOTFS_DIR}/etc/avahi/avahi-daemon.conf" ]; then + sed -i 's/^#\?publish-workstation=.*/publish-workstation=yes/' "${ROOTFS_DIR}/etc/avahi/avahi-daemon.conf" fi -+on_chroot << EOF -+systemctl disable resize2fs_once -+EOF + +on_chroot << EOF +ln -s /usr/bin/vim.tiny /usr/local/bin/vim +EOF - - on_chroot < "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan" - echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan" +diff --git stage2/02-net-tweaks/01-run.sh stage2/02-net-tweaks/01-run.sh +index 1f91095..47dcff9 100755 +--- stage2/02-net-tweaks/01-run.sh ++++ stage2/02-net-tweaks/01-run.sh +@@ -11,6 +11,7 @@ for addr in 107d50c000.serial 3f215040.serial 20215040.serial fe215040.serial so + echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-${addr}:bluetooth" + done + ++# base-image sets this so we should always enter this + if [ -v WPA_COUNTRY ]; then + on_chroot <<- EOF + SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_wifi_country "${WPA_COUNTRY}" +@@ -22,3 +23,24 @@ elif [ -d "${ROOTFS_DIR}/var/lib/NetworkManager" ]; then + WirelessEnabled=false + EOF fi + -+# unblock WiFi -+echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan" -+echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan" ++# unblock WiFi anyway (should have been done by raspi-config above though) ++for addr in 3f300000.mmcnr fe300000.mmcnr 1001100000.mmc; do ++ echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-${addr}:wlan" ++done + +install -m 755 files/internet-check "${ROOTFS_DIR}/usr/local/bin/" +install -m 644 files/internet-check.service "${ROOTFS_DIR}/etc/systemd/system/" + -+ +# runtime config firewall persistence (ap) +mkdir -p ${ROOTFS_DIR}/etc/iptables +install -m 644 files/iptables-restore.service "${ROOTFS_DIR}/etc/systemd/system/" @@ -24,6 +34,4 @@ +systemctl enable dhcpcd.service +systemctl unmask hostapd +systemctl disable hostapd.service dnsmasq.service iptables-restore.service -+ +EOF -+ diff --git a/tree/stage2/04-cloud-init/00-packages.patch b/tree/stage2/04-cloud-init/00-packages.patch new file mode 100644 index 0000000..f178a67 --- /dev/null +++ b/tree/stage2/04-cloud-init/00-packages.patch @@ -0,0 +1,7 @@ +diff --git i/stage2/04-cloud-init/00-packages w/stage2/04-cloud-init/00-packages +index db064e6..8b13789 100644 +--- i/stage2/04-cloud-init/00-packages ++++ w/stage2/04-cloud-init/00-packages +@@ -1 +1 @@ +-cloud-init ++ diff --git a/tree/stage2/07-sys-configurator/01-run.sh b/tree/stage2/07-sys-configurator/01-run.sh index 3059283..2e6af14 100755 --- a/tree/stage2/07-sys-configurator/01-run.sh +++ b/tree/stage2/07-sys-configurator/01-run.sh @@ -2,8 +2,8 @@ on_chroot << EOF python3 -m venv /usr/local/offspot-python -# /usr/local/offspot-python/bin/pip install https://github.com/offspot/offspot-config/archive/refs/heads/main.zip -/usr/local/offspot-python/bin/pip install offspot-config==2.7.0 +#/usr/local/offspot-python/bin/pip install https://github.com/offspot/offspot-config/archive/refs/heads/main.zip +/usr/local/offspot-python/bin/pip install offspot-config==2.7.1 EOF install -m 755 files/offspot-runtime.service "${ROOTFS_DIR}/etc/systemd/system/"