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
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
else ifdef squash
SQUASH := ${squash}
- SYSROOT := sys_root/
+ SYSROOT := sys_root_${release}/
CFGROOT := cfg_root/
PACKAGES += squashfs-tools nbd-client
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
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 "$@"
${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/
-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
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