]> git.plutz.net Git - blast/commitdiff
enable config selection, enable release switch
authorPaul Hänsch <paul@plutz.net>
Wed, 24 Jul 2019 22:53:39 +0000 (00:53 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 24 Jul 2019 22:53:39 +0000 (00:53 +0200)
Makefile
config.example
modules/approx.mk

index ef1af7579aee04593836fcffe5ce3f9d67275e77..c3309a2912ebc71823a073a498b1a8ba26d78c7d 100644 (file)
--- 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
 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
 
 
 # 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" "$@"
 
 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
 ifdef disk
   VOLUME := ${disk}
   PBOOT := ${disk}1
@@ -51,7 +59,7 @@ else ifdef image
   VOLUME := ${image}
   PBOOT := part_boot.img
   PROOT := part_root.img
   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
   CFGROOT := img_mount/
   
   _target: _mbr _umount _partcopy _config _install
@@ -71,7 +79,7 @@ else ifdef image
 
 else ifdef squash
   SQUASH := ${squash}
 
 else ifdef squash
   SQUASH := ${squash}
-  SYSROOT := sys_root/
+  SYSROOT := sys_root_${release}/
   CFGROOT := cfg_root/
 
   PACKAGES += squashfs-tools nbd-client
   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
   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
 
   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
   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
 
 
 export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP
 
-sys_root/:
+sys_root_${release}/:
        btrfs subvol create "$@" || mkdir "$@"
        chmod 755 "$@"
 
        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 "$@"
 
        -btrfs sub del "$@" || rm -r "$@"
        btrfs sub snap "$<" "$@" || mkdir "$@"
        chmod 755 "$@"
 
-rpi_root/:
+rpi_root_${release}/:
        btrfs subvol create "$@" || mkdir "$@"
        chmod 755 "$@"
 
        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}" \
 ${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/
 
 .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
        -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 "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
        -rm part_boot.img
        -rm part_root.img
        -rm rpi_boot.img
index 07edc443474866cb6fb918cf04b50fb213491ea6..33064de9736f2e64d27a259ba6a1396f8595ffcd 100644 (file)
@@ -9,6 +9,9 @@
 ## Additional packages
 # packages=chromium,gimp
 
 ## 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
 
 ## Comma separated list of config modules from modules/ directory
 # modules=nodm,xfce
 
index ca3f34ad01820ad648a7acb41f0ce95c77422aa3..8e4fd78f4e9a40f0f8a08c24fb8d41c39f133e38 100644 (file)
@@ -4,22 +4,20 @@ endef
 export approx_original_sources
 
 ifdef approx
 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 :=
 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 :=
   endef
 else
   BOOTSTRAP := http://localhost/debian
   define SOURCES :=
-  deb http://localhost/debian stretch main
+  deb http://localhost/debian ${release} main
   endef
 endif
 
   endef
 endif