Releasing debian version 4.0.2-1.
[live-build.git] / functions / defaults.sh
1 #!/bin/sh
2
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
5 ##
6 ## live-build 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.
9
10
11 Set_defaults ()
12 {
13 ## config/common
14
15 LB_BASE="${LB_BASE:-/usr/share/live/build}"
16
17 # Setting mode
18 if [ -z "${LB_MODE}" ]
19 then
20 LB_MODE="debian"
21 fi
22
23 # Setting distribution name
24 if [ -z "${LB_DISTRIBUTION}" ]
25 then
26 case "${LB_MODE}" in
27 debian|debian-release)
28 LB_DISTRIBUTION="squeeze"
29 ;;
30
31 emdebian)
32 LB_DISTRIBUTION="sid"
33 ;;
34
35 ubuntu)
36 LB_DISTRIBUTION="karmic"
37 ;;
38 esac
39 fi
40
41 # Setting package manager
42 LB_APT="${LB_APT:-apt}"
43
44 # Setting apt ftp proxy
45 if [ -z "${LB_APT_FTP_PROXY}" ] && [ -n "${ftp_proxy}" ]
46 then
47 LB_APT_FTP_PROXY="${ftp_proxy}"
48 else
49 if [ -n "${LB_APT_FTP_PROXY}" ] && [ "${LB_APT_FTP_PROXY}" != "${ftp_proxy}" ]
50 then
51 ftp_proxy="${LB_APT_FTP_PROXY}"
52 fi
53 fi
54
55 # Setting apt http proxy
56 if [ -z "${LB_APT_HTTP_PROXY}" ] && [ -n "${http_proxy}" ]
57 then
58 LB_APT_HTTP_PROXY="${http_proxy}"
59 else
60 if [ -n "${LB_APT_HTTP_PROXY}" ] && [ "${LB_APT_HTT_PROXY}" != "${http_proxy}" ]
61 then
62 http_proxy="${LB_APT_HTTP_PROXY}"
63 fi
64 fi
65
66 # Setting apt pdiffs
67 LB_APT_PDIFFS="${LB_APT_PDIFFS:-true}"
68
69 # Setting apt pipeline
70 # LB_APT_PIPELINE
71
72 APT_OPTIONS="${APT_OPTIONS:---yes}"
73 APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
74
75 GZIP_OPTIONS="${GZIP_OPTIONS:---best}"
76
77 if gzip --help | grep -qs "\-\-rsyncable"
78 then
79 GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
80 fi
81
82 # Setting apt recommends
83 case "${LB_MODE}" in
84 debian|debian-release|ubuntu)
85 LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
86 ;;
87
88 emdebian)
89 LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-false}"
90 ;;
91 esac
92
93 # Setting apt secure
94 LB_APT_SECURE="${LB_APT_SECURE:-true}"
95
96 # Setting bootstrap program
97 if [ -z "${LB_BOOTSTRAP}" ] || ( [ ! -x "$(which ${LB_BOOTSTRAP} 2>/dev/null)" ] && [ "${LB_BOOTSTRAP}" != "copy" ] )
98 then
99 if [ -x "/usr/sbin/debootstrap" ]
100 then
101 LB_BOOTSTRAP="debootstrap"
102 elif [ -x "/usr/bin/cdebootstrap" ]
103 then
104 LB_BOOTSTRAP="cdebootstrap"
105 else
106 Echo_error "Cannot find /usr/sbin/debootstrap or /usr/bin/cdebootstrap. Please install debootstrap or cdebootstrap, or specify an alternative bootstrapping utility."
107 exit 1
108 fi
109 fi
110
111 # Setting cache option
112 LB_CACHE="${LB_CACHE:-true}"
113 LB_CACHE_INDICES="${LB_CACHE_INDICES:-false}"
114 LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES:-true}"
115 LB_CACHE_STAGES="${LB_CACHE_STAGES:-bootstrap}"
116
117 # Setting debconf frontend
118 LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
119 LB_DEBCONF_NOWARNINGS="${LB_DEBCONF_NOWARNINGS:-yes}"
120 LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
121
122 case "${LB_DEBCONF_NOWARNINGS}" in
123 true)
124 LB_DEBCONF_NOWARNINGS="yes"
125 ;;
126
127 false)
128 LB_DEBCONF_NOWARNINGS="no"
129 ;;
130 esac
131
132 # Setting initramfs hook
133 if [ -z "${LB_INITRAMFS}" ]
134 then
135 LB_INITRAMFS="auto"
136 else
137 if [ "${LB_INITRAMFS}" = "auto" ]
138 then
139 case "${LB_MODE}" in
140 ubuntu)
141 LB_INITRAMFS="casper"
142 ;;
143
144 *)
145 case "${LB_DISTRIBUTION}" in
146 wheezy)
147 LB_INITRAMFS="live-boot"
148 ;;
149
150 *)
151 LB_INITRAMFS="live-initramfs"
152 ;;
153 esac
154 ;;
155 esac
156 fi
157 fi
158
159 # Setting fdisk
160 if [ -z "${LB_FDISK}" ] || [ ! -x "${LB_FDISK}" ]
161 then
162 # Workaround for gnu-fdisk divertion
163 # (gnu-fdisk is buggy, #445304).
164 if [ -x /sbin/fdisk.distrib ]
165 then
166 LB_FDISK="fdisk.distrib"
167 elif [ -x /sbin/fdisk ]
168 then
169 LB_FDISK="fdisk"
170 else
171 Echo_error "Can't process file /sbin/fdisk"
172 fi
173 fi
174
175 # Setting losetup
176 if [ -z "${LB_LOSETUP}" ] || [ "${LB_LOSETUP}" != "/sbin/losetup.orig" ]
177 then
178 # Workaround for loop-aes-utils divertion
179 # (loop-aes-utils' losetup lacks features).
180 if [ -x /sbin/losetup.orig ]
181 then
182 LB_LOSETUP="losetup.orig"
183 elif [ -x /sbin/losetup ]
184 then
185 LB_LOSETUP="losetup"
186 else
187 Echo_error "Can't process file /sbin/losetup"
188 fi
189 fi
190
191 if [ "$(id -u)" = "0" ]
192 then
193 # If we are root, disable root command
194 LB_ROOT_COMMAND=""
195 else
196 if [ -x /usr/bin/sudo ]
197 then
198 # FIXME: this is false until considered safe
199 #LB_ROOT_COMMAND="sudo"
200 LB_ROOT_COMMAND=""
201 fi
202 fi
203
204 # Setting tasksel
205 LB_TASKSEL="${LB_TASKSEL:-tasksel}"
206
207 # Setting root directory
208 if [ -z "${LB_ROOT}" ]
209 then
210 case "${LB_MODE}" in
211 debian|debian-release)
212 LB_ROOT="debian-live"
213 ;;
214
215 emdebian)
216 LB_ROOT="emdebian-live"
217 ;;
218
219 ubuntu)
220 LB_ROOT="ubuntu-live"
221 ;;
222 esac
223 fi
224
225 # Setting includes
226 if [ -z "${LB_INCLUDES}" ]
227 then
228 LB_INCLUDES="${LB_BASE}/includes"
229 fi
230
231 # Setting templates
232 if [ -z "${LB_TEMPLATES}" ]
233 then
234 LB_TEMPLATES="${LB_BASE}/templates"
235 fi
236
237 # Setting live build options
238 _BREAKPOINTS="${_BREAKPOINTS:-false}"
239 _COLOR="${_COLOR:-false}"
240 _DEBUG="${_DEBUG:-false}"
241 _FORCE="${_FORCE:-false}"
242 _QUIET="${_QUIET:-false}"
243 _VERBOSE="${_VERBOSE:-false}"
244
245 ## config/bootstrap
246
247 # Setting architecture value
248 if [ -z "${LB_ARCHITECTURE}" ]
249 then
250 if [ -x "/usr/bin/dpkg" ]
251 then
252 LB_ARCHITECTURE="$(dpkg --print-architecture)"
253 else
254 case "$(uname -m)" in
255 sparc|powerpc)
256 LB_ARCHITECTURE="$(uname -m)"
257 ;;
258 x86_64)
259 LB_ARCHITECTURE="amd64"
260 ;;
261 *)
262 Echo_warning "Can't determine architecture, assuming i386"
263 LB_ARCHITECTURE="i386"
264 ;;
265 esac
266 fi
267 fi
268
269 # Include packages on base
270 # LB_BOOTSTRAP_INCLUDE
271
272 # Exclude packages on base
273 # LB_BOOTSTRAP_EXCLUDE
274
275 # Setting distribution configuration value
276 # LB_BOOTSTRAP_CONFIG
277
278 # Setting flavour value
279 case "${LB_BOOTSTRAP}" in
280 cdebootstrap)
281 LB_BOOTSTRAP_FLAVOUR="${LB_BOOTSTRAP_FLAVOUR:-standard}"
282 ;;
283 esac
284
285 # Setting bootstrap keyring
286 # LB_BOOTSTRAP_KEYRING
287
288 # Setting mirror to fetch packages from
289 if [ -z "${LB_MIRROR_BOOTSTRAP}" ]
290 then
291 case "${LB_MODE}" in
292 debian|debian-release)
293 LB_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/"
294 ;;
295
296 emdebian)
297 LB_MIRROR_BOOTSTRAP="http://buildd.emdebian.org/grip/"
298 ;;
299
300 ubuntu)
301 case "${LB_ARCHITECTURE}" in
302 amd64|i386)
303 LB_MIRROR_BOOTSTRAP="http://archive.ubuntu.com/ubuntu/"
304 ;;
305
306 *)
307 LB_MIRROR_BOOTSTRAP="http://ports.ubuntu.com/"
308 ;;
309 esac
310 ;;
311 esac
312 fi
313
314 LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT:-${LB_MIRROR_BOOTSTRAP}}"
315
316 # Setting security mirror to fetch packages from
317 if [ -z "${LB_MIRROR_CHROOT_SECURITY}" ]
318 then
319 case "${LB_MODE}" in
320 debian|debian-release)
321 LB_MIRROR_CHROOT_SECURITY="http://security.debian.org/"
322 ;;
323
324 emdebian)
325 LB_MIRROR_CHROOT_SECURITY="none"
326 ;;
327
328 ubuntu)
329 case "${LB_ARCHITECTURE}" in
330 amd64|i386)
331 LB_MIRROR_CHROOT_SECURITY="http://security.ubuntu.com/ubuntu/"
332 ;;
333
334 *)
335 LB_MIRROR_CHROOT_SECURITY="http://ports.ubuntu.com/"
336 ;;
337 esac
338 ;;
339 esac
340 fi
341
342 # Setting volatile mirror to fetch packages from
343 if [ -z "${LB_MIRROR_CHROOT_VOLATILE}" ]
344 then
345 case "${LB_MODE}" in
346 debian|debian-release)
347 case "${LB_DISTRIBUTION}" in
348 lenny)
349 LB_MIRROR_CHROOT_VOLATILE="http://volatile.debian.org/debian-volatile/"
350 ;;
351 esac
352 ;;
353
354 ubuntu)
355 case "${LB_ARCHITECTURE}" in
356 amd64|i386)
357 LB_MIRROR_CHROOT_VOLATILE="http://security.ubuntu.com/ubuntu/"
358 ;;
359
360 *)
361 LB_MIRROR_CHROOT_VOLATILE="http://ports.ubuntu.com/"
362 ;;
363 esac
364 ;;
365 esac
366
367 LB_MIRROR_CHROOT_VOLATILE="${LB_MIRROR_CHROOT_VOLATILE:-none}"
368 fi
369
370 # Setting backports mirror to fetch packages from
371 if [ -z "${LB_MIRROR_CHROOT_BACKPORTS}" ]
372 then
373 case "${LB_MODE}" in
374 debian|debian-release)
375 case "${LB_DISTRIBUTION}" in
376 lenny|squeeze)
377 LB_MIRROR_CHROOT_BACKPORTS="http://backports.debian.org/debian-backports/"
378 ;;
379 esac
380 ;;
381 esac
382
383 LB_MIRROR_CHROOT_BACKPORTS="${LB_MIRROR_CHROOT_BACKPORTS:-none}"
384 fi
385
386 # Setting mirror which ends up in the image
387 if [ -z "${LB_MIRROR_BINARY}" ]
388 then
389 case "${LB_MODE}" in
390 debian|debian-release)
391 LB_MIRROR_BINARY="http://cdn.debian.net/debian/"
392 ;;
393
394 emdebian)
395 LB_MIRROR_BINARY="http://buildd.emdebian.org/grip/"
396 ;;
397
398 ubuntu)
399 case "${LB_ARCHITECTURE}" in
400 amd64|i386)
401 LB_MIRROR_BINARY="http://archive.ubuntu.com/ubuntu/"
402 ;;
403
404 *)
405 LB_MIRROR_BINARY="http://ports.ubuntu.com/"
406 ;;
407 esac
408 ;;
409 esac
410 fi
411
412 # Setting security mirror which ends up in the image
413 if [ -z "${LB_MIRROR_BINARY_SECURITY}" ]
414 then
415 case "${LB_MODE}" in
416 debian|debian-release)
417 LB_MIRROR_BINARY_SECURITY="http://security.debian.org/"
418 ;;
419
420 emdebian)
421 LB_MIRROR_BINARY_SECURITY="none"
422 ;;
423
424 ubuntu)
425 case "${LB_ARCHITECTURE}" in
426 amd64|i386)
427 LB_MIRROR_BINARY_SECURITY="http://archive.ubuntu.com/ubuntu/"
428 ;;
429
430 *)
431 LB_MIRROR_BINARY_SECURITY="http://ports.ubuntu.com/"
432 ;;
433 esac
434 ;;
435 esac
436 fi
437
438 # Setting volatile mirror which ends up in the image
439 if [ -z "${LB_MIRROR_BINARY_VOLATILE}" ]
440 then
441 case "${LB_MODE}" in
442 debian|debian-release)
443 case "${LB_DISTRIBUTION}" in
444 lenny)
445 LB_MIRROR_BINARY_VOLATILE="http://volatile.debian.org/debian-volatile/"
446 ;;
447 esac
448 ;;
449
450 ubuntu)
451 case "${LB_ARCHITECTURE}" in
452 amd64|i386)
453 LB_MIRROR_BINARY_VOLATILE="http://security.ubuntu.com/ubuntu/"
454 ;;
455
456 *)
457 LB_MIRROR_BINARY_VOLATILE="http://ports.ubuntu.com/"
458 ;;
459 esac
460 ;;
461 esac
462
463 LB_MIRROR_BINARY_VOLATILE="${LB_MIRROR_BINARY_VOLATILE:-none}"
464 fi
465
466 # Setting backports mirror which ends up in the image
467 if [ -z "${LB_MIRROR_BINARY_BACKPORTS}" ]
468 then
469 case "${LB_MODE}" in
470 debian|debian-release)
471 case "${LB_DISTRIBUTION}" in
472 lenny|squeeze)
473 LB_MIRROR_BINARY_BACKPORTS="http://backports.debian.org/debian-backports/"
474 ;;
475 esac
476 ;;
477 esac
478
479 LB_MIRROR_BINARY_BACKPORTS="${LB_MIRROR_BINARY_BACKPORTS:-none}"
480 fi
481
482 LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_BOOTSTRAP}}"
483
484 # Setting archive areas value
485 if [ -z "${LB_ARCHIVE_AREAS}" ]
486 then
487 case "${LB_MODE}" in
488 ubuntu)
489 LB_ARCHIVE_AREAS="main restricted"
490 ;;
491
492 *)
493 LB_ARCHIVE_AREAS="main"
494 ;;
495 esac
496 fi
497
498 ## config/chroot
499
500 # Setting chroot filesystem
501 LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
502
503 # Setting virtual root size
504 LB_VIRTUAL_ROOT_SIZE="${LB_VIRTUAL_ROOT_SIZE:-10000}"
505
506 # Setting whether to expose root filesystem as read only
507 LB_EXPOSED_ROOT="${LB_EXPOSED_ROOT:-false}"
508
509 # Setting union filesystem
510 LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-aufs}"
511
512 # LB_HOOKS
513
514 # Setting interactive shell/X11/Xnest
515 LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
516
517 # Setting keyring packages
518 case "${LB_MODE}" in
519 debian|debian-release)
520 LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
521 ;;
522
523 emdebian)
524 LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
525 ;;
526
527 ubuntu)
528 LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
529 ;;
530 esac
531
532 # Setting language string
533 LB_LANGUAGE="${LB_LANGUAGE:-en}"
534
535 # Setting linux flavour string
536 if [ -z "${LB_LINUX_FLAVOURS}" ]
537 then
538 case "${LB_ARCHITECTURE}" in
539 arm|armel)
540 Echo_error "There is no default kernel flavour defined for your architecture."
541 Echo_error "Please configure it manually with 'lb config -k FLAVOUR'."
542 exit 1
543 ;;
544
545 alpha)
546 case "${LB_MODE}" in
547 ubuntu)
548 Echo_error "Architecture ${LB_ARCHITECTURE} not supported on Ubuntu."
549 exit 1
550 ;;
551
552 *)
553 LB_LINUX_FLAVOURS="alpha-generic"
554 ;;
555 esac
556 ;;
557
558 amd64)
559 case "${LB_MODE}" in
560 ubuntu)
561 LB_LINUX_FLAVOURS="generic"
562 ;;
563
564 *)
565 LB_LINUX_FLAVOURS="amd64"
566 ;;
567 esac
568 ;;
569
570 hppa)
571 case "${LB_MODE}" in
572 ubuntu)
573 LB_LINUX_FLAVOURS="hppa32 hppa64"
574 ;;
575
576 *)
577 LB_LINUX_FLAVOURS="parisc"
578 ;;
579 esac
580 ;;
581
582 i386)
583 case "${LB_MODE}" in
584 ubuntu)
585 LB_LINUX_FLAVOURS="generic"
586 ;;
587
588 *)
589 case "${LIST}" in
590 stripped|minimal)
591 LB_LINUX_FLAVOURS="486"
592 ;;
593
594 *)
595 LB_LINUX_FLAVOURS="486 686"
596 ;;
597 esac
598 ;;
599 esac
600 ;;
601
602 ia64)
603 LB_LINUX_FLAVOURS="itanium"
604 ;;
605
606 powerpc)
607 case "${LIST}" in
608 stripped|minimal)
609 LB_LINUX_FLAVOURS="powerpc"
610 ;;
611
612 *)
613 LB_LINUX_FLAVOURS="powerpc powerpc64"
614 ;;
615 esac
616 ;;
617
618 s390)
619 case "${LB_MODE}" in
620 ubuntu)
621 Echo_error "Architecture ${LB_ARCHITECTURE} not supported on Ubuntu."
622 exit 1
623 ;;
624
625 *)
626 LB_LINUX_FLAVOURS="s390"
627 ;;
628 esac
629 ;;
630
631 sparc)
632 LB_LINUX_FLAVOURS="sparc64"
633 ;;
634
635 *)
636 Echo_error "Architecture ${LB_ARCHITECTURE} not yet supported (FIXME)"
637 exit 1
638 ;;
639 esac
640 fi
641
642 # Set linux packages
643 if [ -z "${LB_LINUX_PACKAGES}" ]
644 then
645 case "${LB_MODE}" in
646 debian|debian-release|embedian)
647 case "${LB_DISTRIBUTION}" in
648 lenny)
649 LB_LINUX_PACKAGES="linux-image-2.6 \${LB_UNION_FILESYSTEM}-modules-2.6"
650 ;;
651
652 *)
653 LB_LINUX_PACKAGES="linux-image-2.6"
654 ;;
655 esac
656
657 if [ "${LB_CHROOT_FILESYSTEM}" = "squashfs" ]
658 then
659 case "${LB_DISTRIBUTION}" in
660 lenny)
661 LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES} squashfs-modules-2.6"
662 ;;
663 esac
664 fi
665
666 case "${LB_ENCRYPTION}" in
667 ""|false)
668
669 ;;
670
671 *)
672 LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES} loop-aes-modules-2.6"
673 ;;
674 esac
675 ;;
676
677 ubuntu)
678 LB_LINUX_PACKAGES="linux"
679 ;;
680 esac
681 fi
682
683 # Setting packages string
684 case "${LB_MODE}" in
685 ubuntu)
686 LB_PACKAGES="${LB_PACKAGES:-ubuntu-minimal}"
687 ;;
688
689 *)
690 LB_PACKAGES_LISTS="${LB_PACKAGES_LISTS:-standard}"
691 ;;
692 esac
693
694 case "${LB_ENCRYPTION}" in
695 ""|false)
696
697 ;;
698
699 *)
700 if ! In_list loop-aes-utils "${LB_PACKAGES}"
701 then
702 LB_PACKAGES="${LB_PACKAGES} loop-aes-utils"
703 fi
704 ;;
705 esac
706
707 # Setting tasks string
708 for LIST in ${LB_PACKAGES_LISTS}
709 do
710 case "${LIST}" in
711 stripped|minimal)
712 LB_APT="apt-get"
713 ;;
714
715 gnome-desktop)
716 LB_PACKAGES_LISTS="$(echo ${LB_PACKAGES_LISTS} | sed -e 's|gnome-desktop||') standard-x11"
717 case "${LB_DISTRIBUTION}" in
718 lenny)
719 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|gnome-desktop||' -e 's|desktop||') standard gnome-desktop desktop"
720 ;;
721
722 *)
723 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|gnome-desktop||' -e 's|desktop||' -e 's|laptop||') standard gnome-desktop desktop laptop"
724 ;;
725 esac
726 ;;
727
728 kde-desktop)
729 LB_PACKAGES_LISTS="$(echo ${LB_PACKAGES_LISTS} | sed -e 's|kde-desktop||') standard-x11"
730
731 case "${LB_DISTRIBUTION}" in
732 lenny)
733 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|kde-desktop||' -e 's|desktop||') standard kde-desktop desktop"
734 ;;
735
736 *)
737 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|kde-desktop||' -e 's|desktop||' -e 's|laptop||') standard kde-desktop desktop laptop"
738 esac
739 ;;
740
741 lxde-desktop)
742 LB_PACKAGES_LISTS="$(echo ${LB_PACKAGES_LISTS} | sed -e 's|lxde-desktop||') standard-x11"
743
744 case "${LB_DISTRIBUTION}" in
745 lenny)
746 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|lxde-desktop||' -e 's|desktop||') standard lxde-desktop desktop"
747 ;;
748
749 *)
750 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|lxde-desktop||' -e 's|desktop||' -e 's|laptop||') standard lxde-desktop desktop laptop"
751 ;;
752 esac
753 ;;
754
755 xfce-desktop)
756 LB_PACKAGES_LISTS="$(echo ${LB_PACKAGES_LISTS} | sed -e 's|xfce-desktop||') standard-x11"
757
758 case "${LB_DISTRIBUTION}" in
759 lenny)
760 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|xfce-desktop||' -e 's|desktop||') standard xfce-desktop desktop"
761 ;;
762
763 *)
764 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's|standard||' -e 's|xfce-desktop||' -e 's|desktop||' -e 's|laptop||') standard xfce-desktop desktop laptop"
765 ;;
766 esac
767 ;;
768 esac
769 done
770
771 LB_PACKAGES_LISTS="$(echo ${LB_PACKAGES_LISTS} | sed -e 's| ||g')"
772 LB_TASKS="$(echo ${LB_TASKS} | sed -e 's| ||g')"
773
774 # Setting security updates option
775 if [ "${LB_MIRROR_CHROOT_SECURITY}" = "none" ] || [ "${LB_MIRROR_BINARY_SECURITY}" = "none" ]
776 then
777 LB_SECURITY="false"
778 fi
779
780 LB_SECURITY="${LB_SECURITY:-true}"
781
782 # Setting volatile updates option
783 if [ "${LB_MIRROR_CHROOT_VOLATILE}" = "none" ] || [ "${LB_MIRROR_BINARY_VOLATILE}" = "none" ]
784 then
785 LB_VOLATILE="false"
786 fi
787
788 LB_VOLATILE="${LB_VOLATILE:-true}"
789
790 # Setting symlink convertion option
791 LB_SYMLINKS="${LB_SYMLINKS:-false}"
792
793 # Setting sysvinit option
794 LB_SYSVINIT="${LB_SYSVINIT:-false}"
795
796 ## config/binary
797
798 # Setting image filesystem
799 case "${LB_ARCHITECTURE}" in
800 sparc)
801 LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-ext2}"
802 ;;
803
804 *)
805 LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-fat16}"
806 ;;
807 esac
808
809 # Setting image type
810 case "${LB_DISTRIBUTION}" in
811 squeeze|sid)
812 case "${LB_ARCHITECTURE}" in
813 amd64|i386)
814 LB_BINARY_IMAGES="${LB_BINARY_IMAGES:-iso-hybrid}"
815 ;;
816
817 *)
818 LB_BINARY_IMAGES="${LB_BINARY_IMAGES:-iso}"
819 ;;
820 esac
821 ;;
822
823 *)
824 LB_BINARY_IMAGES="${LB_BINARY_IMAGES:-iso}"
825 ;;
826 esac
827
828 # Setting apt indices
829 if echo ${LB_PACKAGES_LISTS} | grep -qs -E "(stripped|minimal)\b"
830 then
831 LB_BINARY_INDICES="${LB_BINARY_INDICES:-none}"
832 else
833 LB_BINARY_INDICES="${LB_BINARY_INDICES:-true}"
834 fi
835
836 # Setting bootloader
837 if [ -z "${LB_BOOTLOADER}" ]
838 then
839 case "${LB_ARCHITECTURE}" in
840 amd64|i386)
841 LB_BOOTLOADER="syslinux"
842 ;;
843
844 powerpc)
845 LB_BOOTLOADER="yaboot"
846 ;;
847
848 sparc)
849 LB_BOOTLOADER="silo"
850 ;;
851 esac
852 fi
853
854 # Setting checksums
855 LB_CHECKSUMS="${LB_CHECKSUMS:-md5}"
856
857 # Setting chroot option
858 LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
859
860 # Setting debian-installer option
861 LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-false}"
862
863 # Setting debian-installer distribution
864 LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_DISTRIBUTION}}"
865
866 # Setting debian-installer-gui
867 case "${LB_MODE}" in
868 debian)
869 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"
870 ;;
871
872 ubuntu)
873 case "${LB_DEBIAN_INSTALLER_DISTRIBUTION}" in
874 karmic)
875 # Not available for Karmic currently.
876 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-false}"
877 ;;
878
879 *)
880 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"
881 ;;
882 esac
883 ;;
884
885 *)
886 LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-false}"
887 ;;
888 esac
889
890 # Setting debian-installer preseed filename
891 if [ -z "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
892 then
893 if Find_files config/binary_debian-installer/preseed.cfg
894 then
895 LB_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
896 fi
897
898 if Find_files config/binary_debian-installer/*.cfg && [ ! -e config/binary_debian-installer/preseed.cfg ]
899 then
900 Echo_warning "You have placed some preseeding files into config/binary_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."
901 fi
902 fi
903
904 # Setting boot parameters
905 # LB_BOOTAPPEND_LIVE
906 if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
907 then
908 case "${LB_BINARY_IMAGES}" in
909 iso*)
910 _LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
911 ;;
912
913 usb*)
914 if [ "${LB_MODE}" = "ubuntu" ] || [ "${LB_DEBIAN_INSTALLER}" = "live" ]
915 then
916 _LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
917 else
918 _LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
919 fi
920 ;;
921
922 net)
923 case "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" in
924 *://*)
925 _LB_BOOTAPPEND_PRESEED="file=${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
926 ;;
927
928 *)
929 _LB_BOOTAPPEND_PRESEED="file=/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
930 ;;
931 esac
932 ;;
933 esac
934 fi
935
936 case "${LB_BINARY_IMAGES}" in
937 iso-hybrid|usb*)
938 # Try USB block devices for install media
939 if ! echo "${LB_BOOTAPPEND_INSTALL}" | grep -q try-usb
940 then
941 LB_BOOTAPPEND_INSTALL="cdrom-detect/try-usb=true ${LB_BOOTAPPEND_INSTALL}"
942 fi
943 ;;
944 esac
945
946 if [ -n ${_LB_BOOTAPPEND_PRESEED} ]
947 then
948 LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL} ${_LB_BOOTAPPEND_PRESEED}"
949 fi
950
951 LB_BOOTAPPEND_INSTALL="$(echo ${LB_BOOTAPPEND_INSTALL} | sed -e 's/[ \t]*$//')"
952
953 # Setting encryption
954 LB_ENCRYPTION="${LB_ENCRYPTION:-false}"
955
956 # Setting grub splash
957 # LB_GRUB_SPLASH
958
959 # Setting hostname
960 if [ -z "${LB_HOSTNAME}" ]
961 then
962 case "${LB_MODE}" in
963 embedian)
964 LB_HOSTNAME="embedian"
965 ;;
966
967 ubuntu)
968 LB_HOSTNAME="ubuntu"
969 ;;
970
971 *)
972 LB_HOSTNAME="debian"
973 ;;
974 esac
975 fi
976
977 # Setting iso author
978 if [ -z "${LB_ISO_APPLICATION}" ]
979 then
980 case "${LB_MODE}" in
981 debian|debian-release)
982 LB_ISO_APPLICATION="Debian Live"
983 ;;
984
985 emdebian)
986 LB_ISO_APPLICATION="Emdebian Live"
987 ;;
988
989 ubuntu)
990 LB_ISO_APPLICATION="Ubuntu Live"
991 ;;
992 esac
993 fi
994
995 # Set iso preparer
996 LB_ISO_PREPARER="${LB_ISO_PREPARER:-live-build \$VERSION; http://packages.qa.debian.org/live-build}"
997
998 # Set iso publisher
999 LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER:-Debian Live project; http://live.debian.net/; debian-live@lists.debian.org}"
1000
1001 # Setting iso volume
1002 if [ -z "${LB_ISO_VOLUME}" ]
1003 then
1004 case "${LB_MODE}" in
1005 debian)
1006 LB_ISO_VOLUME="Debian ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
1007 ;;
1008
1009 debian-release)
1010 eval VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`"
1011 LB_ISO_VOLUME="Debian ${VERSION} ${LB_ARCHITECTURE} live"
1012 ;;
1013
1014 emdebian)
1015 LB_ISO_VOLUME="Emdebian ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
1016 ;;
1017
1018 ubuntu)
1019 LB_ISO_VOLUME="Ubuntu ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
1020 ;;
1021 esac
1022 fi
1023
1024 # Setting memtest option
1025 LB_MEMTEST="${LB_MEMTEST:-memtest86+}"
1026
1027 # Setting win32-loader option
1028 if [ "${LB_MODE}" != "ubuntu" ]
1029 then
1030 case "${LB_ARCHITECTURE}" in
1031 amd64|i386)
1032 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
1033 then
1034 LB_WIN32_LOADER="${LB_WIN32_LOADER:-true}"
1035 else
1036 LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
1037 fi
1038 ;;
1039
1040 *)
1041 LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
1042 ;;
1043 esac
1044 fi
1045
1046 # Setting netboot filesystem
1047 LB_NET_ROOT_FILESYSTEM="${LB_NET_ROOT_FILESYSTEM:-nfs}"
1048
1049 # Setting netboot server path
1050 if [ -z "${LB_NET_ROOT_PATH}" ]
1051 then
1052 case "${LB_MODE}" in
1053 debian|debian-release)
1054 LB_NET_ROOT_PATH="/srv/debian-live"
1055 ;;
1056
1057 emdebian)
1058 LB_NET_ROOT_PATH="/srv/emdebian-live"
1059 ;;
1060
1061 ubuntu)
1062 LB_NET_ROOT_PATH="/srv/ubuntu-live"
1063 ;;
1064 esac
1065 fi
1066
1067 # Setting netboot server address
1068 LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER:-192.168.1.1}"
1069
1070 # Setting net cow filesystem
1071 LB_NET_COW_FILESYSTEM="${LB_NET_COW_FILESYSTEM:-nfs}"
1072
1073 # Setting net tarball
1074 LB_NET_TARBALL="${LB_NET_TARBALL:-gzip}"
1075
1076 # Setting syslinux configuration file
1077 # LB_SYSLINUX_CFG
1078
1079 # Setting syslinux splash
1080 # LB_SYSLINUX_SPLASH
1081
1082 LB_SYSLINUX_TIMEOUT="${LB_SYSLINUX_TIMEOUT:-0}"
1083
1084 # Setting syslinux menu
1085 LB_SYSLINUX_MENU="${LB_SYSLINUX_MENU:-true}"
1086
1087 # Setting syslinux menu live entries
1088 case "${LB_MODE}" in
1089 debian|debian-release)
1090 LB_SYSLINUX_MENU_LIVE_ENTRY="${LB_SYSLINUX_MENU_LIVE_ENTRY:-Live}"
1091 LB_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE="${LB_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE:-${LB_SYSLINUX_MENU_LIVE_ENTRY} (failsafe)}"
1092 ;;
1093
1094 *)
1095 LB_SYSLINUX_MENU_LIVE_ENTRY="${LB_SYSLINUX_MENU_LIVE_ENTRY:-Start ${LB_ISO_APPLICATION}}"
1096 LB_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE="${LB_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE:-${LB_SYSLINUX_MENU_LIVE_ENTRY} (failsafe)}"
1097 ;;
1098 esac
1099
1100 # Settings memtest menu entry
1101 LB_SYSLINUX_MENU_MEMTEST_ENTRY="${LB_SYSLINUX_MENU_MEMTEST_ENTRY:-Memory test}"
1102
1103 # Setting username
1104 case "${LB_MODE}" in
1105 ubuntu)
1106 LB_USERNAME="${LB_USERNAME:-ubuntu}"
1107 ;;
1108
1109 *)
1110 LB_USERNAME="${LB_USERNAME:-user}"
1111 ;;
1112 esac
1113
1114 ## config/source
1115
1116 # Setting source option
1117 LB_SOURCE="${LB_SOURCE:-false}"
1118
1119 # Setting image type
1120 LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES:-tar}"
1121
1122 # Setting fakeroot/fakechroot
1123 LB_USE_FAKEROOT="${LB_USE_FAKEROOT:-false}"
1124 }
1125
1126 Check_defaults ()
1127 {
1128 if [ "${LB_CONFIG_VERSION}" ]
1129 then
1130 # We're only checking when we're actually running the checks
1131 # that's why the check for emptyness of the version;
1132 # however, as live-build always declares LB_CONFIG_VERSION
1133 # internally, this is safe assumption (no cases where it's unset,
1134 # except when bootstrapping the functions/defaults etc.).
1135 CURRENT_CONFIG_VERSION="$(echo ${LB_CONFIG_VERSION} | awk -F. '{ print $1 }')"
1136
1137 if [ ${CURRENT_CONFIG_VERSION} -ge 3 ]
1138 then
1139 Echo_error "This config tree is too new for this version of live-build (${VERSION})."
1140 Echo_error "Aborting build, please get a new version of live-build."
1141
1142 exit 1
1143 elif [ ${CURRENT_CONFIG_VERSION} -eq 1 ]
1144 then
1145 Echo_error "This config tree is too old for this version of live-build (${VERSION})."
1146 Echo_error "Aborting build, please repopulate the config tree."
1147 exit 1
1148 elif [ ${CURRENT_CONFIG_VERSION} -lt 1 ]
1149 then
1150 Echo_warning "This config tree does not specify a format version or has an unknown version number."
1151 Echo_warning "Continuing build, but it could lead to errors or different results. Please repopulate the config tree."
1152 fi
1153 fi
1154
1155 if echo ${LB_PACKAGES_LISTS} | grep -qs -E "(stripped|minimal)\b"
1156 then
1157 # aptitude + stripped|minimal
1158 if [ "${LB_APT}" = "aptitude" ]
1159 then
1160 Echo_warning "You selected LB_PACKAGES_LISTS='%s' and LB_APT='aptitude'" "${LB_PACKAGES_LIST}. This configuration is potentially unsafe, as aptitude is not used in the stripped/minimal package lists."
1161 fi
1162 fi
1163
1164 if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
1165 then
1166 # d-i true, no caching
1167 if ! echo ${LB_CACHE_STAGES} | grep -qs "bootstrap\b" || [ "${LB_CACHE}" != "true" ] || [ "${LB_CACHE_PACKAGES}" != "true" ]
1168 then
1169 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."
1170 fi
1171 fi
1172
1173 if [ "${LB_BOOTLOADER}" = "syslinux" ]
1174 then
1175 # syslinux + fat
1176 case "${LB_BINARY_FILESYSTEM}" in
1177 fat*)
1178 ;;
1179 *)
1180 Echo_warning "You have selected values of LB_BOOTLOADER and LB_BINARY_FILESYSTEM which are incompatible - syslinux only supports FAT filesystems."
1181 ;;
1182 esac
1183 fi
1184
1185 case "${LB_BINARY_IMAGES}" in
1186 usb*)
1187 # grub or yaboot + usb
1188 case "${LB_BOOTLOADER}" in
1189 grub|yaboot)
1190 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."
1191 exit 1
1192 ;;
1193 esac
1194 ;;
1195 esac
1196
1197 if [ "$(echo ${LB_ISO_APPLICATION} | wc -c)" -gt 128 ]
1198 then
1199 Echo_warning "You have specified a value of LB_ISO_APPLICATION that is too long; the maximum length is 128 characters."
1200 fi
1201
1202 if [ "$(echo ${LB_ISO_PREPARER} | wc -c)" -gt 128 ]
1203 then
1204 Echo_warning "You have specified a value of LB_ISO_PREPARER that is too long; the maximum length is 128 characters."
1205 fi
1206
1207 if [ "$(echo ${LB_ISO_PUBLISHER} | wc -c)" -gt 128 ]
1208 then
1209 Echo_warning "You have specified a value of LB_ISO_PUBLISHER that is too long; the maximum length is 128 characters."
1210 fi
1211
1212 if [ "$(eval "echo ${LB_ISO_VOLUME}" | wc -c)" -gt 32 ]
1213 then
1214 Echo_warning "You have specified a value of LB_ISO_VOLUME that is too long; the maximum length is 32 characters."
1215 fi
1216
1217 if echo ${LB_PACKAGES_LISTS} | grep -qs -E "(stripped|minimal)\b"
1218 then
1219 if [ "${LB_BINARY_INDICES}" = "true" ]
1220 then
1221 Echo_warning "You have selected hook to minimise image size but you are still including package indices with your value of LB_BINARY_INDICES."
1222 fi
1223 fi
1224
1225 }