-ifdef imagesize
- ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 3 ))")
-endif
+modules += wifi
PACKAGES += btrfs-progs bzip2 ca-certificates cron dnsutils e2fsprogs fdisk file firmware-linux-free gzip htop ifupdown iputils-ping irqbalance isc-dhcp-client less make ncat net-tools nmap ntpsec-ntpdate openssh-client pciutils psmisc rsync sshfs sudo traceroute unzip vim wget wireless-tools wpasupplicant xz-utils zip
PACKAGES += $(subst ${comma_},${space_},${packages})
endif
-export DEBCONF RPICONFIG
-
-define DEBCONF :=
-${DEBCONF}
+define DEBCONF +=
keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC
keyboard-configuration keyboard-configuration/variant select English (US) - English (Macintosh)
console-setup console-setup/charmap47 select UTF-8
console-setup console-setup/codeset47 select # Latin1 and Latin5 - western Europe and Turkic languages
+
endef
+export DEBCONF
-.PHONY: _debconf_selections _keyboard
-_install: _debconf_selections
-_debconf_selections: ${SYSROOT}
- printf '%s\n' "$${DEBCONF}" |chroot "$${SYSROOT}" debconf-set-selections
+.PHONY: _debconf_selections _systemd_timeout _pingcap _files_default
+.PHONY: _keyboard _timezone _locales _rootpass _rootkey _users
+
+_config: _debconf_selections _systemd_timeout _pingcap _files_default
+_config: ${CFGROOT}/etc/sysctl.d/quiet-console.conf
+_config: ${CFGROOT}/etc/systemd/network/99-default.link
+_config: ${CFGROOT}/etc/pam.d/common-session
ifdef keyboard
- _config: _keyboard
+ _config: ${CFGROOT}/etc/default/keyboard
endif
-_keyboard: _copy
- -sed -Ei 's;^XKBLAYOUT=.*$$;XKBLAYOUT="${keyboard}";;' "$${CFGROOT}/etc/default/keyboard"
-.PHONY: _timezone _locales
ifdef timezone
- export timezone
PACKAGES += tzdata
- _config: _timezone
+ _config: ${CFGROOT}/etc/timezone ${CFGROOT}/etc/localtime
endif
ifdef locales
_config: _locales
endif
-_timezone: _copy
- printf '%s\n' "$${timezone}" >"$${CFGROOT}/etc/timezone"
- ln -sf /usr/share/zoneinfo/"$${timezone}" "$${CFGROOT}/etc/localtime"
-
-_locales: _copy
- for l in $(subst ${comma_},${space_},${locales}); do \
- printf '%s %s\n' "$${l}" "$${l#*.}"; \
- done >"$${CFGROOT}/etc/locale.gen"
- printf 'LANG=%s\n' "$(firstword $(subst ${comma_},${space_},${locales}))" >"$${CFGROOT}/etc/default/locale"
- chroot "$${CFGROOT}" locale-gen
-
-.PHONY: _rootpass _users _hostname
-
ifdef rootpass
- export rootpass
_config: _rootpass
endif
ifdef rootkey
- export rootkey
_config: _rootkey
endif
endif
ifdef hostname
- export hostname
- _config: _hostname
+ _config: ${CFGROOT}/etc/hostname ${CFGROOT}/etc/hosts
endif
+_debconf_selections: ${SYSROOT}
+ printf '%s\n' "$${DEBCONF}" \
+ | chroot "$${SYSROOT}" debconf-set-selections
-_rootpass: _copy
- chroot "$${CFGROOT}" usermod -p "$$(openssl passwd "$${rootpass}")" root
-
-${rootkey}.pub:
- [ -f "$@" ] || ssh-keygen -N '' -f "$${rootkey}"
-
-_rootkey: _copy ${rootkey}.pub
- mkdir -pm 700 "$${CFGROOT}/root/.ssh/"
- cp "$${rootkey}.pub" "$${CFGROOT}/root/.ssh/authorized_keys"
-
-_users: _copy
- for u in $(subst ${comma_},${space_},${users}); do \
- chroot "$${CFGROOT}" useradd -s /bin/bash -p "$$(openssl passwd "")" "$$u"; \
- done
-
-_hostname: _copy
- printf '%s\n' "$${hostname}" >"$${CFGROOT}/etc/hostname"
- sed -Ei "s;^127\.0\.0\.1.*$$;& $${hostname};" "$${CFGROOT}/etc/hosts"
-
-.PHONY: _systemd_timeout _pingcap _files_default
-_config: _systemd_timeout _pingcap _files_default
_systemd_timeout: _copy
- mkdir -p "$${CFGROOT}/etc/systemd"
- printf 'DefaultTimeout%sSec=%s\n' Start 10s Stop 10s >>"$${CFGROOT}/etc/systemd/system.conf"
+ printf 'DefaultTimeout%sSec=%s\n' Start 10s Stop 10s \
+ >>"$${CFGROOT}/etc/systemd/system.conf"
_pingcap: _copy
-chroot "$${CFGROOT}" setcap cap_net_raw+p /usr/bin/ping
_files_default: _copy modules/default/
cp -a modules/default/. "$${CFGROOT}"
+_locales: _copy
+ for l in $(subst ${comma_},${space_},${locales}); do \
+ printf '%s %s\n' "$${l}" "$${l#*.}"; \
+ done >>"$${CFGROOT}/etc/locale.gen"
+ printf 'LANG=%s\n' \
+ "$(firstword $(subst ${comma_},${space_},${locales}))" \
+ >"$${CFGROOT}/etc/default/locale"
+ chroot "$${CFGROOT}" locale-gen
+
+_rootpass: _copy
+ chroot "$${CFGROOT}" usermod -p \
+ "$$(openssl passwd "${rootpass}")" root
-ifdef wifi
- _config: ${CFGROOT}/etc/network/interfaces.d/wifi
- ifdef wifipass
- export wifi wifipass
- ${CFGROOT}/etc/network/interfaces.d/wifi: _copy
- printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
- printf ' wpa-ssid "%s"\n wpa-psk "%s"\n' "$$wifi" "$$wifipass" >>$@
- else
- export wifi
- ${CFGROOT}/etc/network/interfaces.d/wifi: _copy
- printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
- printf ' wireless-essid "%s"\n' "$$wifi" >>$@
- endif
-endif
+${rootkey}.pub:
+ [ -f "$@" ] || ssh-keygen -N '' -f "${rootkey}"
-_config: ${CFGROOT}/etc/sysctl.d/quiet-console.conf
+_rootkey: ${rootkey}.pub _copy
+ mkdir -pm 700 "$${CFGROOT}/root/.ssh/"
+ cat "$<" >>"$${CFGROOT}/root/.ssh/authorized_keys"
+
+_users: _copy
+ for u in $(subst ${comma_},${space_},${users}); do \
+ chroot "$${CFGROOT}" useradd -s /bin/bash -p "$$(openssl passwd "")" "$$u"; \
+ done
${CFGROOT}/etc/sysctl.d/quiet-console.conf: _copy
printf '%s\n' "kernel.printk=3 4 1 7" >"$@"
-
-_config: ${CFGROOT}/etc/systemd/network/99-default.link
${CFGROOT}/etc/systemd/network/99-default.link: _copy
-ln -sf /dev/null "$@"
-_config: ${CFGROOT}/etc/pam.d/common-session
+${CFGROOT}/etc/default/keyboard: _copy .FORCE
+ -sed -Ei 's;^XKBLAYOUT=.*$$;XKBLAYOUT="${keyboard}";;' "$@"
+
+${CFGROOT}/etc/timezone: _copy .FORCE
+ printf '%s\n' "${timezone}" >"$@"
+${CFGROOT}/etc/localtime: _copy .FORCE
+ ln -sf /usr/share/zoneinfo/"${timezone}" "$@"
+
+${CFGROOT}/etc/hostname: _copy .FORCE
+ printf '%s\n' "${hostname}" >"$@"
+${CFGROOT}/etc/hosts: _copy .FORCE
+ sed -Ei "s;^127\.0\.0\.1.*$$;& ${hostname};" "$@"
+
${CFGROOT}/etc/pam.d/common-session: _copy .FORCE
printf '\n%s\n' \
'session optional pam_mkhomedir.so umask=0027' \