summaryrefslogtreecommitdiffstats
path: root/hosts/cam1
blob: 23182db7147dae787424a26701e7816895364e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh

#	start,size,id,bootable
part_script='
	,+,83,*
	'

#	fs           mp       type    options              dump    pass
fstab='
	@DEV1@       /        ext4    errors=remount-ro    0       1
	/var/swap    swap     swap    defaults,pri=100     0       0
	'

mirror='http://httpredir.debian.org/debian'
suite='stretch'
arch='amd64'
extra_pkgs='
	linux-image-amd64
	sysvinit-core
	'

hostname='cam1'

locale='en_US'
supported_locales='en_US.UTF-8 en_DK.UTF-8'

time_zone='UTC'

passwd_shadow='on'
root_passwd_crypted='$6$f65H32OqVRCio9qX$9HW5miPDXJkrfg3UXu6Yh5PmHq5ek0y29Qr4GMf38XRqmjvUOOJMqnQHVZAb8D2utTOyH0IDGHjglHfzuwmzU0'
root_login=true
user_make=true
user_name='cam'
user_full_name='CAM User'
user_groups='adm cdrom floppy sudo audio dip video plugdev netdev'
user_passwd_crypted='$6$f65H32OqVRCio9qX$9HW5miPDXJkrfg3UXu6Yh5PmHq5ek0y29Qr4GMf38XRqmjvUOOJMqnQHVZAb8D2utTOyH0IDGHjglHfzuwmzU0'

debconf_selections='
	keyboard-configuration keyboard-configuration/layout select English (US)
	keyboard-configuration keyboard-configuration/variant select English (US)
	'

postinst_pkgs="
	`# Base system utilities `
	bc
	`# Shells `
	bash
	bash-completion
	`# Administrative daemons `
	anacron
	`# Administrative utilities `
	adduser
	sudo
	`# File and file system utilities `
	ncdu
	nocache
	`# User configuration management utilities `
	vcsh
	myrepos
	`# Editors, pagers, and documentation readers `
	bvi
	less
	vbindiff
	vim
	wdiff
	`# Version control systems `
	git
	gitk
	`# Patch management utilities `
	patch
	quilt
	`# Build system utilities `
	autoconf
	automake
	pkg-config
	`# Build utilities `
	bison
	build-essential
	flex
	gdb
	`# Flashing utilities `
	flashrom
	`# Graphics and document utilities `
	imagemagick
	librsvg2-bin
	m4
	xcftools
	`# Networking utilities `
	dnsutils
	whois
	`# Network communication utilities `
	netcat-openbsd
	openssh-client
	openssh-server
	rsync
	`# DNS service discovery daemon and NSS module `
	avahi-daemon
	libnss-mdns
	`# Wi-Fi utilities `
	iw
	`# Time utilities `
	ntp
	`# System monitoring utilities `
	htop
	`# ALSA `
	alsa-base
	alsa-utils
	`# CUPS, etc. `
	cups
	printer-driver-hpcups
	system-config-printer
	`# X.org X server, drivers, and utilities `
	x11-xserver-utils
	xinput
	xorg
	xserver-xorg-input-evdev
	xserver-xorg-input-synaptics
	xserver-xorg-video-intel
	`# Window manager and panel `
	clipit
	compton
	fbpager
	fbpanel
	fluxbox
	`# Display manager, screensaver daemon, etc. `
	scrot
	xdm
	xscreensaver
	`# Desktop artwork, utilities, etc. `
	desktop-base
	xdg-utils
	`# GNOME themes `
	gnome-themes-standard
	`# Terminal utilities `
	minicom
	roxterm-gtk3
	screen
	`# Ergonomics applications `
	gtk-redshift
	`# Image, font, and tileset viewers and editors `
	gimp
	gpicview
	inkscape
	`# Mathematics applications `
	gnome-calculator
	units
	`# Office, productivity, and accounting applications `
	evince
	`# Solid CAD applications `
	meshlab
	openscad
	`# CAM applications `
	printrun
	slic3r
	`# Font families `
	fonts-dejavu
	fonts-droid-fallback
	fonts-freefont-ttf
	fonts-lato
	fonts-liberation
	fonts-linuxlibertine
	fonts-mplus
	fonts-ubuntu-title
	ttf-unifont
	"

do_postinst()
{
	# Make swap file and set vm.swappiness.
	# mkswap needs to be given the full path to the swap file including the
	# root file system's mount point, or else this false error happens:
	#   mkswap: error: /var/swap is mounted; will not make swapspace
	fallocate -l 4GiB "${target}/var/swap" || return 1
	chmod 0600 "${target}/var/swap" || return 1
	mkswap "${target}/var/swap" || return 1
	printf 'vm.swappiness = 10\n' \
		>"${target}/etc/sysctl.d/vm-swappiness.conf"

	# Add "deb-src" line and sid.
	cat >"${target}/etc/apt/sources.list" <<-EOF
		deb http://httpredir.debian.org/debian stretch main
		deb-src http://httpredir.debian.org/debian stretch main
		deb http://httpredir.debian.org/debian sid main
		deb-src http://httpredir.debian.org/debian sid main
		EOF
	cat >"${target}/etc/apt/apt.conf" <<-EOF
		APT::Default-Release "stretch";
		EOF
	in_target apt-get update || return 1

	# Install wicd (removed from stretch/testing due to bug #816076, and
	# also orphaned by bug #801253).
	in_target apt-get -q -y install \
		wicd-daemon/sid wicd-gtk/sid wicd-curses/sid wicd-cli/sid

	# Purge systemd.
	in_target apt-get -q -y purge libpam-systemd systemd || return 1
	in_target apt-get -q -y --purge autoremove || return 1

	# Remove packages from APT cache.
	in_target apt-get clean || return 1

	# Install Vertex themes.
	in_target apt-get -q -y install gnome-themes-standard \
		gtk2-engines-murrine libgtk-3-dev
	in_target sudo -u cam sh <<-EOF
		set -e
		git clone https://github.com/horst3180/vertex-theme \
			/home/cam/src/vertex-theme/
		cd /home/cam/src/vertex-theme/
		./autogen.sh --prefix=/home/cam/.local
		make install
		ln -s .local/share/themes/ /home/cam/.themes
		EOF
	[ ${?} -ne 0 ] && return 1

	# Download wallpaper.
	in_target sudo -u cam wget -O /home/cam/.wallpaper \
		http://product-files.libiquity.com/taurinus/boot-splash/x200/background.png

	# Use temporary configuation SSH key.
	install -d -o 1000 -g 1000 -m 0700 "${target}/home/cam/.ssh" || return 1
	cat >"${target}/home/cam/.ssh/id_rsa" <<-EOF
		-----BEGIN RSA PRIVATE KEY-----
		MIICXAIBAAKBgQCzAF0zqeS2X0TuVOIxqMec3lMzZy/MHQswPP+BQkmc2D3YVb2x
		px1YAAweQnfZ27pGJkDztStOtMQJeaOsnAVdm2NSe+hEdaKAOxf9p6t+F930HM/w
		1wkm1ddlsnCaaCipzGVOM77Q/brEItWvuq8G0+/fgN1o4pZzl4Bub/4D4QIDAQAB
		AoGAS+wKnAAiXuv3m7LrIa75w2JVHcdVcZicB0DICnYoLNtXF+v+AlzkSE/009zT
		YtccoeZVxEiCbuajA3XRY0PlzgGHTbsGn1BWqI9cjdXTiotnjzOH8zr3JiMZMWwf
		hqwbtleP+yruNPHMxQ8dKVXv875NKJW+aArmQWtjeMOy/vECQQDdsvPJ4bUu8M7/
		MXqGtz8CJbrRp+ZMKUw0WuwSwTfHRs/Jp27mWf5+t/u+RN8WK/RRD8FHvz4azLhr
		sNUFiE69AkEAzrI/DFBFOM5mUECujs2UvCCeWZiAi9QoJ7kDrrAkcG+hMalpNUU3
		SUZ76stBUk3hZNpc82aq0a0o8ac0VrBd9QJAB3nbYrlrxLN2J4Dhot1XEJl5HUzO
		JU9XNITEZTWCzgODSkeNI9NxE5DcumPUKgk9aeZgHC1EyN6ScX87D76y+QJAL8DE
		ii69X1toDeBzs7BRTYlnrCFsiWGRiWPYMvKk6IkRv6x5DwKXvEkZdexRghdWHHvK
		f71Xd6u+yt2rXN/QRQJBALv6SwbokdXp5qKJV48QG452dSOT7FQEINnCsIeNUKP6
		9YyaZxqLia6pEbEKTSRdztXaMqRsrmOG8E084sFg8DQ=
		-----END RSA PRIVATE KEY-----
		EOF
	in_target chown cam:cam '/home/cam/.ssh/id_rsa'
	in_target chmod 0600 '/home/cam/.ssh/id_rsa'

	# Set up SSH known hosts.
	cat >"${target}/home/cam/.ssh/known_hosts" <<-EOF
		|1|fypb7kn7NH0fqHGj9Xs/rdpO71s=|SCtg2BdMNB9zL5bAPYkJy1uiNSM= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcG5BuZi4947D9WqY1L6CzaH4Qjw7YA7Dja+09y0nZjLVDd1saZCPkTjo1PEHxVCvSHvc0VmRqIZ2wUGtuqIlgGPMphCPAtdHN63YcNXqIhjEygLsaSZgy1Qz33YQF+YSANbeZQ4vnqiYr3C1IA7Cw4km/0s1BvP3t9yJf/iYODZqjVqUhqB4hzXJcBZHrgnM4LmPD4NH81fCqpwfRviNQNFAqd/aT1YTvgdn46HTVz7dV8ahW6SLXBTJZvO9dLAAKOPPZwuluaRphBqjPLC83zsihQ884SAH+AKcpN1ne73UZUuA1Gyk3HW+a/ngbzm1nmoeC0Sm1nNlTvC4WrLD
		|1|z7it+otnWcn/98YKdeaBCXl+ug8=|NFRpdQZBMTAuWbUDAqXLptFR5Ao= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcG5BuZi4947D9WqY1L6CzaH4Qjw7YA7Dja+09y0nZjLVDd1saZCPkTjo1PEHxVCvSHvc0VmRqIZ2wUGtuqIlgGPMphCPAtdHN63YcNXqIhjEygLsaSZgy1Qz33YQF+YSANbeZQ4vnqiYr3C1IA7Cw4km/0s1BvP3t9yJf/iYODZqjVqUhqB4hzXJcBZHrgnM4LmPD4NH81fCqpwfRviNQNFAqd/aT1YTvgdn46HTVz7dV8ahW6SLXBTJZvO9dLAAKOPPZwuluaRphBqjPLC83zsihQ884SAH+AKcpN1ne73UZUuA1Gyk3HW+a/ngbzm1nmoeC0Sm1nNlTvC4WrLD
		EOF
	in_target chown cam:cam '/home/cam/.ssh/known_hosts'
	in_target chmod 0600 '/home/cam/.ssh/known_hosts'

	# Bootstrap vcsh and mr.
	rm -f "${target}/home/cam/.profile" "${target}/home/cam/.bashrc" \
		"${target}/home/cam/.bash_logout"
	in_target sudo -u cam vcsh clone \
		ssh://git@git.pehjota.net/dotfiles/mr.git mr || return 1
	in_target sudo -u cam mr update || return 1
	in_target sudo -u cam /home/cam/bin/dfen clipit fluxbox \
		gpicview gimp gtk redshift roxterm \
		xdg-user-dirs xscreensaver

	# Create XDG directories.
	sed 's/#.*$//; /^$/d;' "${target}/home/cam/.config/user-dirs.dirs" | \
		while IFS='=' read var val; do
			HOME='/home/cam'
			eval "mkdir '${target}/'${val}"
		done

	# Generate target's SSH keypair.
	#rm -f "${target}/home/cam/.ssh/id_rsa" \
	#	"${target}/home/cam/.ssh/id_rsa.pub" || return 1
	#install -o 1000 -g 1000 -m 0600 '/home/pj/.ssh/id_rsa' \
	#	"${target}/home/cam/.ssh/id_rsa" || return 1
	#install -o 1000 -g 1000 -m 0600 '/home/pj/.ssh/id_rsa.pub' \
	#	"${target}/home/cam/.ssh/id_rsa.pub" || return 1
	#in_target ssh-keygen -b 4096 -C cam@cam1 -t rsa \
	#	-f /home/cam/.ssh/id_rsa </dev/null || return 1
	#cp "${target}/home/cam/.ssh/id_rsa.pub" 'cam@cam1.pub' || return 1

	return 0
}