defaults.sh 27 KB
Newer Older
Daniel Baumann's avatar
Daniel Baumann committed
1
2
#!/bin/sh

3
## live-build(7) - System Build Scripts
4
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
5
##
6
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7
8
9
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.

Daniel Baumann's avatar
Daniel Baumann committed
10

11
12
New_configuration ()
{
13
	## Runtime
14

15
16
	# Image: Architecture
	if [ -x "/usr/bin/dpkg" ]
17
	then
18
19
20
21
22
23
		CURRENT_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)"
	else
		case "$(uname -m)" in
			x86_64)
				CURRENT_IMAGE_ARCHITECTURE="amd64"
				;;
24

25
26
27
28
29
30
31
32
33
			i?86)
				CURRENT_IMAGE_ARCHITECTURE="i386"
				;;

			*)
				Echo_warning "Unable to determine current architecture, using ${CURRENT_IMAGE_ARCHITECTURE}"
				;;
		esac
	fi
34
35
36
37
38


	## Configuration

	# Configuration-Version
39
	LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-$(Get_configuration config/build Configuration-Version)}"
40
41
42
	LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
	export LIVE_CONFIGURATION_VERSION

43
	# Image: Name
44
	LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-$(Get_configuration config/build Name)}"
45
	LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-live-image}"
46
	export LIVE_IMAGE_NAME
47
48

	# Image: Architecture (FIXME: Support and default to 'any')
49
50
51
	LB_ARCHITECTURES="${LB_ARCHITECTURES:-$(Get_configuration config/build Architecture)}"
	LB_ARCHITECTURES="${LB_ARCHITECTURES:-${CURRENT_IMAGE_ARCHITECTURE}}"
	export LB_ARCHITECTURES
52

53
	# Image: Archive Areas
54
	LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-$(Get_configuration config/build Archive-Areas)}"
55
56
57

	case "${LB_MODE}" in
		progress-linux)
58
			LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main contrib non-free}"
59
60
61
			;;

		ubuntu)
62
			LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main restricted}"
63
64
65
			;;

		*)
66
			LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
67
68
69
			;;
	esac

70
	export LB_ARCHIVE_AREAS
71

72
	# Image: Archive Areas
73
	LIVE_IMAGE_PARENT_ARCHIVE_AREAS="${LIVE_IMAGE_PARENT_ARCHIVE_AREAS:-$(Get_configuration config/build Parent-Archive-Areas)}"
74
	LIVE_IMAGE_PARENT_ARCHIVE_AREAS="${LIVE_IMAGE_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
75
76
	export LIVE_IMAGE_PARENT_ARCHIVE_AREAS

77
	# Image: Type
78
	LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-$(Get_configuration config/build Type)}"
79
80
	LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
	export LIVE_IMAGE_TYPE
81
82
}

Daniel Baumann's avatar
Daniel Baumann committed
83
84
Set_defaults ()
{
85
86
87
	# FIXME
	New_configuration

Daniel Baumann's avatar
Daniel Baumann committed
88
89
	## config/common

90
91
	if [ -e local/live-build ]
	then
92
		LIVE_BUILD="${LIVE_BUILD:-${PWD}/local/live-build}"
93
		export LIVE_BUILD
94
	fi
95

96
	# Setting system type
97
	LB_SYSTEM="${LB_SYSTEM:-live}"
98

99
	# Setting mode (currently: debian, progress-linux, and ubuntu)
100
101
	if [ -x /usr/bin/lsb_release ]
	then
102
		_DISTRIBUTOR="$(lsb_release -is | tr "[A-Z]" "[a-z]")"
103
104

		case "${_DISTRIBUTOR}" in
105
			debian|progress-linux|ubuntu)
106
107
108
109
110
111
112
113
				LB_MODE="${LB_MODE:-${_DISTRIBUTOR}}"
				;;

			*)
				LB_MODE="${LB_MODE:-debian}"
				;;
		esac
	else
114
		if [ -e /etc/progress-linux_version ]
115
		then
116
			LB_MODE="${LB_MODE:-progress-linux}"
117
118
119
		elif [ -e /etc/ubuntu_version ]
		then
			LB_MODE="${LB_MODE:-ubuntu}"
120
121
		else
			LB_MODE="${LB_MODE:-debian}"
122
123
		fi
	fi
Daniel Baumann's avatar
Daniel Baumann committed
124

Daniel Baumann's avatar
Daniel Baumann committed
125
	# Setting distribution name
126
	case "${LB_MODE}" in
127
		progress-linux)
128
			LB_DISTRIBUTION="${LB_DISTRIBUTION:-baureo}"
129
			LB_DERIVATIVE="true"
130
			LB_DERIVATIVE_IS_BASED_ON="debian"
131
132
			;;

133
		ubuntu)
134
			LB_DISTRIBUTION="${LB_DISTRIBUTION:-quantal}"
135
			LB_DERIVATIVE="false"
136
			;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
137

138
		*)
139
			LB_DISTRIBUTION="${LB_DISTRIBUTION:-jessie}"
140
			LB_DERIVATIVE="false"
141
142
143
144
			;;
	esac

	case "${LB_MODE}" in
145
		progress-linux)
146
			case "${LB_DISTRIBUTION}" in
147
				baureo|baureo-backports)
148
149
150
151
					LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-wheezy}"
					LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
					;;

152
				charon|charon-backports)
153
					LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-sid}"
154
					LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
155
156
					;;
			esac
157
158

			LB_BACKPORTS="${LB_BACKPORTS:-true}"
159
160
161
162
			;;

		*)
			LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-${LB_DISTRIBUTION}}"
163
			LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
164
165

			LB_BACKPORTS="${LB_BACKPORTS:-false}"
166
167
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
168

Daniel Baumann's avatar
Daniel Baumann committed
169
	# Setting package manager
170
	LB_APT="${LB_APT:-apt}"
Daniel Baumann's avatar
Daniel Baumann committed
171

Daniel Baumann's avatar
Daniel Baumann committed
172
	# Setting apt ftp proxy
173
	LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
Daniel Baumann's avatar
Daniel Baumann committed
174
175

	# Setting apt http proxy
176
	LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
Daniel Baumann's avatar
Daniel Baumann committed
177

Daniel Baumann's avatar
Daniel Baumann committed
178
	# Setting apt pipeline
179
	# LB_APT_PIPELINE
Daniel Baumann's avatar
Daniel Baumann committed
180

Daniel Baumann's avatar
Daniel Baumann committed
181
182
183
	APT_OPTIONS="${APT_OPTIONS:---yes}"
	APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"

184
	BZIP2_OPTIONS="${BZIP2_OPTIONS:--6}"
185

186
	GZIP_OPTIONS="${GZIP_OPTIONS:--6}"
187

188
	if gzip --help | grep -qs "\-\-rsyncable"
189
	then
190
		GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
191
192
	fi

193
	LZIP_OPTIONS="${LZIP_OPTIONS:--6}"
194

195
	LZMA_OPTIONS="${LZMA_OPTIONS:--6}"
196

197
198
	XZ_OPTIONS="${XZ_OPTIONS:--6}"

Daniel Baumann's avatar
Daniel Baumann committed
199
	# Setting apt recommends
200
	case "${LB_MODE}" in
201
		progress-linux)
202
			LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-false}"
Daniel Baumann's avatar
Daniel Baumann committed
203
			;;
204
205
206
207

		*)
			LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
			;;
Daniel Baumann's avatar
Daniel Baumann committed
208
	esac
Daniel Baumann's avatar
Daniel Baumann committed
209

Daniel Baumann's avatar
Daniel Baumann committed
210
	# Setting apt secure
211
	LB_APT_SECURE="${LB_APT_SECURE:-true}"
Daniel Baumann's avatar
Daniel Baumann committed
212

213
	# Setting apt source
214
	case "${LB_MODE}" in
215
		progress-linux)
216
			LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-false}"
217
218
219
			;;

		*)
220
			LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-true}"
221
222
			;;
	esac
223

Daniel Baumann's avatar
Daniel Baumann committed
224
	# Setting bootstrap program
225
	if [ -z "${LB_BOOTSTRAP}" ] || ( [ ! -x "$(which ${LB_BOOTSTRAP} 2>/dev/null)" ] && [ "${LB_BOOTSTRAP}" != "copy" ] )
Daniel Baumann's avatar
Daniel Baumann committed
226
	then
Daniel Baumann's avatar
Daniel Baumann committed
227
228
		if [ -x "/usr/sbin/debootstrap" ]
		then
229
			LB_BOOTSTRAP="debootstrap"
Daniel Baumann's avatar
Daniel Baumann committed
230
231
		elif [ -x "/usr/bin/cdebootstrap" ]
		then
232
			LB_BOOTSTRAP="cdebootstrap"
Daniel Baumann's avatar
Daniel Baumann committed
233
		fi
Daniel Baumann's avatar
Daniel Baumann committed
234
235
236
	fi

	# Setting cache option
237
238
239
240
	LB_CACHE="${LB_CACHE:-true}"
	LB_CACHE_INDICES="${LB_CACHE_INDICES:-false}"
	LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES:-true}"
	LB_CACHE_STAGES="${LB_CACHE_STAGES:-bootstrap}"
Daniel Baumann's avatar
Daniel Baumann committed
241
242

	# Setting debconf frontend
243
244
	LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
	LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
Daniel Baumann's avatar
Daniel Baumann committed
245

Daniel Baumann's avatar
Daniel Baumann committed
246
	# Setting initramfs hook
247
248
	case "${LB_SYSTEM}" in
		live)
249
			case "${LB_MODE}" in
250
				ubuntu)
251
					LB_INITRAMFS="${LB_INITRAMFS:-casper}"
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
252
253
					;;

Daniel Baumann's avatar
Daniel Baumann committed
254
				*)
255
					LB_INITRAMFS="${LB_INITRAMFS:-live-boot}"
Daniel Baumann's avatar
Daniel Baumann committed
256
					;;
Daniel Baumann's avatar
Daniel Baumann committed
257
			esac
258
259
			;;

260
261
		normal)
			LB_INITRAMFS="${LB_INITRAMFS:-none}"
262
263
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
264

265
266
	LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"

267
	# Setting initsystem
Marco Amadori's avatar
Marco Amadori committed
268
	case "${LB_MODE}" in
269
		ubuntu)
270
271
272
273
274
			case "${LB_INITRAMFS}" in
				live-boot)
					LB_INITSYSTEM="${LB_INITSYSTEM:-upstart}"
					;;
			esac
Marco Amadori's avatar
Marco Amadori committed
275
			;;
276

277
		progress-linux)
278
279
280
281
282
283
284
285
286
			case "${LB_DISTRIBUTION}" in
				chairon*)
					LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
					;;

				*)
					LB_INITSYSTEM="${LB_INITSYSTEM:-sysvinit}"
					;;
			esac
287
288
			;;

289
		*)
290
291
			case "${LB_SYSTEM}" in
				live)
Daniel Baumann's avatar
Daniel Baumann committed
292
					LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
293
294
295
296
297
298
					;;

				normal)
					LB_INITSYSTEM="${LB_INITSYSTEM:-none}"
					;;
			esac
299
			;;
Marco Amadori's avatar
Marco Amadori committed
300
	esac
301

302
	# Setting fdisk
303
	if [ -z "${LB_FDISK}" ] || [ ! -x "${LB_FDISK}" ]
304
305
306
307
308
	then
		# Workaround for gnu-fdisk divertion
		# (gnu-fdisk is buggy, #445304).
		if [ -x /sbin/fdisk.distrib ]
		then
309
			LB_FDISK="fdisk.distrib"
310
311
		elif [ -x /sbin/fdisk ]
		then
312
			LB_FDISK="fdisk"
313
		else
314
			Echo_error "Can't process file /sbin/fdisk"
315
316
317
		fi
	fi

Daniel Baumann's avatar
Daniel Baumann committed
318
	# Setting losetup
319
	if [ -z "${LB_LOSETUP}" ] || [ "${LB_LOSETUP}" != "/sbin/losetup.orig" ]
Daniel Baumann's avatar
Daniel Baumann committed
320
	then
Daniel Baumann's avatar
Daniel Baumann committed
321
		# Workaround for loop-aes-utils divertion
322
		# (loop-aes-utils' losetup lacks features).
Daniel Baumann's avatar
Daniel Baumann committed
323
324
		if [ -x /sbin/losetup.orig ]
		then
325
			LB_LOSETUP="losetup.orig"
Daniel Baumann's avatar
Daniel Baumann committed
326
327
		elif [ -x /sbin/losetup ]
		then
328
			LB_LOSETUP="losetup"
Daniel Baumann's avatar
Daniel Baumann committed
329
		else
330
			Echo_error "Can't process file /sbin/losetup"
Daniel Baumann's avatar
Daniel Baumann committed
331
		fi
Daniel Baumann's avatar
Daniel Baumann committed
332
333
	fi

334
	if [ "${LB_ARCHITECTURES}" = "i386" ] && [ "${CURRENT_IMAGE_ARCHITECTURE}" = "amd64" ]
335
	then
336
		# Use linux32 when building amd64 images on i386
337
338
339
		_LINUX32="linux32"
	else
		_LINUX32=""
340
341
	fi

Daniel Baumann's avatar
Daniel Baumann committed
342
	# Setting tasksel
343
	LB_TASKSEL="${LB_TASKSEL:-apt}"
Daniel Baumann's avatar
Daniel Baumann committed
344

Daniel Baumann's avatar
Daniel Baumann committed
345
	# Setting root directory
346
	case "${LB_MODE}" in
347
		progress-linux)
348
349
350
			LB_ROOT="${LB_ROOT:-progress-linux}"
			;;

351
352
353
354
		*)
			LB_ROOT="${LB_ROOT:-${LB_MODE}-live}"
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
355

Daniel Baumann's avatar
Daniel Baumann committed
356
	# Setting templates
357
	if [ -n "${LIVE_BUILD}" ]
358
359
360
361
362
	then
		LB_TEMPLATES="${LB_TEMPLATES:-${LIVE_BUILD}/templates}"
	else
		LB_TEMPLATES="${LB_TEMPLATES:-/usr/share/live/build/templates}"
	fi
Daniel Baumann's avatar
Daniel Baumann committed
363

364
	# Setting live build options
365
	_BREAKPOINTS="${_BREAKPOINTS:-false}"
366
	_COLOR="${_COLOR:-false}"
367
368
369
370
	_DEBUG="${_DEBUG:-false}"
	_FORCE="${_FORCE:-false}"
	_QUIET="${_QUIET:-false}"
	_VERBOSE="${_VERBOSE:-false}"
Daniel Baumann's avatar
Daniel Baumann committed
371
372
373

	## config/bootstrap

Daniel Baumann's avatar
Daniel Baumann committed
374
	# Setting mirror to fetch packages from
375
	case "${LB_MODE}" in
376
		debian)
377
			LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
378
			LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
379
			;;
Daniel Baumann's avatar
Daniel Baumann committed
380

381
		progress-linux)
382
			LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
383
			LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://cdn.archive.progress-linux.org/packages/}"
384
385
			;;

386
		ubuntu)
387
			case "${LB_ARCHITECTURES}" in
388
				amd64|i386)
389
					LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://archive.ubuntu.com/ubuntu/}"
390
					;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
391

392
				*)
393
					LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://ports.ubuntu.com/ubuntu-ports/}"
394
395
					;;
			esac
396

397
			LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
398
399
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
400

401
	LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT:-${LB_PARENT_MIRROR_BOOTSTRAP}}"
402
	LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT:-${LB_MIRROR_BOOTSTRAP}}"
403

Daniel Baumann's avatar
Daniel Baumann committed
404
	# Setting security mirror to fetch packages from
405
	case "${LB_MODE}" in
406
		debian)
407
			LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
408
			LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
409
			;;
Daniel Baumann's avatar
Daniel Baumann committed
410

411
		progress-linux)
412
			LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
413
			LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT}}"
414
415
			;;

416
		ubuntu)
417
			case "${LB_ARCHITECTURES}" in
418
				amd64|i386)
419
					LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.ubuntu.com/ubuntu/}"
420
					;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
421

422
				*)
423
					LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://ports.ubuntu.com/ubuntu-ports/}"
424
425
					;;
			esac
426

427
			LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
428
429
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
430

Daniel Baumann's avatar
Daniel Baumann committed
431
	# Setting mirror which ends up in the image
432
	case "${LB_MODE}" in
433
		debian)
434
			LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://http.debian.net/debian/}"
435
			LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
436
437
			;;

438
		progress-linux)
439
			LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-http://ftp.debian.org/debian/}"
440
			LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-${LB_MIRROR_CHROOT}}"
441
			;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
442

443
		ubuntu)
444
			case "${LB_ARCHITECTURES}" in
445
				amd64|i386)
446
					LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://archive.ubuntu.com/ubuntu/}"
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
447
				;;
448
449

				*)
450
					LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://ports.ubuntu.com/ubuntu-ports/}"
451
452
					;;
			esac
453

454
			LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
455
456
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
457

Daniel Baumann's avatar
Daniel Baumann committed
458
	# Setting security mirror which ends up in the image
459
	case "${LB_MODE}" in
460
		debian)
461
462
			LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
			LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
463
			;;
Daniel Baumann's avatar
Daniel Baumann committed
464

465
		progress-linux)
466
			LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
467
			LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-${LB_MIRROR_CHROOT}}"
468
469
			;;

470
		ubuntu)
471
			case "${LB_ARCHITECTURES}" in
472
				amd64|i386)
473
					LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.ubuntu.com/ubuntu/}"
474
					;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
475

476
				*)
477
					LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://ports.ubuntu.com/ubuntu-ports/}"
478
479
					;;
			esac
480

481
			LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
482
483
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
484

485
	case "${LB_MODE}" in
486
		progress-linux)
487
			LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
488
489
490
491
			LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
			;;

		*)
492
			LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
493
			LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_PARENT_MIRROR_CHROOT}}"
494
495
			;;
	esac
496

Daniel Baumann's avatar
Daniel Baumann committed
497
498
	## config/chroot

Daniel Baumann's avatar
Daniel Baumann committed
499
	# Setting chroot filesystem
500
	LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
Daniel Baumann's avatar
Daniel Baumann committed
501

Daniel Baumann's avatar
Daniel Baumann committed
502
	# Setting union filesystem
503
	LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-aufs}"
Daniel Baumann's avatar
Daniel Baumann committed
504

Daniel Baumann's avatar
Daniel Baumann committed
505
	# Setting interactive shell/X11/Xnest
506
	LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
Daniel Baumann's avatar
Daniel Baumann committed
507

Daniel Baumann's avatar
Daniel Baumann committed
508
	# Setting keyring packages
509
	case "${LB_MODE}" in
510
		ubuntu)
511
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
Daniel Baumann's avatar
Daniel Baumann committed
512
			;;
Daniel Baumann's avatar
Daniel Baumann committed
513

514
		*)
515
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
Daniel Baumann's avatar
Daniel Baumann committed
516
			;;
Daniel Baumann's avatar
Daniel Baumann committed
517
	esac
Daniel Baumann's avatar
Daniel Baumann committed
518
519

	# Setting linux flavour string
520
	case "${LB_ARCHITECTURES}" in
521
		armel)
522
			case "${LB_MODE}" in
523
                                ubuntu)
524
525
526
527
528
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-omap}"
					;;
				*)
					# armel will have special images: one rootfs image and many additional kernel images.
					# therefore we default to all available armel flavours
Daniel Baumann's avatar
Daniel Baumann committed
529
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-ixp4xx kirkwood orion5x versatile}"
530
531
					;;
			esac
532
			;;
533

534
535
		armhf)
			# armhf will have special images: one rootfs image and many additional kernel images.
536
			# therefore we default to all available armhf flavours
Daniel Baumann's avatar
Daniel Baumann committed
537
			LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-armmp armmp-lpae}"
538
539
			;;

540
541
		amd64)
			case "${LB_MODE}" in
542
				ubuntu)
543
544
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
					;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
545

546
547
548
549
550
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
					;;
			esac
			;;
Daniel Baumann's avatar
Daniel Baumann committed
551

552
553
		i386)
			case "${LB_MODE}" in
554
				progress-linux)
555
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-686-pae}"
556
557
					;;

558
				ubuntu)
559
560
561
562
					case "${LB_DISTRIBUTION}" in
						precise)
							LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic-pae}"
							;;
563

564
565
566
567
						*)
							LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
							;;
					esac
568
					;;
569

570
				*)
571
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-486}"
572
573
574
					;;
			esac
			;;
Daniel Baumann's avatar
Daniel Baumann committed
575

576
		ia64)
577
			case "${LB_MODE}" in
578
				progress-linux)
579
					Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
580
581
582
583
584
585
586
					exit 1
					;;

				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-itanium}"
					;;
			esac
587
			;;
588

589
		powerpc)
590
			case "${LB_MODE}" in
591
				progress-linux)
592
					Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
593
594
					exit 1
					;;
Daniel Baumann's avatar
Daniel Baumann committed
595

596
				ubuntu)
597
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc-smp powerpc64-smp e500 powerpc-e500mc}"
598
599
					;;

600
				*)
601
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc64 powerpc}"
602
603
604
					;;
			esac
			;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
605

606
		s390x)
607
			case "${LB_MODE}" in
608
				progress-linux|ubuntu)
609
					Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
610
611
					exit 1
					;;
Daniel Baumann's avatar
Daniel Baumann committed
612

613
				*)
614
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-s390x}"
615
616
617
					;;
			esac
			;;
Daniel Baumann's avatar
Daniel Baumann committed
618

619
		sparc)
620
			case "${LB_MODE}" in
621
				progress-linux)
622
					Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
623
624
625
626
627
628
629
					exit 1
					;;

				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-sparc64}"
					;;
			esac
630
631
632
			;;

		*)
633
			Echo_error "Architecture(s) ${LB_ARCHITECTURES} not yet supported (FIXME)"
634
635
636
			exit 1
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
637

Daniel Baumann's avatar
Daniel Baumann committed
638
	# Set linux packages
639
	case "${LB_MODE}" in
640
		ubuntu)
641
642
			LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux}"
			;;
Daniel Baumann's avatar
Daniel Baumann committed
643

644
		*)
645
			LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
646
647
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
648
649

	# Setting security updates option
650
651
	case "${LB_PARENT_DISTRIBUTION}" in
		jessie|sid)
652
653
654
655
656
657
658
			LB_SECURITY="${LB_SECURITY:-false}"
			;;

		*)
			LB_SECURITY="${LB_SECURITY:-true}"
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
659

660
	# Setting updates updates option
661
	case "${LB_PARENT_DISTRIBUTION}" in
662
		jessie|sid)
663
			LB_UPDATES="${LB_UPDATES:-false}"
664
665
666
			;;

		*)
667
			LB_UPDATES="${LB_UPDATES:-true}"
668
669
			;;
	esac
670

Daniel Baumann's avatar
Daniel Baumann committed
671
672
	## config/binary

673
	# Setting image filesystem
674
	case "${LB_ARCHITECTURES}" in
675
		sparc)
676
			LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-ext4}"
677
			;;
Cody A.W. Somerville's avatar
Cody A.W. Somerville committed
678

679
		*)
680
			LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-fat32}"
681
682
			;;
	esac
683

Daniel Baumann's avatar
Daniel Baumann committed
684
	# Setting image type
685
	case "${LB_ARCHITECTURES}" in
686
		amd64|i386)
687
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
688
689
690
			;;

		*)
691
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso}"
692
693
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
694
695

	# Setting apt indices
696
	case "${LB_MODE}" in
697
		progress-linux)
698
			LB_APT_INDICES="${LB_APT_INDICES:-false}"
699
700
701
			;;

		*)
702
			LB_APT_INDICES="${LB_APT_INDICES:-true}"
703
704
			;;
	esac
Daniel Baumann's avatar
Daniel Baumann committed
705

Daniel Baumann's avatar
Daniel Baumann committed
706
	# Setting bootloader
707
	if [ -z "${LB_BOOTLOADER}" ]
Daniel Baumann's avatar
Daniel Baumann committed
708
	then
709
		case "${LB_ARCHITECTURES}" in
710
			amd64|i386)
711
				LB_BOOTLOADER="syslinux"
Daniel Baumann's avatar
Daniel Baumann committed
712
713
714
715
				;;
		esac
	fi

716
	# Setting checksums
717
718
719
720
721
722
723
724
725
	case "${LB_MODE}" in
		progress-linux)
			LB_CHECKSUMS="${LB_CHECKSUMS:-sha256}"
			;;

		*)
			LB_CHECKSUMS="${LB_CHECKSUMS:-md5}"
			;;
	esac
726

727
	# Setting compression
728
	LB_COMPRESSION="${LB_COMPRESSION:-none}"
729

730
731
732
	# Setting zsync
	LB_ZSYNC="${LB_ZSYNC:-true}"

Daniel Baumann's avatar
Daniel Baumann committed
733
	# Setting chroot option
734
	LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
Daniel Baumann's avatar
Daniel Baumann committed
735

736
737
	LB_BUILD_WITH_TMPFS="${LB_BUILD_WITH_TMPFS:-false}"

Daniel Baumann's avatar
Daniel Baumann committed
738
	# Setting debian-installer option
739
	LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-false}"
Daniel Baumann's avatar
Daniel Baumann committed
740

741
	LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_DISTRIBUTION}}"
742

743
	# Setting debian-installer-gui
744
	case "${LB_MODE}" in
745
		debian|progress-linux)
746
			LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"