defaults.sh 27.1 KB
Newer Older
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.

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
New_configuration ()
{
	## Runtime

	# Image: Architecture
	if [ -x "/usr/bin/dpkg" ]
	then
		CURRENT_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)"
	else
		case "$(uname -m)" in
			x86_64)
				CURRENT_IMAGE_ARCHITECTURE="amd64"
				;;

			i?86)
				CURRENT_IMAGE_ARCHITECTURE="i386"
				;;

			*)
				Echo_warning "Unable to determine current architecture, using ${CURRENT_IMAGE_ARCHITECTURE}"
				;;
		esac
	fi


	## Configuration

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

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

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

	# Image: Archive Areas
54
	LIVE_IMAGE_ARCHIVE_AREAS="${LIVE_IMAGE_ARCHIVE_AREAS:-$(Get_configuration config/build Archive-Areas)}"
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

	case "${LB_MODE}" in
		progress-linux)
			LIVE_IMAGE_ARCHIVE_AREAS="${LIVE_IMAGE_ARCHIVE_AREAS:-main contrib non-free}"
			;;

		ubuntu)
			LIVE_IMAGE_ARCHIVE_AREAS="${LIVE_IMAGE_ARCHIVE_AREAS:-main restricted}"
			;;

		*)
			LIVE_IMAGE_ARCHIVE_AREAS="${LIVE_IMAGE_ARCHIVE_AREAS:-main}"
			;;
	esac

	export LIVE_IMAGE_ARCHIVE_AREAS

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

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

83
84
Set_defaults ()
{
85
86
87
	# FIXME
	New_configuration

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
124

125
	# Setting distribution name
126
	case "${LB_MODE}" in
127
		progress-linux)
128
			LB_DISTRIBUTION="${LB_DISTRIBUTION:-baureo}"
129
			LB_DERIVATIVE="true"
130
			;;
131

132
		ubuntu)
133
			LB_DISTRIBUTION="${LB_DISTRIBUTION:-quantal}"
134
			LB_DERIVATIVE="false"
135
			;;
136

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

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

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

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

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

			LB_BACKPORTS="${LB_BACKPORTS:-false}"
165
166
			;;
	esac
167

168
	# Setting package manager
169
	LB_APT="${LB_APT:-apt}"
170

171
	# Setting apt ftp proxy
172
	LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
173
174

	# Setting apt http proxy
175
	LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
176
177

	# Setting apt pipeline
178
	# LB_APT_PIPELINE
179

180
181
182
	APT_OPTIONS="${APT_OPTIONS:---yes}"
	APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"

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

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

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

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

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

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

198
	# Setting apt recommends
199
	case "${LB_MODE}" in
200
		progress-linux)
201
			LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-false}"
202
203
			;;

204
205
		*)
			LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
206
207
			;;
	esac
208

209
	# Setting apt secure
210
	LB_APT_SECURE="${LB_APT_SECURE:-true}"
211

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

		*)
			LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-true}"
			;;
	esac

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

	# Setting cache option
236
237
238
239
	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}"
240
241

	# Setting debconf frontend
242
243
	LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
	LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
244

245
	# Setting initramfs hook
246
247
	case "${LB_SYSTEM}" in
		live)
248
			case "${LB_MODE}" in
249
				ubuntu)
250
					LB_INITRAMFS="${LB_INITRAMFS:-casper}"
251
252
					;;

253
				*)
254
					LB_INITRAMFS="${LB_INITRAMFS:-live-boot}"
255
256
					;;
			esac
257
258
			;;

259
260
		normal)
			LB_INITRAMFS="${LB_INITRAMFS:-none}"
261
262
			;;
	esac
263

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

266
267
	# Setting initsystem
	case "${LB_MODE}" in
268
		ubuntu)
269
270
271
272
273
274
275
			case "${LB_INITRAMFS}" in
				live-boot)
					LB_INITSYSTEM="${LB_INITSYSTEM:-upstart}"
					;;
			esac
			;;

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

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

288
		*)
289
290
291
292
293
294
295
296
297
			case "${LB_SYSTEM}" in
				live)
					LB_INITSYSTEM="${LB_INITSYSTEM:-sysvinit}"
					;;

				normal)
					LB_INITSYSTEM="${LB_INITSYSTEM:-none}"
					;;
			esac
298
299
300
			;;
	esac

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

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

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

341
	# Setting tasksel
342
	LB_TASKSEL="${LB_TASKSEL:-apt}"
343

344
	# Setting root directory
345
	case "${LB_MODE}" in
346
		progress-linux)
347
348
			LB_ROOT="${LB_ROOT:-progress-linux}"
			;;
349

350
351
352
353
		*)
			LB_ROOT="${LB_ROOT:-${LB_MODE}-live}"
			;;
	esac
354

355
	# Setting templates
356
	if [ -n "${LIVE_BUILD}" ]
357
358
359
360
361
	then
		LB_TEMPLATES="${LB_TEMPLATES:-${LIVE_BUILD}/templates}"
	else
		LB_TEMPLATES="${LB_TEMPLATES:-/usr/share/live/build/templates}"
	fi
362

363
	# Setting live build options
364
	_BREAKPOINTS="${_BREAKPOINTS:-false}"
365
	_COLOR="${_COLOR:-false}"
366
367
368
369
	_DEBUG="${_DEBUG:-false}"
	_FORCE="${_FORCE:-false}"
	_QUIET="${_QUIET:-false}"
	_VERBOSE="${_VERBOSE:-false}"
370
371
372

	## config/bootstrap

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

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

385
		ubuntu)
386
			case "${LIVE_IMAGE_ARCHITECTURE}" in
387
				amd64|i386)
388
					LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://archive.ubuntu.com/ubuntu/}"
389
390
391
					;;

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

396
			LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
397
398
			;;
	esac
399

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

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

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

415
		ubuntu)
416
			case "${LIVE_IMAGE_ARCHITECTURE}" in
417
				amd64|i386)
418
					LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.ubuntu.com/ubuntu/}"
419
					;;
420

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

426
			LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
427
428
			;;
	esac
429

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

437
		progress-linux)
438
			LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-http://ftp.debian.org/debian/}"
439
			LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-${LB_MIRROR_CHROOT}}"
440
			;;
441

442
		ubuntu)
443
			case "${LIVE_IMAGE_ARCHITECTURE}" in
444
				amd64|i386)
445
					LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://archive.ubuntu.com/ubuntu/}"
446
				;;
447
448

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

453
			LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
454
455
			;;
	esac
456

457
	# Setting security mirror which ends up in the image
458
459
	case "${LB_MODE}" in
		debian)
460
461
			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}}"
462
			;;
463

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

469
		ubuntu)
470
			case "${LIVE_IMAGE_ARCHITECTURE}" in
471
				amd64|i386)
472
					LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.ubuntu.com/ubuntu/}"
473
					;;
474

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

480
			LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
481
482
			;;
	esac
483

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

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

	## config/chroot

498
	# Setting chroot filesystem
499
	LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
500

501
	# Setting union filesystem
502
	LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-aufs}"
503

504
	# Setting interactive shell/X11/Xnest
505
	LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
506

507
	# Setting keyring packages
508
	case "${LB_MODE}" in
509
		ubuntu)
510
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
511
512
			;;

513
		*)
514
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
515
			;;
516
	esac
517
518

	# Setting linux flavour string
519
	case "${LIVE_IMAGE_ARCHITECTURE}" in
520
		armel)
521
			case "${LB_MODE}" in
522
                                ubuntu)
523
524
525
526
527
528
529
530
					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
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x ixp4xx kirkwood orion5x versatile}"
					;;
			esac
531
			;;
532

533
534
535
536
537
538
		armhf)
			# armhf will have special images: one rootfs image and many additional kernel images.
			# therefore we default to all available armel flavours
			LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-mx5 omap}"
			;;

539
540
		amd64)
			case "${LB_MODE}" in
541
				ubuntu)
542
543
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
					;;
544

545
546
547
548
549
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
					;;
			esac
			;;
550

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

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

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

569
				*)
570
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-486}"
571
572
573
					;;
			esac
			;;
574

575
576
		ia64)
			case "${LB_MODE}" in
577
				progress-linux)
578
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
579
580
					exit 1
					;;
581

582
583
584
585
586
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-itanium}"
					;;
			esac
			;;
587

588
589
		powerpc)
			case "${LB_MODE}" in
590
				progress-linux)
591
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
592
593
594
					exit 1
					;;

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

599
				*)
600
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc64 powerpc}"
601
602
603
					;;
			esac
			;;
604

605
		s390x)
606
			case "${LB_MODE}" in
607
				progress-linux|ubuntu)
608
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
609
610
					exit 1
					;;
611

612
				*)
613
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-s390x}"
614
615
616
					;;
			esac
			;;
617

618
619
		sparc)
			case "${LB_MODE}" in
620
				progress-linux)
621
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
622
623
					exit 1
					;;
624

625
626
627
628
629
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-sparc64}"
					;;
			esac
			;;
630

631
		*)
632
			Echo_error "Architecture(s) ${LIVE_IMAGE_ARCHITECTURE} not yet supported (FIXME)"
633
634
635
636
637
			exit 1
			;;
	esac

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

		*)
644
			LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
645
646
647
			;;
	esac

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

		*)
			LB_SECURITY="${LB_SECURITY:-true}"
			;;
	esac
658

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

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

670
671
	## config/binary

672
	# Setting image filesystem
673
	case "${LIVE_IMAGE_ARCHITECTURE}" in
674
		sparc)
675
			LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-ext4}"
676
			;;
677

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

683
	# Setting image type
684
	case "${LIVE_IMAGE_ARCHITECTURE}" in
685
		amd64|i386)
686
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
687
688
689
			;;

		*)
690
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso}"
691
692
			;;
	esac
693
694

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

		*)
701
			LB_APT_INDICES="${LB_APT_INDICES:-true}"
702
703
			;;
	esac
704

705
	# Setting bootloader
706
	if [ -z "${LB_BOOTLOADER}" ]
707
	then
708
		case "${LIVE_IMAGE_ARCHITECTURE}" in
709
			amd64|i386)
710
				LB_BOOTLOADER="syslinux"
711
712
713
714
				;;
		esac
	fi

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

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

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

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

732
	# Setting chroot option
733
	LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
734

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

737
	# Setting debian-installer option
738
	LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-false}"
739

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

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

748
		*)
749
			LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-false}"
750
751
752
			;;
	esac

753
	# Setting debian-installer preseed filename
754
	if [ -z "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
755
	then
756
		if Find_files config/debian-installer/preseed.cfg
757
		then
758
			LB_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
759
760
		fi

761
		if Find_files config/debian-installer/*.cfg && [ ! -e config/debian-installer/preseed.cfg ]
762
		then
763
			Echo_warning "You have placed some preseeding files into config/debian-installer but you didn't specify the default preseeding file through LB_DEBIAN_INSTALLER_PRESEEDFILE. This means that debian-installer will not take up a preseeding file by default."
764
765
766
767
		fi
	fi

	# Setting boot parameters
768
769
	case "${LB_INITRAMFS}" in
		live-boot)
770
771
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=live components quiet splash}"
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
772
			;;
773

774
		casper)
775
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=casper quiet splash}"
776
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=casper memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
777
778
			;;

779
		none)
780
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-quiet splash}"
781
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
782
783
784
			;;
	esac

785
	if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
786
	then
787
		case "${LIVE_IMAGE_TYPE}" in
788
			iso*)
789
				_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
790
791
				;;

792
			hdd*)
793
				case "${LB_MODE}" in
794
					ubuntu)
795
796
797
798
799
800
801
802
803
804
805
806
						if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
						then
							_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
						else
							_LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
						fi
						;;

					*)
						_LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
						;;
				esac
807
808
				;;

809
			netboot)
810
				case "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" in
811
					*://*)
812
						_LB_BOOTAPPEND_PRESEED="file=${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
813
814
815
						;;

					*)
816
						_LB_BOOTAPPEND_PRESEED="file=/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
817
818
819
820
821
822
						;;
				esac
				;;
		esac
	fi

823
	if [ -n ${_LB_BOOTAPPEND_PRESEED} ]