Dropping automagics for casper.
[debian-live-build.git] / functions / defaults.sh
blob4598ec662fa03125c26f130aa67bf8e16d7a8db6
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
5 ##
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
11 New_configuration ()
13 ## Runtime
15 # Image: Architecture
16 if [ -x "/usr/bin/dpkg" ]
17 then
18 CURRENT_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)"
19 else
20 case "$(uname -m)" in
21 x86_64)
22 CURRENT_IMAGE_ARCHITECTURE="amd64"
25 i?86)
26 CURRENT_IMAGE_ARCHITECTURE="i386"
30 Echo_warning "Unable to determine current architecture, using ${CURRENT_IMAGE_ARCHITECTURE}"
32 esac
36 ## Configuration
38 # Configuration-Version
39 LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-$(Get_configuration config/build Configuration-Version)}"
40 LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
41 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
48 # Image: Architecture (FIXME: Support and default to 'any')
49 LB_ARCHITECTURES="${LB_ARCHITECTURES:-$(Get_configuration config/build Architecture)}"
50 LB_ARCHITECTURES="${LB_ARCHITECTURES:-${CURRENT_IMAGE_ARCHITECTURE}}"
51 export LB_ARCHITECTURES
53 # Image: Archive Areas
54 LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-$(Get_configuration config/build Archive-Areas)}"
56 case "${LB_MODE}" in
57 progress-linux)
58 LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main contrib non-free}"
61 ubuntu)
62 LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main restricted}"
66 LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
68 esac
70 export LB_ARCHIVE_AREAS
72 # Image: Archive Areas
73 LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-$(Get_configuration config/build Parent-Archive-Areas)}"
74 LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
75 export LB_PARENT_ARCHIVE_AREAS
77 # Image: Type
78 LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-$(Get_configuration config/build Type)}"
79 LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
80 export LIVE_IMAGE_TYPE
83 Set_defaults ()
85 # FIXME
86 New_configuration
88 ## config/common
90 if [ -e local/live-build ]
91 then
92 LIVE_BUILD="${LIVE_BUILD:-${PWD}/local/live-build}"
93 export LIVE_BUILD
96 # Setting system type
97 LB_SYSTEM="${LB_SYSTEM:-live}"
99 # Setting mode (currently: debian, progress-linux, and ubuntu)
100 if [ -x /usr/bin/lsb_release ]
101 then
102 _DISTRIBUTOR="$(lsb_release -is | tr "[A-Z]" "[a-z]")"
104 case "${_DISTRIBUTOR}" in
105 debian|progress-linux|ubuntu)
106 LB_MODE="${LB_MODE:-${_DISTRIBUTOR}}"
110 LB_MODE="${LB_MODE:-debian}"
112 esac
113 else
114 if [ -e /etc/progress-linux_version ]
115 then
116 LB_MODE="${LB_MODE:-progress-linux}"
117 elif [ -e /etc/ubuntu_version ]
118 then
119 LB_MODE="${LB_MODE:-ubuntu}"
120 else
121 LB_MODE="${LB_MODE:-debian}"
125 # Setting distribution name
126 case "${LB_MODE}" in
127 progress-linux)
128 LB_DISTRIBUTION="${LB_DISTRIBUTION:-cairon}"
129 LB_DERIVATIVE="true"
130 LB_DERIVATIVE_IS_BASED_ON="debian"
133 ubuntu)
134 LB_DISTRIBUTION="${LB_DISTRIBUTION:-quantal}"
135 LB_DERIVATIVE="false"
139 LB_DISTRIBUTION="${LB_DISTRIBUTION:-stretch}"
140 LB_DERIVATIVE="false"
142 esac
144 case "${LB_MODE}" in
145 progress-linux)
146 case "${LB_DISTRIBUTION}" in
147 baureo|baureo-backports)
148 LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-wheezy}"
149 LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
152 cairon|cairon-backports)
153 LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-sid}"
154 LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
156 esac
158 LB_BACKPORTS="${LB_BACKPORTS:-true}"
162 LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-${LB_DISTRIBUTION}}"
163 LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
165 LB_BACKPORTS="${LB_BACKPORTS:-false}"
167 esac
169 # Setting package manager
170 LB_APT="${LB_APT:-apt}"
172 # Setting apt ftp proxy
173 LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
175 # Setting apt http proxy
176 LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
178 # Setting apt pipeline
179 # LB_APT_PIPELINE
181 APT_OPTIONS="${APT_OPTIONS:---yes}"
182 APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
184 BZIP2_OPTIONS="${BZIP2_OPTIONS:--6}"
186 GZIP_OPTIONS="${GZIP_OPTIONS:--6}"
188 if gzip --help | grep -qs "\-\-rsyncable"
189 then
190 GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
193 LZIP_OPTIONS="${LZIP_OPTIONS:--6}"
195 LZMA_OPTIONS="${LZMA_OPTIONS:--6}"
197 XZ_OPTIONS="${XZ_OPTIONS:--6}"
199 # Setting apt recommends
200 case "${LB_MODE}" in
201 progress-linux)
202 LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-false}"
206 LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
208 esac
210 # Setting apt secure
211 LB_APT_SECURE="${LB_APT_SECURE:-true}"
213 # Setting apt source
214 case "${LB_MODE}" in
215 progress-linux)
216 LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-false}"
220 LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-true}"
222 esac
224 # Setting cache option
225 LB_CACHE="${LB_CACHE:-true}"
226 LB_CACHE_INDICES="${LB_CACHE_INDICES:-false}"
227 LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES:-true}"
228 LB_CACHE_STAGES="${LB_CACHE_STAGES:-bootstrap}"
230 # Setting debconf frontend
231 LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
232 LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
234 # Setting initramfs hook
235 case "${LB_SYSTEM}" in
236 live)
237 LB_INITRAMFS="${LB_INITRAMFS:-live-boot}"
240 normal)
241 LB_INITRAMFS="${LB_INITRAMFS:-none}"
243 esac
245 LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"
247 # Setting initsystem
248 case "${LB_MODE}" in
249 ubuntu)
250 case "${LB_INITRAMFS}" in
251 live-boot)
252 LB_INITSYSTEM="${LB_INITSYSTEM:-upstart}"
254 esac
257 progress-linux)
258 case "${LB_DISTRIBUTION}" in
259 cairon*)
260 LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
264 LB_INITSYSTEM="${LB_INITSYSTEM:-sysvinit}"
266 esac
270 case "${LB_SYSTEM}" in
271 live)
272 LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
275 normal)
276 LB_INITSYSTEM="${LB_INITSYSTEM:-none}"
278 esac
280 esac
282 # Setting fdisk
283 if [ -z "${LB_FDISK}" ] || [ ! -x "${LB_FDISK}" ]
284 then
285 # Workaround for gnu-fdisk divertion
286 # (gnu-fdisk is buggy, #445304).
287 if [ -x /sbin/fdisk.distrib ]
288 then
289 LB_FDISK="fdisk.distrib"
290 elif [ -x /sbin/fdisk ]
291 then
292 LB_FDISK="fdisk"
293 else
294 Echo_error "Can't process file /sbin/fdisk"
298 # Setting losetup
299 if [ -z "${LB_LOSETUP}" ] || [ "${LB_LOSETUP}" != "/sbin/losetup.orig" ]
300 then
301 # Workaround for loop-aes-utils divertion
302 # (loop-aes-utils' losetup lacks features).
303 if [ -x /sbin/losetup.orig ]
304 then
305 LB_LOSETUP="losetup.orig"
306 elif [ -x /sbin/losetup ]
307 then
308 LB_LOSETUP="losetup"
309 else
310 Echo_error "Can't process file /sbin/losetup"
314 if [ "${LB_ARCHITECTURES}" = "i386" ] && [ "${CURRENT_IMAGE_ARCHITECTURE}" = "amd64" ]
315 then
316 # Use linux32 when building amd64 images on i386
317 _LINUX32="linux32"
318 else
319 _LINUX32=""
322 # Setting tasksel
323 LB_TASKSEL="${LB_TASKSEL:-apt}"
325 # Setting root directory
326 case "${LB_MODE}" in
327 progress-linux)
328 LB_ROOT="${LB_ROOT:-progress-linux}"
332 LB_ROOT="${LB_ROOT:-${LB_MODE}-live}"
334 esac
336 # Setting live build options
337 _BREAKPOINTS="${_BREAKPOINTS:-false}"
338 _COLOR="${_COLOR:-false}"
339 _DEBUG="${_DEBUG:-false}"
340 _FORCE="${_FORCE:-false}"
341 _QUIET="${_QUIET:-false}"
342 _VERBOSE="${_VERBOSE:-false}"
344 ## config/bootstrap
346 # Setting mirror to fetch packages from
347 case "${LB_MODE}" in
348 debian)
349 LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
350 LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
353 progress-linux)
354 LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-http://ftp.debian.org/debian/}"
355 LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://cdn.archive.progress-linux.org/packages/}"
358 ubuntu)
359 case "${LB_ARCHITECTURES}" in
360 amd64|i386)
361 LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://archive.ubuntu.com/ubuntu/}"
365 LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://ports.ubuntu.com/ubuntu-ports/}"
367 esac
369 LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
371 esac
373 LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT:-${LB_PARENT_MIRROR_BOOTSTRAP}}"
374 LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT:-${LB_MIRROR_BOOTSTRAP}}"
376 # Setting security mirror to fetch packages from
377 case "${LB_MODE}" in
378 debian)
379 LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
380 LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
383 progress-linux)
384 LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
385 LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT}}"
388 ubuntu)
389 case "${LB_ARCHITECTURES}" in
390 amd64|i386)
391 LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.ubuntu.com/ubuntu/}"
395 LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://ports.ubuntu.com/ubuntu-ports/}"
397 esac
399 LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
401 esac
403 # Setting mirror which ends up in the image
404 case "${LB_MODE}" in
405 debian)
406 LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://http.debian.net/debian/}"
407 LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
410 progress-linux)
411 LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-http://ftp.debian.org/debian/}"
412 LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-${LB_MIRROR_CHROOT}}"
415 ubuntu)
416 case "${LB_ARCHITECTURES}" in
417 amd64|i386)
418 LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://archive.ubuntu.com/ubuntu/}"
422 LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://ports.ubuntu.com/ubuntu-ports/}"
424 esac
426 LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
428 esac
430 # Setting security mirror which ends up in the image
431 case "${LB_MODE}" in
432 debian)
433 LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
434 LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
437 progress-linux)
438 LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
439 LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-${LB_MIRROR_CHROOT}}"
442 ubuntu)
443 case "${LB_ARCHITECTURES}" in
444 amd64|i386)
445 LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.ubuntu.com/ubuntu/}"
449 LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://ports.ubuntu.com/ubuntu-ports/}"
451 esac
453 LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
455 esac
457 case "${LB_MODE}" in
458 progress-linux)
459 LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
460 LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
464 LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
465 LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_PARENT_MIRROR_CHROOT}}"
467 esac
469 ## config/chroot
471 # Setting chroot filesystem
472 LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
474 # Setting union filesystem
475 LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-aufs}"
477 # Setting interactive shell/X11/Xnest
478 LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
480 # Setting keyring packages
481 case "${LB_MODE}" in
482 ubuntu)
483 LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
487 LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
489 esac
491 # Setting linux flavour string
492 case "${LB_ARCHITECTURES}" in
493 arm64)
494 case "${LB_MODE}" in
495 ubuntu)
496 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
500 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-arm64}"
502 esac
505 armel)
506 case "${LB_MODE}" in
507 ubuntu)
508 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-omap}"
511 # armel will have special images: one rootfs image and many additional kernel images.
512 # therefore we default to all available armel flavours
513 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-ixp4xx kirkwood orion5x versatile}"
515 esac
518 armhf)
519 case "${LB_MODE}" in
520 ubuntu)
521 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
525 # armhf will have special images: one rootfs image and many additional kernel images.
526 # therefore we default to all available armhf flavours
527 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-armmp armmp-lpae}"
529 esac
532 amd64)
533 case "${LB_MODE}" in
534 ubuntu)
535 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
539 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
541 esac
544 i386)
545 case "${LB_MODE}" in
546 progress-linux)
547 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-686-pae}"
550 ubuntu)
551 case "${LB_DISTRIBUTION}" in
552 precise)
553 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic-pae}"
557 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
559 esac
563 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-586}"
565 esac
568 ia64)
569 case "${LB_MODE}" in
570 progress-linux)
571 Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
572 exit 1
576 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-itanium}"
578 esac
581 powerpc)
582 case "${LB_MODE}" in
583 progress-linux)
584 Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
585 exit 1
588 ubuntu)
589 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc-smp powerpc64-smp e500 powerpc-e500mc}"
593 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc64 powerpc}"
595 esac
598 s390x)
599 case "${LB_MODE}" in
600 progress-linux|ubuntu)
601 Echo_error "Architecture ${LB_ARCHITECTURES} not supported in the ${LB_MODE} mode."
602 exit 1
606 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-s390x}"
608 esac
612 Echo_error "Architecture(s) ${LB_ARCHITECTURES} not yet supported (FIXME)"
613 exit 1
615 esac
617 # Set linux packages
618 case "${LB_MODE}" in
619 ubuntu)
620 LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux}"
624 LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
626 esac
628 # Setting security updates option
629 case "${LB_PARENT_DISTRIBUTION}" in
630 sid)
631 LB_SECURITY="${LB_SECURITY:-false}"
635 LB_SECURITY="${LB_SECURITY:-true}"
637 esac
639 # Setting updates updates option
640 case "${LB_PARENT_DISTRIBUTION}" in
641 sid)
642 LB_UPDATES="${LB_UPDATES:-false}"
646 LB_UPDATES="${LB_UPDATES:-true}"
648 esac
650 ## config/binary
652 # Setting image filesystem
653 LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-fat32}"
655 # Setting image type
656 case "${LB_ARCHITECTURES}" in
657 amd64|i386)
658 LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
662 LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso}"
664 esac
666 # Setting apt indices
667 case "${LB_MODE}" in
668 progress-linux)
669 LB_APT_INDICES="${LB_APT_INDICES:-false}"
673 LB_APT_INDICES="${LB_APT_INDICES:-true}"
675 esac
677 # Setting bootloader
678 if [ -z "${LB_BOOTLOADER}" ]
679 then
680 case "${LB_ARCHITECTURES}" in
681 amd64|i386)
682 LB_BOOTLOADER="syslinux"
684 esac
687 # Setting checksums
688 case "${LB_MODE}" in
689 progress-linux)
690 LB_CHECKSUMS="${LB_CHECKSUMS:-sha256}"
694 LB_CHECKSUMS="${LB_CHECKSUMS:-md5}"
696 esac
698 # Setting compression
699 LB_COMPRESSION="${LB_COMPRESSION:-none}"
701 # Setting zsync
702 LB_ZSYNC="${LB_ZSYNC:-true}"
704 # Setting chroot option
705 LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
707 LB_BUILD_WITH_TMPFS="${LB_BUILD_WITH_TMPFS:-false}"
709 # Setting debian-installer option
710 LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-false}"
712 LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_DISTRIBUTION}}"
714 # Setting debian-installer-gui
715 case "${LB_MODE}" in
716 debian|progress-linux)
717 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"
721 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-false}"
723 esac
725 # Setting debian-installer preseed filename
726 if [ -z "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
727 then
728 if Find_files config/debian-installer/preseed.cfg
729 then
730 LB_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
733 if Find_files config/debian-installer/*.cfg && [ ! -e config/debian-installer/preseed.cfg ]
734 then
735 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."
739 # Setting boot parameters
740 case "${LB_INITRAMFS}" in
741 live-boot)
742 LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=live components quiet splash}"
743 LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
746 none)
747 LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-quiet splash}"
748 LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal}"
750 esac
752 if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
753 then
754 case "${LIVE_IMAGE_TYPE}" in
755 iso*)
756 _LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
759 hdd*)
760 case "${LB_MODE}" in
761 ubuntu)
762 if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
763 then
764 _LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
765 else
766 _LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
771 _LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
773 esac
776 netboot)
777 case "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" in
778 *://*)
779 _LB_BOOTAPPEND_PRESEED="file=${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
783 _LB_BOOTAPPEND_PRESEED="file=/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
785 esac
787 esac
790 if [ -n ${_LB_BOOTAPPEND_PRESEED} ]
791 then
792 LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL} ${_LB_BOOTAPPEND_PRESEED}"
795 LB_BOOTAPPEND_INSTALL="$(echo ${LB_BOOTAPPEND_INSTALL} | sed -e 's/[ \t]*$//')"
797 # Setting grub splash
798 # LB_GRUB_SPLASH
800 # Setting iso author
801 case "${LB_MODE}" in
802 debian)
803 LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Debian Live}"
806 progress-linux)
807 LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Progress Linux}"
810 ubuntu)
811 LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Ubuntu Live}"
813 esac
815 # Set iso preparer
816 LB_ISO_PREPARER="${LB_ISO_PREPARER:-live-build \$VERSION; http://live-systems.org/devel/live-build}"
818 # Set iso publisher
819 case "${LB_MODE}" in
820 progress-linux)
821 LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER:-Progress Linux; http://www.progress-linux.org/; progress-project@lists.progress-linux.org}"
825 LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER:-Live Systems project; http://live-systems.org/; debian-live@lists.debian.org}"
827 esac
829 # Setting hdd options
830 case "${LB_MODE}" in
831 debian)
832 LB_HDD_LABEL="${LB_HDD_LABEL:-DEBIAN_LIVE}"
835 progress-linux)
836 LB_HDD_LABEL="${LB_HDD_LABEL:-PROGRESS_$(echo ${LB_DISTRIBUTION} | tr "[a-z]" "[A-Z]")}"
839 ubuntu)
840 LB_HDD_LABEL="${LB_HDD_LABEL:-UBUNTU}"
842 esac
844 # Setting hdd size
845 LB_HDD_SIZE="${LB_HDD_SIZE:-auto}"
847 # Setting iso volume
848 case "${LB_MODE}" in
849 debian)
850 LB_ISO_VOLUME="${LB_ISO_VOLUME:-Debian ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
853 progress-linux)
854 LB_ISO_VOLUME="${LB_ISO_VOLUME:-Progress ${LB_DISTRIBUTION}}"
857 ubuntu)
858 LB_ISO_VOLUME="${LB_ISO_VOLUME:-Ubuntu ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
860 esac
862 # Setting memtest option
863 LB_MEMTEST="${LB_MEMTEST:-none}"
865 # Setting loadlin option
866 case "${LB_MODE}" in
867 progress-linux|ubuntu)
872 case "${LB_ARCHITECTURES}" in
873 amd64|i386)
874 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
875 then
876 LB_LOADLIN="${LB_LOADLIN:-true}"
877 else
878 LB_LOADLIN="${LB_LOADLIN:-false}"
883 LB_LOADLIN="${LB_LOADLIN:-false}"
885 esac
887 esac
889 # Setting win32-loader option
890 case "${LB_MODE}" in
891 progress-linux|ubuntu)
896 case "${LB_ARCHITECTURES}" in
897 amd64|i386)
898 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
899 then
900 LB_WIN32_LOADER="${LB_WIN32_LOADER:-true}"
901 else
902 LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
907 LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
909 esac
911 esac
913 # Setting netboot filesystem
914 LB_NET_ROOT_FILESYSTEM="${LB_NET_ROOT_FILESYSTEM:-nfs}"
916 # Setting netboot server path
917 case "${LB_MODE}" in
918 progress-linux)
919 LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH:-/srv/progress-linux}"
923 LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH:-/srv/${LB_MODE}-live}"
925 esac
927 # Setting netboot server address
928 LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER:-192.168.1.1}"
930 # Setting net cow filesystem
931 LB_NET_COW_FILESYSTEM="${LB_NET_COW_FILESYSTEM:-nfs}"
933 # Setting net tarball
934 LB_NET_TARBALL="${LB_NET_TARBALL:-true}"
936 # Setting firmware option
937 case "${LB_MODE}" in
938 ubuntu)
939 LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT:-false}"
940 LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-false}"
944 LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT:-true}"
945 LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-true}"
947 esac
949 # Setting swap file
950 LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE:-512}"
952 ## config/source
954 # Setting source option
955 LB_SOURCE="${LB_SOURCE:-false}"
957 # Setting image type
958 LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES:-tar}"
961 Check_defaults ()
963 if [ -n "${LIVE_BUILD_VERSION}" ]
964 then
965 # We're only checking when we're actually running the checks
966 # that's why the check for emptyness of the version;
967 # however, as live-build always declares LIVE_BUILD_VERSION
968 # internally, this is safe assumption (no cases where it's unset,
969 # except when bootstrapping the functions/defaults etc.).
971 CURRENT_CONFIGURATION_VERSION="$(echo ${LIVE_CONFIGURATION_VERSION} | awk -F. ' { print $1 }')"
973 if [ -n "${CURRENT_CONFIGURATION_VERSION}" ]
974 then
975 CORRECT_VERSION="$(echo ${LIVE_BUILD_VERSION} | awk -F. '{ print $1 }')"
976 TOO_NEW_VERSION="$((${CORRECT_VERSION} + 1))"
977 TOO_OLD_VERSION="$((${CORRECT_VERSION} - 1))"
979 if [ ${CURRENT_CONFIGURATION_VERSION} -ne ${CORRECT_VERSION} ]
980 then
981 if [ ${CURRENT_CONFIGURATION_VERSION} -ge ${TOO_NEW_VERSION} ]
982 then
983 Echo_error "This config tree is too new for live-build (${VERSION})."
984 Echo_error "Aborting build, please update live-build."
986 exit 1
987 elif [ ${CURRENT_CONFIGURATION_VERSION} -le ${TOO_OLD_VERSION} ]
988 then
989 Echo_error "This config tree is too old for live-build (${VERSION})."
990 Echo_error "Aborting build, please update the configuration."
992 exit 1
993 else
994 Echo_warning "This configuration does not specify a version or has a unknown version."
995 Echo_warning "Continuing build, please correct the configuration."
1001 case "${LB_BINARY_FILESYSTEM}" in
1002 ntfs)
1003 if [ ! -x "$(which ntfs-3g 2>/dev/null)" ]
1004 then
1005 Echo_error "Using ntfs as the binary filesystem is currently only supported"
1006 Echo_error "if ntfs-3g is installed on the host system."
1008 exit 1
1011 esac
1013 if echo ${LB_HDD_LABEL} | grep -qs ' '
1014 then
1015 Echo_error "There are currently no whitespaces supported in hdd labels."
1017 exit 1
1020 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
1021 then
1022 # d-i true, no caching
1023 if ! echo ${LB_CACHE_STAGES} | grep -qs "bootstrap\b" || [ "${LB_CACHE}" != "true" ] || [ "${LB_CACHE_PACKAGES}" != "true" ]
1024 then
1025 Echo_warning "You have selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached. This configuration is potentially unsafe as the bootstrap packages are re-used when integrating the Debian Installer."
1029 if [ "${LB_BOOTLOADER}" = "syslinux" ]
1030 then
1031 # syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
1032 case "${LB_BINARY_FILESYSTEM}" in
1033 fat*|ntfs|ext[234]|btrfs)
1036 Echo_warning "You have selected values of LB_BOOTLOADER and LB_BINARY_FILESYSTEM which are incompatible - the syslinux family only support FAT, NTFS, ext[234] or btrfs filesystems."
1038 esac
1041 case "${LIVE_IMAGE_TYPE}" in
1042 hdd*)
1043 case "${LB_BOOTLOADER}" in
1044 grub)
1045 Echo_error "You have selected a combination of bootloader and image type that is currently not supported by live-build. Please use either another bootloader or a different image type."
1046 exit 1
1048 esac
1050 esac
1052 if [ "$(echo \"${LB_ISO_APPLICATION}\" | wc -c)" -gt 128 ]
1053 then
1054 Echo_warning "You have specified a value of LB_ISO_APPLICATION that is too long; the maximum length is 128 characters."
1057 if [ "$(echo \"${LB_ISO_PREPARER}\" | wc -c)" -gt 128 ]
1058 then
1059 Echo_warning "You have specified a value of LB_ISO_PREPARER that is too long; the maximum length is 128 characters."
1062 if [ "$(echo \"${LB_ISO_PUBLISHER}\" | wc -c)" -gt 128 ]
1063 then
1064 Echo_warning "You have specified a value of LB_ISO_PUBLISHER that is too long; the maximum length is 128 characters."
1067 if [ "$(eval "echo \"${LB_ISO_VOLUME}\"" | wc -c)" -gt 32 ]
1068 then
1069 Echo_warning "You have specified a value of LB_ISO_VOLUME that is too long; the maximum length is 32 characters."
1072 # Architectures to use foreign bootstrap for
1073 LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES:-}"
1075 # Packages to exclude for the foreign/ports bootstrapping
1076 LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE:-}"
1078 # Ports using foreign bootstrap need a working qemu-*-system. This is the location it
1079 LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC:-}"