]> git.plutz.net Git - blast/blob - modules/default.mk
makefile indentation for readability, working shutdown in xfce, hostname setting
[blast] / modules / default.mk
1 ifdef imagesize
2   ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 3 ))")
3 endif
4
5 PACKAGES += btrfs-tools 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
12
13 define DEBCONF :=
14 keyboard-configuration  keyboard-configuration/model    select  Generic 105-key (Intl) PC
15 keyboard-configuration  keyboard-configuration/variant  select  English (US) - English (Macintosh)
16 endef
17
18 .PHONY: _debconf_selections
19 _install: _debconf_selections
20 _debconf_selections: ${SYSROOT}
21         printf '%s\n' "$${DEBCONF}" |chroot "$${SYSROOT}" debconf-set-selections
22
23 .PHONY: _timezone _locales
24
25 ifdef timezone
26   export timezone
27   PACKAGES += tzdata
28   _config: _timezone
29 endif
30
31 ifdef locales
32   PACKAGES += locales
33   _config: _locales
34 endif
35
36 _timezone: ${CFGROOT}
37         printf '%s\n' "$${timezone}" >"$${CFGROOT}/etc/timezone"
38         ln -sf /usr/share/zoneinfo/"$${timezone}" "$${CFGROOT}/etc/localtime"
39
40 _locales: ${CFGROOT}
41         for l in $(subst ${comma_},${space_},${locales}); do \
42                 printf '%s %s\n' "$${l}" "$${l#*.}"; \
43         done >"$${CFGROOT}/etc/locale.gen"
44         printf 'LANG=%s\n' "$(firstword $(subst ${comma_},${space_},${locales}))" >"$${CFGROOT}/etc/default/locale"
45         chroot "$${CFGROOT}" locale-gen
46
47 .PHONY: _rootpass _users _hostname
48
49 ifdef rootpass
50   export rootpass
51   _config: _rootpass
52 endif
53
54 ifdef users
55   _config: _users
56 endif
57
58 ifdef hostname
59   export hostname
60   _config: _hostname
61 endif
62
63 _rootpass: ${CFGROOT}
64         chroot "$${CFGROOT}" usermod -p "$$(openssl passwd "$${rootpass}")" root
65
66 _users: ${CFGROOT}
67         for u in $(subst ${comma_},${space_},${users}); do \
68                 chroot "$${CFGROOT}" useradd -m -s /bin/bash -p "$$(openssl passwd "")" "$$u"; \
69         done
70
71 _hostname: ${CFGROOT}
72         printf '%s\n' "$${hostname}" "$${CFGROOT}/etc/hostname"
73
74 ifdef wifi
75   _config: ${CFGROOT}/etc/network/interfaces.d/wifi
76   ifdef wifipass
77     export wifi wifipass
78     ${CFGROOT}/etc/network/interfaces.d/wifi: ${CFGROOT}
79         printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
80         printf '  wpa-ssid "%s"\n  wpa-psk "%s"\n' "$$wifi" "$$wifipass" >>$@
81   else
82     export wifi
83     ${CFGROOT}/etc/network/interfaces.d/wifi: ${CFGROOT}
84         printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
85         printf '  wireless-ssid "%s"\n' "$$wifi" >>$@
86   endif
87 endif