From 23d0b46966959d04e3d99010b22a24e36b73d6a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 25 Jul 2019 00:53:39 +0200 Subject: [PATCH 1/1] enable config selection, enable release switch --- Makefile | 48 ++++++++++++++++++++++++++++------------------- config.example | 3 +++ modules/approx.mk | 16 +++++++--------- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index ef1af75..c3309a2 100644 --- a/Makefile +++ b/Makefile @@ -13,21 +13,29 @@ space_:= ${nul_} ${nul_} ARCH := amd64 KEYRING := keys/debian-archive-stretch-stable.gpg BOOTSTRAP := http://cdn.debian.net/debian +PACKAGES := ${PACKAGES} apt busybox-static debian-archive-keyring init systemd # Partition Table (2M) + Boot Partition (126M)+ Root Partition + Slack Space (1M) = 2048M BOOT_MB := 62 ROOT_MB := 959 -define SOURCES = -deb http://cdn.debian.net/debian stretch main -endef - -PACKAGES := ${PACKAGES} apt busybox-static debian-archive-keyring init systemd - -include config.mk config.mk: cp "config.example" "$@" +ifndef config + include config.mk +else + include ${config} +endif + +ifndef release + release := stretch +endif + +define SOURCES := +deb http://cdn.debian.net/debian ${release} main +endef + ifdef disk VOLUME := ${disk} PBOOT := ${disk}1 @@ -51,7 +59,7 @@ else ifdef image VOLUME := ${image} PBOOT := part_boot.img PROOT := part_root.img - SYSROOT := sys_root/ + SYSROOT := sys_root_${release}/ CFGROOT := img_mount/ _target: _mbr _umount _partcopy _config _install @@ -71,7 +79,7 @@ else ifdef image else ifdef squash SQUASH := ${squash} - SYSROOT := sys_root/ + SYSROOT := sys_root_${release}/ CFGROOT := cfg_root/ PACKAGES += squashfs-tools nbd-client @@ -88,16 +96,16 @@ else ifdef raspi VOLUME := ${raspi} PBOOT := rpi_boot.img PROOT := rpi_root.img - SYSROOT := rpi_root/ + SYSROOT := rpi_root_${release}/ CFGROOT := img_mount/ ARCH := armhf KEYRING := keys/raspbian-archive-keyring.gpg BOOTSTRAP := http://raspbian.raspberrypi.org/raspbian - define SOURCES = - deb http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi - deb http://archive.raspberrypi.org/debian stretch main + define SOURCES := + deb http://raspbian.raspberrypi.org/raspbian ${release} main non-free firmware rpi + deb http://archive.raspberrypi.org/debian ${release} main endef PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel @@ -136,16 +144,16 @@ endif export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP -sys_root/: +sys_root_${release}/: btrfs subvol create "$@" || mkdir "$@" chmod 755 "$@" -cfg_root/: sys_root/ _install +cfg_root/: sys_root_${release}/ _install -btrfs sub del "$@" || rm -r "$@" btrfs sub snap "$<" "$@" || mkdir "$@" chmod 755 "$@" -rpi_root/: +rpi_root_${release}/: btrfs subvol create "$@" || mkdir "$@" chmod 755 "$@" @@ -166,7 +174,9 @@ _bootstrap: ${SYSROOT}/bin/sh ${SYSROOT}/bin/sh: | ${SYSROOT} debootstrap --variant=minbase --arch="$${ARCH}" \ --keyring="$${KEYRING}" \ - stretch "$${SYSROOT}" "$${BOOTSTRAP}" + "${release}" "$${SYSROOT}" "$${BOOTSTRAP}" + printf 'APT::Default-Release "%s";' "${release}" >"$${SYSROOT}/etc/apt/apt.conf.d/10release" + .PHONY: _aptkeys _norecommends _aptkeys: ${SYSROOT}/etc/apt/trusted.gpg.d/ @@ -327,9 +337,9 @@ clean: -umount hdd_mount/boot -umount hdd_mount -rmdir hdd_mount - if [ -d "sys_root/" ]; then btrfs sub del "sys_root/" || echo rm -r "sys_root/"; fi + if [ -d "sys_root_${release}/" ]; then btrfs sub del "sys_root_${release}/" || echo rm -r "sys_root_${release}/"; fi if [ -d "cfg_root/" ]; then btrfs sub del "cfg_root/" || echo rm -r "cfg_root/"; fi - if [ -d "rpi_root/" ]; then btrfs sub del "rpi_root/" || echo rm -r "rpi_root/"; fi + if [ -d "rpi_root_${release}/" ]; then btrfs sub del "rpi_root_${release}/" || echo rm -r "rpi_root_${release}/"; fi -rm part_boot.img -rm part_root.img -rm rpi_boot.img diff --git a/config.example b/config.example index 07edc44..33064de 100644 --- a/config.example +++ b/config.example @@ -9,6 +9,9 @@ ## Additional packages # packages=chromium,gimp +## Debian release, so far only stretch has been tested +# release=stretch + ## Comma separated list of config modules from modules/ directory # modules=nodm,xfce diff --git a/modules/approx.mk b/modules/approx.mk index ca3f34a..8e4fd78 100644 --- a/modules/approx.mk +++ b/modules/approx.mk @@ -4,22 +4,20 @@ endef export approx_original_sources ifdef approx - -BOOTSTRAP := ${approx} -define SOURCES = -deb ${approx} stretch main -endef - + BOOTSTRAP := ${approx} + define SOURCES = + deb ${approx} ${release} main + endef else ifdef raspi BOOTSTRAP := http://localhost/raspbian define SOURCES := - deb http://localhost/raspbian stretch main non-free firmware rpi - deb http://localhost/rpidebian stretch main + deb http://localhost/raspbian ${release} main non-free firmware rpi + deb http://localhost/rpidebian ${release} main endef else BOOTSTRAP := http://localhost/debian define SOURCES := - deb http://localhost/debian stretch main + deb http://localhost/debian ${release} main endef endif -- 2.39.2