defaults.sh 27.7 KB
Newer Older
1
2
#!/bin/sh

3
## live-build(7) - System Build Scripts
4
## Copyright (C) 2006-2013 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:-wheezy}"
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 distribution hooks
505
506
507
508
509
510
511
512
513
514
	LB_CHROOT_HOOKS="${LB_CHROOT_HOOKS:-disable-kexec-tools \
		remove-adjtime-configuration \
		remove-backup-files \
		remove-dbus-machine-id \
		remove-gnome-icon-cache \
		remove-log-files \
		remove-mdadm-configuration \
		remove-openssh-server-host-keys \
		remove-python-py \
		remove-temporary-files \
515
		remove-ssl-cert-snakeoil \
516
517
		remove-udev-persistent-cd-rules \
		remove-udev-persistent-net-rules \
518
		remove-systemd-machine-id \
519
520
521
522
523
		update-apt-file-cache \
		update-apt-xapian-index \
		update-glx-alternative \
		update-mlocate-database \
		update-nvidia-alternative}"
524
		#remove-apt-sources-lists
525

526
	# Setting interactive shell/X11/Xnest
527
	LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
528

529
	# Setting keyring packages
530
	case "${LB_MODE}" in
531
		ubuntu)
532
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
533
534
			;;

535
		*)
536
			LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
537
			;;
538
	esac
539
540

	# Setting linux flavour string
541
	case "${LIVE_IMAGE_ARCHITECTURE}" in
542
		armel)
543
			case "${LB_MODE}" in
544
                                ubuntu)
545
546
547
548
549
550
551
552
					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
553
			;;
554

555
556
557
558
559
560
		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}"
			;;

561
562
		amd64)
			case "${LB_MODE}" in
563
				ubuntu)
564
565
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
					;;
566

567
568
569
570
571
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
					;;
			esac
			;;
572

573
574
		i386)
			case "${LB_MODE}" in
575
				progress-linux)
576
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-686-pae}"
577
					;;
578

579
				ubuntu)
580
581
582
583
					case "${LB_DISTRIBUTION}" in
						precise)
							LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic-pae}"
							;;
584

585
586
587
588
						*)
							LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
							;;
					esac
589
					;;
590

591
				*)
592
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-486}"
593
594
595
					;;
			esac
			;;
596

597
598
		ia64)
			case "${LB_MODE}" in
599
				progress-linux)
600
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
601
602
					exit 1
					;;
603

604
605
606
607
608
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-itanium}"
					;;
			esac
			;;
609

610
611
		powerpc)
			case "${LB_MODE}" in
612
				progress-linux)
613
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
614
615
616
					exit 1
					;;

617
				ubuntu)
618
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc-smp powerpc64-smp e500 powerpc-e500mc}"
619
620
					;;

621
				*)
622
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc64 powerpc}"
623
624
625
					;;
			esac
			;;
626

627
		s390x)
628
			case "${LB_MODE}" in
629
				progress-linux|ubuntu)
630
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
631
632
					exit 1
					;;
633

634
				*)
635
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-s390x}"
636
637
638
					;;
			esac
			;;
639

640
641
		sparc)
			case "${LB_MODE}" in
642
				progress-linux)
643
					Echo_error "Architecture ${LIVE_IMAGE_ARCHITECTURE} not supported in the ${LB_MODE} mode."
644
645
					exit 1
					;;
646

647
648
649
650
651
				*)
					LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-sparc64}"
					;;
			esac
			;;
652

653
		*)
654
			Echo_error "Architecture(s) ${LIVE_IMAGE_ARCHITECTURE} not yet supported (FIXME)"
655
656
657
658
659
			exit 1
			;;
	esac

	# Set linux packages
660
	case "${LB_MODE}" in
661
		ubuntu)
662
			LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux}"
663
664
665
			;;

		*)
666
			LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
667
668
669
			;;
	esac

670
	# Setting security updates option
671
672
	case "${LB_PARENT_DISTRIBUTION}" in
		jessie|sid)
673
674
675
676
677
678
679
			LB_SECURITY="${LB_SECURITY:-false}"
			;;

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

681
	# Setting updates updates option
682
	case "${LB_PARENT_DISTRIBUTION}" in
683
		jessie|sid)
684
			LB_UPDATES="${LB_UPDATES:-false}"
685
686
687
			;;

		*)
688
			LB_UPDATES="${LB_UPDATES:-true}"
689
690
			;;
	esac
691

692
693
	## config/binary

694
	# Setting image filesystem
695
	case "${LIVE_IMAGE_ARCHITECTURE}" in
696
		sparc)
697
			LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-ext4}"
698
			;;
699

700
		*)
701
			LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-fat32}"
702
703
			;;
	esac
704

705
	# Setting image type
706
	case "${LIVE_IMAGE_ARCHITECTURE}" in
707
		amd64|i386)
708
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
709
710
711
			;;

		*)
712
			LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso}"
713
714
			;;
	esac
715
716

	# Setting apt indices
717
	case "${LB_MODE}" in
718
		progress-linux)
719
			LB_APT_INDICES="${LB_APT_INDICES:-false}"
720
721
722
			;;

		*)
723
			LB_APT_INDICES="${LB_APT_INDICES:-true}"
724
725
			;;
	esac
726

727
	# Setting bootloader
728
	if [ -z "${LB_BOOTLOADER}" ]
729
	then
730
		case "${LIVE_IMAGE_ARCHITECTURE}" in
731
			amd64|i386)
732
				LB_BOOTLOADER="syslinux"
733
734
735
736
				;;
		esac
	fi

737
	# Setting checksums
738
739
740
741
742
743
744
745
746
	case "${LB_MODE}" in
		progress-linux)
			LB_CHECKSUMS="${LB_CHECKSUMS:-sha256}"
			;;

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

748
	# Setting compression
749
	LB_COMPRESSION="${LB_COMPRESSION:-none}"
750

751
752
753
	# Setting zsync
	LB_ZSYNC="${LB_ZSYNC:-true}"

754
	# Setting chroot option
755
	LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
756

757
758
	LB_BUILD_WITH_TMPFS="${LB_BUILD_WITH_TMPFS:-false}"

759
	# Setting debian-installer option
760
	LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-false}"
761

762
	LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_DISTRIBUTION}}"
763

764
	# Setting debian-installer-gui
765
	case "${LB_MODE}" in
766
		debian|progress-linux)
767
			LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"
768
769
			;;

770
		*)
771
			LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-false}"
772
773
774
			;;
	esac

775
	# Setting debian-installer preseed filename
776
	if [ -z "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
777
	then
778
		if Find_files config/debian-installer/preseed.cfg
779
		then
780
			LB_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
781
782
		fi

783
		if Find_files config/debian-installer/*.cfg && [ ! -e config/debian-installer/preseed.cfg ]
784
		then
785
			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."
786
787
788
789
		fi
	fi

	# Setting boot parameters
790
791
792
	case "${LB_INITRAMFS}" in
		live-boot)
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=live config quiet splash}"
793
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=live config memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
794
			;;
795

796
		casper)
797
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=casper quiet splash}"
798
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=casper memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
799
800
			;;

801
		none)
802
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-quiet splash}"
803
			LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
804
805
806
			;;
	esac

807
	if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
808
	then
809
		case "${LIVE_IMAGE_TYPE}" in
810
			iso*)
811
				_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
812
813
				;;

814
			hdd*)
815
				case "${LB_MODE}" in
816
					ubuntu)
817
818
819
820
821
822
823
824
825
826
827
828
						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