]> git.plutz.net Git - blast/blob - modules/default.mk
changed package name btrfs-tools to current btrfs-progs
[blast] / modules / default.mk
1 ifdef imagesize
2   ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 3 ))")
3 endif
4
5 PACKAGES += btrfs-progs bzip2 ca-certificates cron deborphan firmware-linux-free gzip htop ifupdown iputils-ping irqbalance isc-dhcp-client less make net-tools nmap ntpdate openssh-client psmisc rsync sshfs sudo traceroute unzip vim wget wireless-tools wpasupplicant xz-utils zip
6
7 ifdef packages
8   PACKAGES += $(subst ${comma_},${space_},${packages})
9 endif
10
11 export DEBCONF RPICONFIG
12
13 define DEBCONF :=
14 ${DEBCONF}
15
16 keyboard-configuration  keyboard-configuration/model    select  Generic 105-key (Intl) PC
17 keyboard-configuration  keyboard-configuration/variant  select  English (US) - English (Macintosh)
18 endef
19
20 define RPICONFIG :=
21 ${RPICONFIG}
22
23 dtoverlay=vc4-fkms-v3d,cma-256
24 endef
25
26 .PHONY: _debconf_selections _raspberry_config
27 _install: _debconf_selections
28 _debconf_selections: ${SYSROOT}
29         printf '%s\n' "$${DEBCONF}" |chroot "$${SYSROOT}" debconf-set-selections
30
31 ifdef raspi
32   _config: _raspberry_config
33 endif
34 _raspberry_config: ${CFGROOT}
35         printf '%s\n' "$${RPICONFIG}" >>"$${CFGROOT}/boot/config.txt"
36
37 .PHONY: _timezone _locales
38
39 ifdef timezone
40   export timezone
41   PACKAGES += tzdata
42   _config: _timezone
43 endif
44
45 ifdef locales
46   PACKAGES += locales
47   _config: _locales
48 endif
49
50 _timezone: ${CFGROOT}
51         printf '%s\n' "$${timezone}" >"$${CFGROOT}/etc/timezone"
52         ln -sf /usr/share/zoneinfo/"$${timezone}" "$${CFGROOT}/etc/localtime"
53
54 _locales: ${CFGROOT}
55         for l in $(subst ${comma_},${space_},${locales}); do \
56                 printf '%s %s\n' "$${l}" "$${l#*.}"; \
57         done >"$${CFGROOT}/etc/locale.gen"
58         printf 'LANG=%s\n' "$(firstword $(subst ${comma_},${space_},${locales}))" >"$${CFGROOT}/etc/default/locale"
59         chroot "$${CFGROOT}" locale-gen
60
61 .PHONY: _rootpass _users _hostname
62
63 ifdef rootpass
64   export rootpass
65   _config: _rootpass
66 endif
67
68 ifdef rootkey
69   export rootkey
70   _config: _rootkey
71 endif
72
73 ifdef users
74   _config: _users
75 endif
76
77 ifdef hostname
78   export hostname
79   _config: _hostname
80 endif
81
82 _rootpass: ${CFGROOT}
83         chroot "$${CFGROOT}" usermod -p "$$(openssl passwd "$${rootpass}")" root
84
85 ${rootkey}.pub:
86         [ -f "$@" ] || ssh-keygen -N '' -f "$${rootkey}"
87
88 _rootkey: ${CFGROOT} ${rootkey}.pub
89         mkdir -m 700 "$${CFGROOT}/root/.ssh/"
90         cp "$${rootkey}.pub" "$${CFGROOT}/root/.ssh/authorized_keys"
91
92 _users: ${CFGROOT}
93         for u in $(subst ${comma_},${space_},${users}); do \
94                 chroot "$${CFGROOT}" useradd -s /bin/bash -p "$$(openssl passwd "")" "$$u"; \
95         done
96
97 _hostname: ${CFGROOT}
98         printf '%s\n' "$${hostname}" >"$${CFGROOT}/etc/hostname"
99
100 ifdef wifi
101   _config: ${CFGROOT}/etc/network/interfaces.d/wifi
102   ifdef wifipass
103     export wifi wifipass
104     ${CFGROOT}/etc/network/interfaces.d/wifi: ${CFGROOT}
105         printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
106         printf '  wpa-ssid "%s"\n  wpa-psk "%s"\n' "$$wifi" "$$wifipass" >>$@
107   else
108     export wifi
109     ${CFGROOT}/etc/network/interfaces.d/wifi: ${CFGROOT}
110         printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
111         printf '  wireless-ssid "%s"\n' "$$wifi" >>$@
112   endif
113 endif