Browse Source

initial heads-0.0 setup

parazyd 2 years ago
parent
commit
c4ac3b1058
1 changed files with 344 additions and 2 deletions
  1. 344 2
      heads.blend

+ 344 - 2
heads.blend

@@ -1,5 +1,5 @@
1 1
 #!/usr/bin/env zsh
2
-# Copyright (c) 2016 Dyne.org Foundation
2
+# Copyright (c) 2016-2017 Dyne.org Foundation
3 3
 #
4 4
 # heads.blend is written and maintained by Ivan J. <parazyd@dyne.org>
5 5
 #
@@ -19,8 +19,85 @@
19 19
 ## libdevuansdk build script for heads
20 20
 
21 21
 blend_name="heads"
22
+blend_vers="0.0"
23
+image_name="${blend_name}-${blend_ver}-${arch}"
22 24
 
23
-blend_packages=()
25
+kernelver="4.8.17"
26
+kernelurl="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${kernelver}.tar.xz"
27
+
28
+icecatver="45.5.1"
29
+
30
+torver="0.3.0.3-alpha"
31
+
32
+extra_packages+=(
33
+	## interface
34
+	awesome
35
+	#mate-desktop-environment
36
+	xserver-xorg
37
+	xfonts-terminus
38
+	xinit
39
+	zenity
40
+
41
+	## -dev
42
+	autoconf
43
+	automake
44
+	build-essential
45
+	bc
46
+	ncurses-dev
47
+	### tor build deps
48
+	libevent-dev
49
+	libssl-dev
50
+	### torsocks build deps
51
+	libtool
52
+	libtool-bin
53
+	### tomb build deps
54
+	libgcrypt20-dev
55
+
56
+	## system
57
+	cryptsetup
58
+	curl
59
+	#ferm
60
+	haveged
61
+	openssh-client
62
+	pax-utils
63
+	paxctl
64
+	rfkill
65
+	sshfs
66
+	traceroute
67
+	jq
68
+
69
+	## 1337
70
+	aircrack-ng
71
+	macchanger
72
+	reaver
73
+
74
+	## utils
75
+	#apt-transport-tor
76
+	apg
77
+	gnupg2
78
+	keychain
79
+	openvpn
80
+	p7zip
81
+	pinentry-gtk2
82
+	ssss
83
+	wipe
84
+	wpagui
85
+	terminology
86
+
87
+	## progs
88
+	enigmail
89
+	mupdf
90
+	feh
91
+	gimp
92
+	icedove
93
+	keepassx
94
+	pass
95
+	vlc
96
+)
97
+
98
+purge_packages+=(
99
+	openssh-server
100
+)
24 101
 
25 102
 blend_preinst() {
26 103
 	fn blend_preinst
@@ -28,6 +105,8 @@ blend_preinst() {
28 105
 	ckreq || return 1
29 106
 
30 107
 	notice "executing $blend_name preinst"
108
+
109
+	add-user luther luther
31 110
 }
32 111
 
33 112
 blend_postinst() {
@@ -36,4 +115,267 @@ blend_postinst() {
36 115
 	ckreq || return 1
37 116
 
38 117
 	notice "executing $blend_name postinst"
118
+
119
+	blend_install_ferm
120
+	blend_install_tomb
121
+	blend_install_jaromail
122
+	blend_install_tor
123
+	blend_install_torsocks
124
+	blend_install_icecat
125
+
126
+	notice "grabbing rootfs-overlay"
127
+	pushd "$strapdir"
128
+
129
+	sudo git clone https://git.devuan.org/heads/rootfs-overlay || zerr
130
+	sudo mv -v   rootfs-overlay/.git . || zerr
131
+	sudo cp -rav rootfs-overlay/* .    || zerr
132
+	sudo rm -rf  rootfs-overlay
133
+
134
+	fixpax
135
+
136
+	blend_finalize
137
+
138
+	popd
139
+}
140
+
141
+build_kernel_amd64() {
142
+	fn build_kernel_amd64
143
+	req=(R kernelver gitkernel gitbranch strapdir)
144
+	ckreq || return 1
145
+
146
+	func "override libdevuansdk's build_kernel_amd64"
147
+
148
+	[[ -d $R/tmp/kernels/linux-${kernelver} ]] || {
149
+		notice "downloading linux kernel $kernelver"
150
+		mkdir -p "$R/tmp/kernels/linux-${kernelver}"
151
+		pushd "$R/tmp/kernels/"
152
+		curl -L -O "$kernelurl" || zerr
153
+		notice "extracting..."
154
+		tar xf linux-${kernelver}.tar.xz
155
+		popd
156
+	}
157
+
158
+
159
+	notice "grabbing hardened-patches from gentoo"
160
+
161
+	pushd "$R/tmp/kernels/linux-${kernelver}"
162
+	curl -L -o hardened-patches.tbz2 \
163
+		"http://dev.gentoo.org/~blueness/hardened-sources/hardened-patches/hardened-patches-${kernelver}-3.extras.tar.bz2"
164
+	tar xvf hardened-patches.tbz2
165
+
166
+	notice "patching kernel..."
167
+	kernelpatches="$(printf %s\\n ./${kernelver}/*.patch)"
168
+	for i in $kernelpatches; do
169
+		patch -p1 < $i || zerr
170
+	done
171
+
172
+	notice "deblobbing the kernel"
173
+	for i in 4.8 check main; do
174
+		curl -O http://linux-libre.fsfla.org/pub/linux-libre/releases/${kernelver}-gnu/deblob-${i}
175
+		chmod +x deblob-${i} || zerr
176
+	done
177
+	./deblob-4.8 || zerr
178
+
179
+	cp -f "$R/../extra/kernel/${kernelver}.config" .config || zerr
180
+
181
+	make $MAKEOPTS || zerr
182
+	sudo -E make INSTALL_PATH=$strapdir/boot  install         || zerr
183
+	sudo -E make INSTALL_MOD_PATH=$strapdir   modules_install || zerr
184
+
185
+	popd
186
+}
187
+
188
+## {{{ fixpax()
189
+fixpax() {
190
+	fn fixpax
191
+	req=(strapdir)
192
+	ckreq || return 1
193
+
194
+	notice "fixing up pax markings"
195
+
196
+	cat <<EOF | sudo tee ${strapdir}/fixpax >/dev/null
197
+#!/bin/sh
198
+
199
+## icedove
200
+paxctl -c /usr/bin/icedove
201
+paxctl -m /usr/bin/icedove
202
+
203
+## icecat
204
+paxctl -c /usr/local/icecat/icecat
205
+paxctl -m /usr/local/icecat/icecat
206
+EOF
207
+	chroot-script fixpax
208
+}
209
+## }}}
210
+## {{{ blend_install_gradm()
211
+blend_install_gradm() {
212
+	fn blend_install_gradm
213
+
214
+	notice "grabbing gradm 3.1"
215
+	local gradmsrc="https://dev.gentoo.org/~blueness/hardened-sources/gradm/gradm-3.1-201608131257.tar.gz"
216
+	#local gradmsrc="gradm-3.1-201608131257.tar.gz"
217
+
218
+	mkdir -p $strapdir/tmp
219
+	pushd $strapdir/tmp
220
+	curl -L -O $gradmsrc || zerr
221
+	tar xf gradm-3.1-201608131257.tar.gz
222
+
223
+	pushd gradm
224
+	make || zerr
225
+	sudo -E make DESTDIR=$strapdir install || zerr
226
+	popd
227
+}
228
+## }}}
229
+## {{{ blend_install_tomb()
230
+blend_install_tomb() {
231
+	fn blend_install_tomb
232
+	req=(strapdir)
233
+	ckreq || return 1
234
+
235
+	notice "installing tomb in $strapdir"
236
+
237
+	sudo git clone https://github.com/dyne/tomb.git $strapdir/root/tomb
238
+	sudo git clone https://github.com/parazyd/gtomb.git $strapdir/root/gtomb
239
+
240
+	cat <<EOF | sudo tee ${strapdir}/install-tomb >/dev/null
241
+#!/bin/sh
242
+cd /root/tomb
243
+make install
244
+
245
+cd extras/kdf-keys
246
+make
247
+make install
248
+
249
+cd /root/gtomb
250
+PREFIX=/usr make install
251
+cd /
252
+
253
+rm -rf /root/tomb
254
+rm -rf /root/gtomb
255
+EOF
256
+	chroot-script install-tomb
257
+}
258
+## }}}
259
+## {{{ blend_install_ferm()
260
+blend_install_ferm() {
261
+	fn blend_install_ferm
262
+	req=(strapdir)
263
+	ckreq || return 1
264
+
265
+	notice "installing ferm in $strapdir"
266
+	sudo git clone https://github.com/MaxKellermann/ferm.git $strapdir/root/ferm || zerr
267
+
268
+	cat <<EOF | sudo tee ${strapdir}/install-ferm >/dev/null
269
+#!/bin/sh
270
+cd /root/ferm
271
+make
272
+make install
273
+cd /
274
+rm -fr /root/ferm
275
+EOF
276
+	chroot-script install-ferm || zerr
277
+}
278
+## }}}
279
+## {{{ blend_install_jaromail()
280
+blend_install_jaromail() {
281
+	fn blend_install_jaromail
282
+}
283
+## }}}
284
+## {{{ blend_install_tor()
285
+blend_install_tor() {
286
+	fn blend_install_tor
287
+	req=(strapdir)
288
+	ckreq || return 1
289
+
290
+	notice "installing tor in $strapdir"
291
+
292
+	notice "downloading tor"
293
+	sudo curl -L -o $strapdir/root/tor.tgz https://dist.torproject.org/tor-$torver.tar.gz
294
+	cat <<EOF | sudo tee ${strapdir}/install-tor >/dev/null
295
+#!/bin/sh
296
+cd /root
297
+tar xvf tor.tgz
298
+cd tor-${torver}
299
+
300
+./configure \
301
+	--prefix=/usr \
302
+	--disable-system-torrc \
303
+	--disable-systemd
304
+
305
+make
306
+make install
307
+
308
+cd /root
309
+
310
+rm -rf tor*
311
+EOF
312
+	chroot-script install-tor || zerr
313
+}
314
+## }}}
315
+## {{{ blend_install_torsocks()
316
+blend_install_torsocks() {
317
+	fn blend_install_torsocks
318
+	req=(strapdir)
319
+	ckreq || return 1
320
+
321
+	notice "installing torsocks in $strapdir"
322
+
323
+	notice "cloning torsocks"
324
+	sudo git clone https://git.torproject.org/torsocks.git $strapdir/root/torsocks
325
+	cat <<EOF | sudo tee ${strapdir}/install-torsocks >/dev/null
326
+#!/bin/sh
327
+cd /root/torsocks
328
+git checkout v2.2.0
329
+./autogen.sh
330
+./configure --prefix=/usr
331
+make
332
+make install
333
+
334
+cd ..
335
+rm -rf /root/torsocks
336
+EOF
337
+	chroot-script install-torsocks || zerr
338
+}
339
+## }}}
340
+## {{{ blend_install_icecat()
341
+blend_install_icecat() {
342
+	fn blend_install_icecat
343
+	req=(strapdir)
344
+	ckreq || return 1
345
+
346
+	notice "installing GNU Icecat in $strapdir"
347
+
348
+	case $arch in
349
+		amd64) icecaturl="https://ftp.gnu.org/gnu/gnuzilla/$icecatver/icecat-$icecatver.en-US.linux-x86_64.tar.bz2"
350
+				;;
351
+		i386)  icecaturl="https://ftp.gnu.org/gnu/gnuzilla/$icecatver/icecat-$icecatver.en-US.linux-i686.tar.bz2"
352
+				;;
353
+	esac
354
+
355
+	notice "downloading GNU Icecat..."
356
+	sudo curl -L -o $strapdir/root/icecat.tbz2 $icecaturl || zerr
357
+
358
+	notice "extracting GNU Icecat"
359
+	pushd $strapdir/usr/local
360
+		sudo tar xfp $strapdir/root/icecat.tbz2
361
+		sudo rm -f   $strapdir/root/icecat.tbz2
362
+	popd
363
+}
364
+## }}}
365
+## {{{ blend_finalize()
366
+blend_finalize() {
367
+	fn blend_finalize
368
+	req=(strapdir)
369
+	ckreq || return 1
370
+
371
+	cat <<EOF | sudo tee ${strapdir}/finalize >/dev/null
372
+#!/bin/sh
373
+## rootless xorg
374
+chown :input /usr/bin/Xorg
375
+chmod g+s /usr/bin/Xorg
376
+gpasswd -a luther input
377
+gpasswd -a luther video
378
+EOF
379
+	chroot-script finalize || zerr
39 380
 }
381
+## }}}