diff options
author | Andrew Cady <d@jerkface.net> | 2019-06-22 12:08:07 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2019-06-22 12:08:07 -0400 |
commit | cccf971c6170d65d814ae85a2f7437cc0e6def32 (patch) | |
tree | 945ec347671aa1f01f6b277b0f6eac2ffd90e34f /build-rootfs.sh | |
parent | 8a90cb26a04fdb0f6eac30669c4523deabec6e2c (diff) |
remove build-rootfs.sh, obsoleted by fsmgr
Diffstat (limited to 'build-rootfs.sh')
-rwxr-xr-x | build-rootfs.sh | 368 |
1 files changed, 0 insertions, 368 deletions
diff --git a/build-rootfs.sh b/build-rootfs.sh deleted file mode 100755 index 76daf66..0000000 --- a/build-rootfs.sh +++ /dev/null | |||
@@ -1,368 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | set -e | ||
3 | release=stretch | ||
4 | img_name=2018-06-27 | ||
5 | img_file=debootstrap/${release}-minbase-amd64.${img_name}.btrfs | ||
6 | |||
7 | die() { printf '%s\n' "$*" >&2; exit 1; } | ||
8 | |||
9 | chroot="./debootstrap.sh chroot $release $img_name" | ||
10 | img_sh="./debootstrap.sh sh $release $img_name" | ||
11 | |||
12 | install_packages() | ||
13 | { | ||
14 | # $chroot env DEBIAN_FRONTEND=noninteractive apt-get -y install "$@" | ||
15 | (set -x; ./debootstrap.sh add "$release" "$img_name" "$@") | ||
16 | } | ||
17 | |||
18 | defrag() | ||
19 | { | ||
20 | $img_sh btrfs fi def -rc . | ||
21 | } | ||
22 | |||
23 | wordlines() { printf '%s\n' "$@"; } | ||
24 | |||
25 | xorg_packages() | ||
26 | { | ||
27 | wordlines xorg libxss1 xserver-xorg-input-all xserver-xorg-input-wacom | ||
28 | } | ||
29 | |||
30 | necessary_packages() | ||
31 | { | ||
32 | wordlines systemd-sysv | ||
33 | } | ||
34 | |||
35 | useful_packages() | ||
36 | { | ||
37 | wordlines vim-tiny git tmux ssh | ||
38 | } | ||
39 | |||
40 | network_packages() | ||
41 | { | ||
42 | wordlines \ | ||
43 | network-manager avahi-daemon libnss-mdns \ | ||
44 | iproute2 iw iputils-ping \ | ||
45 | firmware-iwlwifi firmware-linux firmware-linux-nonfree \ | ||
46 | firmware-atheros firmware-linux-free firmware-b43legacy-installer \ | ||
47 | firmware-ti-connectivity firmware-libertas firmware-ipw2x00 \ | ||
48 | firmware-ralink firmware-b43-installer firmware-realtek firmware-iwlwifi \ | ||
49 | firmware-brcm80211 firmware-zd1211 | ||
50 | } | ||
51 | |||
52 | filesystem_tool_packages() | ||
53 | { | ||
54 | wordlines btrfs-progs cryptsetup-bin hfsprogs mdadm nbd-client ntfs-3g | ||
55 | } | ||
56 | |||
57 | boot_tool_packages() | ||
58 | { | ||
59 | wordlines grub-pc isolinux initramfs-tools | ||
60 | } | ||
61 | |||
62 | samizdat_dep_packages() | ||
63 | { | ||
64 | wordlines \ | ||
65 | ca-certificates cryptsetup-bin dnsmasq eject \ | ||
66 | gnupg gnupg2 gnupg-agent grub2-common grub-common grub-pc \ | ||
67 | grub-pc-bin hfsprogs hfsutils nbd-server netscript-ipfilter \ | ||
68 | openssl pinentry-curses strongswan tor xorriso | ||
69 | } | ||
70 | |||
71 | find_prog() | ||
72 | { | ||
73 | want_prog=$1 | ||
74 | prog=$(which "$want_prog") && return | ||
75 | if [ "$SUDO_USER" -a "$(id -u)" = 0 ]; then | ||
76 | prog=$(sh -c 'su - "$SUDO_USER" -c "which \"'"${want_prog}"'\""') | ||
77 | else | ||
78 | false | ||
79 | fi | ||
80 | } | ||
81 | |||
82 | install_program_from_path1() | ||
83 | { | ||
84 | find_prog "$1" || die "program not found: $1" | ||
85 | $img_sh cp -L "$prog" ./usr/local/bin/"$1" | ||
86 | } | ||
87 | |||
88 | install_program_from_path() | ||
89 | { | ||
90 | local f | ||
91 | for f in "$@"; do | ||
92 | install_program_from_path1 "$f" || die "could not install package '$f'" | ||
93 | done | ||
94 | } | ||
95 | |||
96 | install_xmonad() | ||
97 | { | ||
98 | install_program_from_path xmonad | ||
99 | $chroot ln -s /usr/local/bin/xmonad /etc/alternatives/x-window-manager | ||
100 | $chroot ln -s /etc/alternatives/x-window-manager /usr/bin/x-window-manager | ||
101 | } | ||
102 | |||
103 | kernel_packages() | ||
104 | { | ||
105 | wordlines busybox cpio firmware-linux-free \ | ||
106 | initramfs-tools initramfs-tools-core irqbalance \ | ||
107 | klibc-utils kmod libklibc libnuma1 linux-base \ | ||
108 | linux-image-4.9.0-6-amd64 linux-image-amd64 | ||
109 | } | ||
110 | |||
111 | install_apt_cache() | ||
112 | { | ||
113 | $img_sh rsync -RaP /var/lib/apt/lists --exclude partial ./ | ||
114 | } | ||
115 | |||
116 | install_kiki() | ||
117 | { | ||
118 | install_program_from_path cokiki kiki | ||
119 | } | ||
120 | |||
121 | install_samizdat() | ||
122 | { | ||
123 | srcdir=$(pwd) || return | ||
124 | export srcdir | ||
125 | $img_sh sh -c 'instdir=$(pwd) && cd "$srcdir" && make instdir="${instdir}" install install-configuration' | ||
126 | } | ||
127 | |||
128 | make_bootable() | ||
129 | { | ||
130 | ln -sf "$PWD"/"${img_file}" /srv/nbd.btrfs | ||
131 | btrfstune -S1 /srv/nbd.btrfs | ||
132 | } | ||
133 | |||
134 | print_config_dat() | ||
135 | { | ||
136 | # perl -n -00 -e '/^Flags:.*seen/m && print;' /var/cache/debconf/config.dat > config.seen.dat | ||
137 | cat <<'EOF' | ||
138 | |||
139 | Name: debconf/frontend | ||
140 | Template: debconf/frontend | ||
141 | Value: Noninteractive | ||
142 | Owners: debconf | ||
143 | Flags: seen | ||
144 | |||
145 | Name: debconf/priority | ||
146 | Template: debconf/priority | ||
147 | Value: critical | ||
148 | Owners: debconf | ||
149 | Flags: seen | ||
150 | |||
151 | Name: locales/locales_to_be_generated | ||
152 | Template: locales/locales_to_be_generated | ||
153 | Value: en_US.UTF-8 UTF-8 | ||
154 | Owners: locales | ||
155 | Flags: seen | ||
156 | |||
157 | Name: locales/default_environment_locale | ||
158 | Template: locales/default_environment_locale | ||
159 | Value: en_US.UTF-8 | ||
160 | Owners: locales | ||
161 | Flags: seen | ||
162 | Variables: | ||
163 | locales = en_US.UTF-8 | ||
164 | |||
165 | Name: tzdata/Areas | ||
166 | Template: tzdata/Areas | ||
167 | Value: US | ||
168 | Owners: tzdata | ||
169 | Flags: seen | ||
170 | |||
171 | Name: tzdata/Zones/Etc | ||
172 | Template: tzdata/Zones/Etc | ||
173 | Value: UTC | ||
174 | Owners: tzdata | ||
175 | Flags: seen | ||
176 | |||
177 | Name: tzdata/Zones/US | ||
178 | Template: tzdata/Zones/US | ||
179 | Value: Michigan | ||
180 | Owners: tzdata | ||
181 | Flags: seen | ||
182 | |||
183 | Name: firmware-ipw2x00/license/accepted | ||
184 | Template: firmware-ipw2x00/license/accepted | ||
185 | Owners: firmware-ipw2x00 | ||
186 | |||
187 | Name: firmware-ipw2x00/license/error | ||
188 | Template: firmware-ipw2x00/license/error | ||
189 | Owners: firmware-ipw2x00 | ||
190 | |||
191 | Name: b43-fwcutter/install-unconditional | ||
192 | Template: b43-fwcutter/install-unconditional | ||
193 | Value: true | ||
194 | Owners: b43-fwcutter | ||
195 | |||
196 | EOF | ||
197 | } | ||
198 | |||
199 | install_config_dat() | ||
200 | { | ||
201 | print_config_dat | $img_sh sh -c 'cat >> ./var/cache/debconf/config.dat' | ||
202 | } | ||
203 | |||
204 | all_packages() | ||
205 | { | ||
206 | (kernel_packages | ||
207 | necessary_packages | ||
208 | network_packages | ||
209 | useful_packages | ||
210 | filesystem_tool_packages | ||
211 | boot_tool_packages | ||
212 | samizdat_dep_packages | ||
213 | xorg_packages) | sort -u | ||
214 | } | ||
215 | |||
216 | choose_hostname() | ||
217 | { | ||
218 | true | ||
219 | } | ||
220 | |||
221 | main() | ||
222 | { | ||
223 | ./debootstrap.sh init $release | ||
224 | ./debootstrap.sh new $release $img_name | ||
225 | ./debootstrap.sh with_img $release $img_name truncate -s 5G | ||
226 | # ./debootstrap.sh with_img $release $img_name btrfstune -S0 -f || true | ||
227 | ./debootstrap.sh sh $release $img_name btrfs filesystem resize max . | ||
228 | |||
229 | install_config_dat | ||
230 | install_packages $(necessary_packages) | ||
231 | install_packages $(kernel_packages) | ||
232 | install_packages $(network_packages) | ||
233 | install_packages $(useful_packages) | ||
234 | install_packages $(filesystem_tool_packages) | ||
235 | install_packages $(boot_tool_packages) | ||
236 | install_packages $(samizdat_dep_packages) | ||
237 | install_packages $(xorg_packages) | ||
238 | install_packages firefox-esr linphone alsa-utils | ||
239 | install_xmonad | ||
240 | |||
241 | # (Note: libglib2.0-bin is needed for mypaint to work correctly) | ||
242 | install_packages mypaint libglib2.0-bin emacs25 strongswan-pki strongswan-swanctl strongswan-nm | ||
243 | install_packages build-essential vim less xbindkeys w3m sudo dmenu psmisc rsync | ||
244 | install_apt_cache | ||
245 | |||
246 | install_samizdat | ||
247 | install_kiki | ||
248 | install_program_from_path google | ||
249 | install_program_from_path stack | ||
250 | install_program_from_path dhtd dht | ||
251 | |||
252 | add_user_account u | ||
253 | add_git_clone ../src/dotfiles home/u/src/dotfiles | ||
254 | add_git_clone ./ home/u/src/samizdat | ||
255 | add_git_clone ../src/bittorrent home/u/src/presence | ||
256 | |||
257 | make_bootable | ||
258 | echo done. >&2 | ||
259 | } | ||
260 | |||
261 | add_user_account() | ||
262 | { | ||
263 | local uname="$1" | ||
264 | $chroot useradd "$uname" -G sudo -m -p '' -s /bin/bash | ||
265 | } | ||
266 | |||
267 | add_git_clone() | ||
268 | { | ||
269 | local src dst="$2" | ||
270 | src=$(realpath -e "$1") || die "add_git_clone: path does not exist: $1" | ||
271 | $img_sh git clone "$src" ./"$dst" | ||
272 | |||
273 | # todo: set up to properly push and pull via VPN | ||
274 | |||
275 | # From "man git clone": | ||
276 | # | ||
277 | # This default configuration is achieved by creating references to the | ||
278 | # remote branch heads under refs/remotes/origin and by initializing | ||
279 | # remote.origin.url and remote.origin.fetch configuration variables. | ||
280 | } | ||
281 | |||
282 | if [ "${0##*/}" = build-rootfs.sh ]; then | ||
283 | main | ||
284 | fi | ||
285 | |||
286 | |||
287 | exit | ||
288 | : <<'EOF' | ||
289 | # manual installs | ||
290 | |||
291 | # essential tools | ||
292 | vim-tiny | ||
293 | git | ||
294 | tmux | ||
295 | ssh | ||
296 | |||
297 | # filesystem access | ||
298 | btrfs-tools | ||
299 | cryptsetup | ||
300 | hfsprogs | ||
301 | mdadm | ||
302 | nbd-client | ||
303 | ntfs-3g | ||
304 | |||
305 | # bootloaders | ||
306 | grub-pc | ||
307 | isolinux | ||
308 | initramfs-tools | ||
309 | |||
310 | # network | ||
311 | network-manager | ||
312 | avahi-daemon | ||
313 | libnss-mdns | ||
314 | |||
315 | # network tools | ||
316 | iproute2 | ||
317 | iw | ||
318 | iputils-ping | ||
319 | |||
320 | # wifi | ||
321 | firmware-iwlwifi | ||
322 | firmware-linux | ||
323 | firmware-linux-nonfree | ||
324 | |||
325 | # apt-cache pkgnames firmware|while read line; do apt-cache show $line|grep -qi wireless && echo $line; done | ||
326 | firmware-atheros | ||
327 | firmware-linux-free | ||
328 | firmware-b43legacy-installer | ||
329 | firmware-ti-connectivity | ||
330 | firmware-libertas | ||
331 | firmware-ipw2x00 | ||
332 | firmware-ralink | ||
333 | firmware-b43-installer | ||
334 | firmware-realtek | ||
335 | firmware-iwlwifi | ||
336 | firmware-brcm80211 | ||
337 | firmware-zd1211 | ||
338 | |||
339 | # graphics | ||
340 | xorg | ||
341 | libxss1 # for xmonad, to be installed via binary | ||
342 | |||
343 | # samizdat deps | ||
344 | |||
345 | btrfs-progs | ||
346 | ca-certificates | ||
347 | cryptsetup-bin | ||
348 | dnsmasq | ||
349 | eject | ||
350 | gnupg | ||
351 | gnupg2 | ||
352 | gnupg-agent | ||
353 | grub2-common | ||
354 | grub-common | ||
355 | grub-pc | ||
356 | grub-pc-bin | ||
357 | hfsprogs | ||
358 | hfsutils | ||
359 | nbd-server | ||
360 | netscript-ipfilter | ||
361 | openssl | ||
362 | pinentry-curses | ||
363 | strongswan | ||
364 | tor | ||
365 | xorriso | ||
366 | |||
367 | |||
368 | EOF | ||