KEYRING := keys/debian-archive-${release}-automatic.gpg
-ifndef SOURCES
- define SOURCES :=
- deb http://deb.debian.org/debian ${release} main
- deb https://security.debian.org/debian-security/ ${release}-security main
- endef
-endif
-
ifdef squash
target ?= squashfs
endif
include $(addsuffix .mk, $(addprefix targets/, ${target}))
+define SOURCES ?=
+deb http://deb.debian.org/debian ${release} main
+deb https://security.debian.org/debian-security/ ${release}-security main
+endef
+
include modules/default.mk
ifdef modules
include $(addsuffix .mk, $(addprefix modules/, $(subst ${comma_},${space_},${modules})))
cp keys/*.gpg "$@"
chmod 644 "$@"/*.gpg
+${SYSROOT}/etc/apt/sources.list: ${SYSROOT} .FORCE
+ printf '%s\n' "$${SOURCES}" >"$@"
+
+${SYSROOT}/etc/resolv.conf: /etc/resolv.conf ${SYSROOT} .FORCE
+ cp -- "$<" "$@"
+
+_install: ${SYSROOT}/etc/apt/sources.list
+_install: ${SYSROOT}/etc/resolv.conf
_install: ${SYSROOT} _aptkeys _norecommends
- printf '%s\n' "$${SOURCES}" |sort -u >"$${SYSROOT}/etc/apt/sources.list"
- -cp /etc/resolv.conf "$${SYSROOT}/etc/"
-chroot "$${SYSROOT}" sh -c 'apt-mark showmanual |xargs apt-mark auto'
-chroot "$${SYSROOT}" apt-get update
chroot "$${SYSROOT}" ln -sf /bin/true /usr/local/sbin/invoke-rc.d
-define approx_original_sources :=
-${SOURCES}
-endef
-export approx_original_sources
+.PHONY: _approx_restore _approx
+_config: _approx_restore
+_install: _approx
-ifndef approxhost
- approxhost := localhost
-endif
+approxhost ?= localhost:9999
+approx ?= http://${approxhost}/debian
-approxrepos := main
-approxrepos += $(findstring contrib, ${SOURCES})
-approxrepos += $(findstring non-free-fimware, ${SOURCES})
-#approxrepos += $(findstring non-free, ${SOURCES})
+BOOTSTRAP := ${approx}
-ifdef approx
- BOOTSTRAP := ${approx}
- define SOURCES =
- deb ${approx} ${release} ${approxrepos}
- deb ${approx} ${release}-backports ${approxrepos}
- endef
-else ifdef raspi
- BOOTSTRAP := http://localhost/raspbian
- define SOURCES :=
- deb http://${approxhost}/raspbian stretch main non-free firmware rpi
- deb http://${approxhost}/rpidebian stretch main
- deb http://${approxhost}/raspbian buster main non-free firmware rpi
- deb http://${approxhost}/rpidebian buster main
- endef
-else
- BOOTSTRAP := http://localhost/debian
- define SOURCES :=
- deb http://${approxhost}/debian ${release} ${approxrepos}
- endef
-endif
+_approx: ${SYSROOT}/etc/apt/sources.list
+ sed -Ei 's;http://[^/]+/[^ ]+;${approx};' "$<"
-.PHONY: _approx_restore_sources
-_config: _approx_restore_sources
-_approx_restore_sources: ${CFGROOT}
- printf '%s\n' "$${approx_original_sources}" >"$${CFGROOT}/etc/apt/sources.list"
+_approx_restore: _copy
+ printf '%s\n' "$${SOURCES}" >"$${CFGROOT}/etc/apt/sources.list"
-chroot "$${CFGROOT}" apt-get update