1
2
3
4
5
6
7
8
9
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
|
#! /bin/sh
set -e
rm -rf config
echo "Building on $(hostname --fqdn)"
SEEDMIRROR=http://people.canonical.com/~ubuntu-archive/seeds/
if [ -z "$MIRROR" ]; then
case $(hostname --fqdn) in
bld-*.mmjgroup.com) ;;
*.mmjgroup.com)
case $ARCH in
i386|amd64) MIRROR=http://archive.mmjgroup.com/ubuntu/ ;;
*) MIRROR=http://archive.mmjgroup.com/ubuntu-ports/ ;;
esac
;;
*.0c3.net)
case $ARCH in
i386|amd64) MIRROR=http://mirrors.0c3.net/ubuntu/ ;;
*) MIRROR=http://mirrors.0c3.net/ubuntu-ports/ ;;
esac
;;
*.ubuntu.com) MIRROR=http://ftpmaster.internal/ubuntu/
SEEDMIRROR=http://archive-team.internal/seeds/
;;
*.warthogs.hbd.com) MIRROR=http://ftpmaster.internal/ubuntu/
SEEDMIRROR=http://archive-team.internal/seeds/
;;
*.buildd) MIRROR=http://ftpmaster.internal/ubuntu/
SEEDMIRROR=http://archive-team.internal/seeds/
;;
esac
fi
mkdir -p config
cp -af /usr/share/livecd-rootfs/live-build/functions config/functions
mkdir -p config/package-lists
add_task ()
{
local pass="$1"
shift
local task
# The removal of direct task installation support from live-build
# poses some problems. If the chroot has multiarch configured - for
# example, if we're building for amd64 - then dumpavail will show
# foreign-architecture packages which will have their own Task
# lines, but which we don't want to install. (Compare
# PackageContainerInterface::FromTask in apt, which restricts task
# expansion to the native architecture.) We therefore restrict our
# search to stanzas with Architecture: $ARCH or all.
#
# However, even this may not be accurate enough. At the moment I
# have no idea what happens if an Architecture: all package has
# different Task fields on different architectures. This is
# probably a lurking timebomb that we need to fix. In the meantime,
# the Architecture restriction at least saves us from abject
# failure.
for task; do
# We need a ridiculous number of backslashes to protect
# parentheses from eval.
echo "!chroot chroot apt-cache dumpavail | grep-dctrl -nsPackage \\\\\\( -XFArchitecture $ARCH -o -XFArchitecture all \\\\\\) -a -wFTask $task" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
done
}
add_package ()
{
local pass="$1"
shift
local pkg
for pkg; do
echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
done
}
OPTS=
COMPONENTS=
BINARY_REMOVE_LINUX=:
BINARY_IMAGES=none
MEMTEST=none
SOURCE='--source false'
BOOTLOADER=none
BOOTAPPEND_LIVE=
LIVE_TASK=
PREINSTALLED=false
PREINSTALL_POOL=
PREINSTALL_POOL_SEEDS=
PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
CHROOT_HOOKS=
BINARY_HOOKS=
APT_OPTIONS=" --yes -oDebug::pkgDepCache::AutoInstall=yes "
add_chroot_hook ()
{
CHROOT_HOOKS="${CHROOT_HOOKS:+$CHROOT_HOOKS }$1"
}
add_binary_hook ()
{
BINARY_HOOKS="${BINARY_HOOKS:+$BINARY_HOOKS }$1"
}
if [ -z "${IMAGEFORMAT:-}" ]; then
case $PROJECT:${SUBPROJECT:-} in
ubuntu-cpc:*)
IMAGEFORMAT=ext4
;;
ubuntu-server:live)
IMAGEFORMAT=plain
;;
esac
fi
case $IMAGEFORMAT in
ext2|ext3|ext4)
OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT"
PREINSTALLED=true
case ${SUBPROJECT:-} in
wubi)
add_package install lupin-support
COMPONENTS='main restricted universe multiverse'
;;
*)
case $PROJECT in
ubuntu-cpc)
;;
*)
add_package live jasper
;;
esac
;;
esac
;;
plain)
INITRAMFS_TYPE=none
case $PROJECT:${SUBPROJECT:-} in
ubuntu-server:live)
add_package live lupin-casper
INITRAMFS_TYPE=auto
;;
*)
PREINSTALLED=true
;;
esac
OPTS="${OPTS:+$OPTS }--initramfs $INITRAMFS_TYPE --chroot-filesystem $IMAGEFORMAT"
;;
ubuntu-image)
case "$ARCH+${SUBARCH:-}" in
amd64+*)
MODEL=pc-amd64 ;;
i386+*)
MODEL=pc-i386 ;;
arm64+snapdragon)
MODEL=dragonboard ;;
armhf+raspi2)
MODEL=pi2 ;;
armhf+raspi3)
MODEL=pi3 ;;
armhf+cm3)
MODEL=cm3 ;;
*)
echo "Model $ARCH+${SUBARCH:-} unknown to livecd-rootfs" >&2
exit 1
;;
esac
case $MODEL in
pc-amd64|pc-i386)
UBUNTU_IMAGE_ARGS="--image-size 3700M" ;;
*)
UBUNTU_IMAGE_ARGS="" ;;
esac
echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
# Store model assertion in top dir to get it picked up later as a build artifact
env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion
echo "Configured ubuntu-image for the following model assertion:"
cat "$PREFIX".model-assertion
echo "----------------------------------------------------------"
# Fake finished configuration for lb build
mkdir -p .build
touch .build/config
exit 0
;;
none)
OPTS="${OPTS:+$OPTS }--chroot-filesystem $IMAGEFORMAT"
;;
*)
case $PROJECT in
ubuntu-server|ubuntu-touch|ubuntu-touch-custom)
;;
*)
add_package live lupin-casper
;;
esac
;;
esac
if [ "$PREINSTALLED" = "true" ]; then
# This is an oem-config preinstalled image, touch a random file that
# we can refer back to during build, cause that's wildly hackish
touch config/oem-config-preinstalled
case $PROJECT in
kubuntu*)
add_package live oem-config-kde ubiquity-frontend-kde
add_package live ubiquity-slideshow-kubuntu
;;
lubuntu*)
add_package live oem-config-gtk ubiquity-frontend-gtk
add_package live ubiquity-slideshow-lubuntu
;;
xubuntu*)
add_package live oem-config-gtk ubiquity-frontend-gtk
add_package live ubiquity-slideshow-xubuntu
;;
ubuntu-mate)
add_package live oem-config-gtk ubiquity-frontend-gtk
add_package live ubiquity-slideshow-ubuntu-mate
;;
ubuntu-server)
add_package live oem-config-debconf ubiquity-frontend-debconf
;;
ubuntu-core|ubuntu-base|base|ubuntu-touch|ubuntu-touch-custom|ubuntu-cpc|ubuntu-desktop-next)
;;
*)
add_package live oem-config-gtk ubiquity-frontend-gtk
add_package live ubiquity-slideshow-ubuntu
;;
esac
fi
case $BINARYFORMAT in
iso*|usb*)
BINARY_IMAGES="$BINARYFORMAT"
MEMTEST=memtest86+
BOOTLOADER=syslinux
OPTS="${OPTS:+$OPTS }--zsync=false"
;;
esac
SIGNED_KERNEL_PACKAGE="linux-signed-generic"
if [ "${SUBPROJECT:-}" = minimized ]; then
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal --linux-packages=linux-image"
fi
case $PROJECT in
ubuntu|ubuntu-dvd)
add_task install minimal standard ubuntu-desktop
LIVE_TASK='ubuntu-live'
case $ARCH in
amd64) add_package live $SIGNED_KERNEL_PACKAGE ;;
esac
;;
ubuntu-desktop-next)
add_task install minimal standard ubuntu-desktop-next ubuntu-sdk-libs
COMPONENTS='main restricted universe'
LIVE_TASK='ubuntu-touch-live'
KERNEL_FLAVOURS=generic
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
# system image snappy desktop next image
# mvo: This is for cron.daily-preinstalled
# CDIMAGE_PREINSTALLED is not passed from build.py
# and PREINSTALLED means something different. So
# we use SUBPROJECT to pass on the information
if [ "${SUBPROJECT:-}" = "system-image" ]; then
OPTS="${OPTS:+$OPTS }--linux-packages=linux-image"
fi
;;
kubuntu|kubuntu-dvd)
add_task install minimal standard
add_task install kubuntu-desktop
LIVE_TASK='kubuntu-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe'
add_chroot_hook remove-gnome-icon-cache
;;
kubuntu-active)
add_task install minimal standard kubuntu-active
LIVE_TASK='kubuntu-active-live'
COMPONENTS='main restricted universe'
add_chroot_hook remove-gnome-icon-cache
;;
kubuntu-plasma5)
add_task install minimal standard
add_package install kubuntu-plasma5-desktop
# Technically cheating, but PPAs don't have tasks and the
# live seed doesn't have a corresponding metapackage. We'll
# get away with this as long as kubuntu-desktop and
# kubuntu-plasma5-desktop don't grow too far apart.
LIVE_TASK='kubuntu-live'
COMPONENTS='main restricted universe'
add_chroot_hook remove-gnome-icon-cache
;;
edubuntu|edubuntu-dvd)
add_task install minimal standard ubuntu-desktop edubuntu-desktop-gnome
LIVE_TASK='edubuntu-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe'
;;
xubuntu)
add_task install minimal standard xubuntu-desktop
add_package install xterm
LIVE_TASK='xubuntu-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe multiverse'
case $ARCH in
amd64|i386) KERNEL_FLAVOURS=generic ;;
esac
;;
ubuntu-netbook)
add_task install minimal standard ubuntu-netbook
LIVE_TASK='netbook-live'
;;
mythbuntu)
add_task install minimal standard mythbuntu-desktop
LIVE_TASK='mythbuntu-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe multiverse'
;;
lubuntu)
add_task install minimal standard lubuntu-desktop
LIVE_TASK='lubuntu-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe multiverse'
case $ARCH in
amd64|i386) KERNEL_FLAVOURS=generic ;;
esac
# The Lubuntu STRUCTURE file has "feature
# no-follow-recommends". Mirror this.
APT_OPTIONS="${APT_OPTIONS} --no-install-recommends"
;;
lubuntu-next)
add_task install minimal standard lubuntu-qt-desktop
LIVE_TASK='lubuntu-live-qt'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe multiverse'
case $ARCH in
amd64|i386) KERNEL_FLAVOURS=generic ;;
esac
# The Lubuntu STRUCTURE file has "feature
# no-follow-recommends". Mirror this.
APT_OPTIONS="${APT_OPTIONS} --no-install-recommends"
;;
ubuntu-gnome)
add_task install minimal standard ubuntu-gnome-desktop
LIVE_TASK='ubuntu-gnome-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe'
;;
ubuntu-budgie)
add_task install minimal standard ubuntu-budgie-desktop
LIVE_TASK='ubuntu-budgie-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe'
;;
ubuntu-mate)
add_task install minimal standard ubuntu-mate-core ubuntu-mate-desktop
LIVE_TASK='ubuntu-mate-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe multiverse'
;;
ubuntustudio-dvd)
add_task install minimal standard ubuntustudio-desktop ubuntustudio-audio ubuntustudio-fonts ubuntustudio-graphics ubuntustudio-video ubuntustudio-publishing ubuntustudio-photography
COMPONENTS='main restricted universe multiverse'
case $ARCH in
amd64|i386) KERNEL_FLAVOURS=lowlatency ;;
esac
;;
ubuntukylin)
add_task install minimal standard ubuntukylin-desktop
add_package install ubuntukylin-default-settings
LIVE_TASK='ubuntukylin-live'
case $ARCH in
amd64) add_package live linux-signed-generic ;;
esac
COMPONENTS='main restricted universe'
;;
base)
add_task install minimal standard
;;
ubuntu-server)
add_task install minimal
case ${SUBPROJECT:-} in
live)
add_task install standard
add_task install server
LIVE_TASK='cloud-image'
;;
esac
COMPONENTS='main'
PREINSTALL_POOL_SEEDS='server-ship'
;;
ubuntu-core)
OPTS="${OPTS:+$OPTS }--apt-recommends false"
# some workarounds because the seeds are not quite
# corrent at the moment
add_package install dbus
add_package install isc-dhcp-client
add_package install libpam-systemd
add_package install ppp
add_package install watchdog
# no Task: header yet
add_package install snapd
add_package install ubuntu-core-snapd-units
add_package install nplan
# we want all arches to have u-boot-tools
add_package install u-boot-tools
# no minimal as we want to be really minimal
#add_task install minimal
add_task install ubuntu-core
# more packages are pulled in via the seed.
# (important to remember when comparing to the
# livecd-rootfs from ppa:snappy-dev/image)
case $ARCH in
i386)
# efi support can go once the task
# header is available for grub-efi-ia32-bin
add_package install grub-efi-ia32-bin
;;
esac
# generic kernel etc
KERNEL_FLAVOURS=none
case $ARCH in
i386)
add_package install grub-pc
;;
amd64)
add_package install grub-pc-bin
add_package install grub-efi-amd64-signed
add_package install shim-signed
;;
esac
OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none --initramfs-compression=none"
# contains the framework definition
add_package install ubuntu-core-libs
# universe needed for 'system-image-cli' and multiverse for firmware
COMPONENTS='main restricted universe multiverse'
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
;;
ubuntu-base)
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
;;
ubuntu-touch|ubuntu-touch-custom)
HINTS="packagekit ubuntu-system-settings"
case $ARCH in
amd64|i386)
HINTS="$HINTS qml-module-ubuntu-components-gles unity8"
;;
esac
add_package install ubuntu-minimal ubuntu-touch $HINTS
COMPONENTS='main restricted universe'
BOOTAPPEND_LIVE='hostname=ubuntu-phablet username=ubuntu'
export LB_BOOTSTRAP_INCLUDE='apt-transport-https gnupg'
OPTS="${OPTS:+$OPTS }--apt-recommends false"
OPTS="${OPTS:+$OPTS }--compression gzip"
OPTS="${OPTS:+$OPTS }--system normal"
OPTS="${OPTS:+$OPTS }--zsync false"
# TODO cjwatson 2014-07-17: This is a bit of an abuse of
# SUBPROJECT, but it's a handy thing that launchpad-buildd
# already passes through to us that we weren't otherwise
# using here.
case ${SUBPROJECT:-} in
ubuntu-rtm/dogfood)
MIRROR=http://derived-archive.dogfood.content.paddev.net/ubuntu-rtm/
OPTS="${OPTS:+$OPTS }--apt-secure false"
OPTS="${OPTS:+$OPTS }--mirror-chroot-security ${MIRROR}"
OPTS="${OPTS:+$OPTS }--mirror-binary-security ${MIRROR}"
OPTS="${OPTS:+$OPTS }--mirror-binary ${MIRROR}"
;;
ubuntu-rtm)
MIRROR=http://derived.archive.canonical.com/ubuntu-rtm/
OPTS="${OPTS:+$OPTS }--mirror-chroot-security ${MIRROR}"
OPTS="${OPTS:+$OPTS }--mirror-binary-security ${MIRROR}"
OPTS="${OPTS:+$OPTS }--mirror-binary ${MIRROR}"
;;
esac
;;
ubuntu-cpc)
if [ "${SUBPROJECT:-}" = minimized ]; then
add_task install cloud-image
add_package install sudo
# linux-kvm currently only exists in xenial, not in
# non-LTS suites. Fall back to virtual flavor, which
# may or may not boot initramfsless but enables us to
# test building and possibly build derivative images
# using other kernel flavors.
# If you enable an extra ppa, it is assumed that
# linux-kvm is available since you control the
# archive and can provide this metapackage as
# necessary.
if [ "$ARCH" != "amd64" ] || ([ -z "$EXTRA_PPAS" ] && [ "$SUITE" != xenial ]); then
KERNEL_FLAVOURS=virtual
else
KERNEL_FLAVOURS=kvm
fi
else
add_task install minimal standard cloud-image
add_package install ubuntu-minimal
KERNEL_FLAVOURS=virtual
case $ARCH in
armhf|arm64|ppc64el|powerpc)
add_task install server
;;
esac
fi
BINARY_REMOVE_LINUX=false
OPTS="${OPTS:+$OPTS }--initramfs=none"
case $ARCH in
armhf)
KERNEL_FLAVOURS=generic-lpae
add_package install flash-kernel
;;
arm64)
add_package install flash-kernel
;;
esac
OPTS="${OPTS:+$OPTS }--system=normal"
OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs"
OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096"
OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15"
;;
*)
echo "unknown project $PROJECT" >&2
exit 2
;;
esac
export APT_OPTIONS
if [ "$PREINSTALLED" != "true" ] && [ "$LIVE_TASK" ]; then
add_task live "$LIVE_TASK"
fi
case $PROJECT in
ubuntu-dvd)
add_task install ubuntu-usb
add_task live ubuntu-usb-live
;;
*-dvd)
add_task live "$PROJECT-live"
;;
esac
case $ARCH in
armel|armhf)
KERNEL_FLAVOURS="${SUBARCH:-$KERNEL_FLAVOURS}"
case $SUBARCH in
dove)
BINARY_REMOVE_LINUX=false
;;
omap)
add_package install u-boot-linaro-omap3-beagle u-boot-tools
BINARY_REMOVE_LINUX=false
;;
omap4)
case $PROJECT in
ubuntu-server|ubuntu-core|base)
add_package install u-boot-linaro-omap4-panda u-boot-tools
;;
*)
add_package install u-boot-linaro-omap4-panda u-boot-tools pvr-omap4
;;
esac
BINARY_REMOVE_LINUX=false
;;
mx5)
COMPONENTS='main restricted universe'
KERNEL_FLAVOURS=linaro-lt-mx5
add_package install flash-kernel u-boot-linaro-mx53loco u-boot-tools
BINARY_REMOVE_LINUX=false
;;
ac100)
COMPONENTS='main restricted universe multiverse'
add_package install zram-config abootimg
add_package live ac100-tarball-installer
BINARY_REMOVE_LINUX=false
;;
nexus7)
COMPONENTS='main restricted universe multiverse'
add_package install zram-config abootimg
add_package install nvidia-tegra3 ubuntu-defaults-nexus7
add_package live ac100-tarball-installer
BINARY_REMOVE_LINUX=false
mkdir -p config/preseed
echo "linux-firmware-nexus7 shared/nexus7_notice_accepted boolean true" >config/preseed/linux-firmware-nexus7.preseed.chroot
echo "d-i passwd/auto-login boolean true" >config/preseed/autologin.preseed.chroot
;;
raspi2)
COMPONENTS='main restricted universe multiverse'
add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools
BINARY_REMOVE_LINUX=false
;;
esac
;;
esac
case $PROJECT:${SUBPROJECT:-} in
ubuntu-server:live)
;;
ubuntu-server:*|ubuntu-base:*|ubuntu-touch:*|ubuntu-touch-custom:*)
OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none"
KERNEL_FLAVOURS=none
BINARY_REMOVE_LINUX=false
;;
esac
add_chroot_hook update-apt-file-cache
add_chroot_hook update-apt-xapian-index
add_chroot_hook update-mlocate-database
add_chroot_hook remove-dbus-machine-id
add_chroot_hook remove-openssh-server-host-keys
add_chroot_hook remove-udev-persistent-rules
case $PROJECT in
# if any flavours want to strip .pyc files from their live images, add them here
_)
add_chroot_hook remove-python-py
;;
esac
case ${SUBPROJECT:-} in
wubi)
add_binary_hook build-wubildr
;;
esac
lb config noauto \
--mode ubuntu \
--distribution "$SUITE" \
--iso-preparer "livecd-rootfs" \
--bootstrap-keyring ubuntu-keyring \
--binary-images "$BINARY_IMAGES" \
--memtest "$MEMTEST" \
$SOURCE \
--build-with-chroot false \
${MIRROR:+--parent-mirror-bootstrap $MIRROR} \
${COMPONENTS:+--parent-archive-areas "$COMPONENTS"} \
--apt-source-archives false \
${KERNEL_FLAVOURS:+--linux-flavours "$KERNEL_FLAVOURS"} \
--initsystem none \
--bootloader "$BOOTLOADER" \
--initramfs-compression lzma \
--cache false \
${BOOTAPPEND_LIVE:+--bootappend-live "$BOOTAPPEND_LIVE"} \
$OPTS \
"$@"
echo "LB_CHROOT_HOOKS=\"$CHROOT_HOOKS\"" >> config/chroot
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot
echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary
echo "BUILDSTAMP=\"$NOW\"" >> config/binary
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary
case $ARCH+$SUBARCH in
armhf+raspi2)
cat > config/hooks/01-firmware-directory.chroot_early <<EOF
#!/bin/sh -ex
mkdir -p /boot/firmware
EOF
cat > config/hooks/999-raspi2-fixes.chroot <<EOF
#!/bin/sh -ex
cat >> /etc/fstab << EOM
LABEL=system-boot /boot/firmware vfat defaults 0 1
EOM
cat > /boot/firmware/cmdline.txt << EOM
net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
EOM
cat > /boot/firmware/config.txt << EOM
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
kernel=uboot.bin
device_tree_address=0x02000000
# enable i2c
dtparam=i2c_arm=on
dtparam=spi=on
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
EOM
EOF
;;
*)
;;
esac
if [ $PROJECT = ubuntu-server ] && [ ${SUBPROJECT:-} != live ]; then
cat > config/hooks/100-remove-fstab.chroot <<EOF
#! /bin/sh
rm -f /etc/fstab
EOF
fi
if [ $PROJECT = ubuntukylin ]; then
cat > config/hooks/100-ubuntukylin.chroot <<EOF
#! /bin/sh
set -e
HOOK=/usr/share/ubuntukylin-default-settings/hooks/chroot
if [ -x \$HOOK ]; then
exec \$HOOK
fi
exit 0
EOF
fi
if $BINARY_REMOVE_LINUX; then
cat > config/binary_rootfs/excludes << EOF
boot/vmlinu?-*
boot/initrd.img-*
EOF
fi
if [ "$PROPOSED" ]; then
. config/bootstrap
cat > config/archives/proposed.list.chroot << EOF
deb $LB_PARENT_MIRROR_BINARY_VOLATILE $SUITE-proposed $LB_PARENT_ARCHIVE_AREAS
EOF
cp -a config/archives/proposed.list.chroot \
config/archives/proposed.list.binary
fi
case $PROJECT:${SUBPROJECT:-} in
*-dvd:*)
. config/bootstrap
cat > config/archives/dvd.list.binary << EOF
deb $LB_PARENT_MIRROR_BINARY $SUITE universe multiverse
deb $LB_PARENT_MIRROR_BINARY_VOLATILE $SUITE-updates universe multiverse
deb $LB_PARENT_MIRROR_BINARY_SECURITY $SUITE-security universe multiverse
EOF
if [ "$PROPOSED" ]; then
cat >> config/archives/dvd.list.binary << EOF
deb $LB_PARENT_MIRROR_BINARY_VOLATILE $SUITE-proposed universe multiverse
EOF
fi
;;
ubuntu-touch:*|ubuntu-touch-custom:*|ubuntu-core:system-image|ubuntu-desktop-next:system-image|ubuntu-cpc:*|ubuntu-server:live)
cp -af /usr/share/livecd-rootfs/live-build/${PROJECT}/* \
config/
if [ "$IMAGEFORMAT" = none ]; then
rm -f config/hooks/*.binary*
fi
;;
esac
if [ "$EXTRA_PPAS" ]; then
rm -f config/archives/extra-ppas.list.chroot \
config/archives/extra-ppas.pref.chroot \
config/archives/extra-ppas.key.chroot
gpg_tmpdir="$(mktemp -d)"
run_gpg () {
gpg --no-default-keyring --no-options --homedir "$gpg_tmpdir" \
--secret-keyring "$gpg_tmpdir/secring.gpg" \
--keyserver hkp://keyserver.ubuntu.com:80/ \
"$@"
}
for extra_ppa in $EXTRA_PPAS; do
extra_ppa_pin=''
extra_ppa_origin=''
case $extra_ppa in
*:*)
extra_ppa_pin=${extra_ppa#*:}
extra_ppa=${extra_ppa%:*}
;;
esac
extra_ppa_fingerprint="$(/usr/share/livecd-rootfs/get-ppa-fingerprint "$extra_ppa")"
cat >> config/archives/extra-ppas.list.chroot <<EOF
deb http://ppa.launchpad.net/$extra_ppa/ubuntu @DISTRIBUTION@ main
deb-src http://ppa.launchpad.net/$extra_ppa/ubuntu @DISTRIBUTION@ main
EOF
if [ -n "$extra_ppa_pin" ]; then
extra_ppa_origin="LP-PPA-$(echo $extra_ppa | sed -e 's,/ppa$,,' -e 's,/,-,')"
echo "Package: *" >> config/archives/extra-ppas.pref.chroot
echo "Pin: release o=$extra_ppa_origin" >> config/archives/extra-ppas.pref.chroot
echo "Pin-Priority: $extra_ppa_pin" >> config/archives/extra-ppas.pref.chroot
echo "" >> config/archives/extra-ppas.pref.chroot
fi
run_gpg --keyring "$gpg_tmpdir/pubring.gpg" \
--recv "$extra_ppa_fingerprint"
run_gpg --keyring "$gpg_tmpdir/pubring.gpg" \
--output "$gpg_tmpdir/export.gpg" \
--export "$extra_ppa_fingerprint"
got_fingerprint="$(
run_gpg --keyring "$gpg_tmpdir/export.gpg" \
--fingerprint --batch --with-colons |
grep '^fpr:' | cut -d: -f10)"
if [ "$got_fingerprint" != "$extra_ppa_fingerprint" ]; then
echo "Fingerprints do not match. Got:" >&2
echo "$got_fingerprint" | sed 's/^/ /' >&2
echo "Expected:" >&2
echo " $extra_ppa_fingerprint" >&2
exit 1
fi
cat "$gpg_tmpdir/export.gpg" >> config/archives/extra-ppas.key.chroot
rm -f "$gpg_tmpdir/export.gpg"
done
rm -rf "$gpg_tmpdir"
cp -a config/archives/extra-ppas.list.chroot \
config/archives/extra-ppas.list.binary
cp -a config/archives/extra-ppas.key.chroot \
config/archives/extra-ppas.key.binary
if [ -f config/archives/extra-ppas.pref.chroot ]; then
cp -a config/archives/extra-ppas.pref.chroot \
config/archives/extra-ppas.pref.binary
fi
fi
case ${SUBPROJECT:-} in
ubuntu-rtm|ubuntu-rtm/*)
# debootstrap doesn't know about ubuntu-rtm series directly. Rather
# than having to teach it, we employ a few hacks to make it use the
# Ubuntu script instead.
mkdir -p config/fake_debootstrap_dir/scripts
ln -s /usr/share/debootstrap/devices.tar.gz \
config/fake_debootstrap_dir/
ln -s /usr/share/debootstrap/functions config/fake_debootstrap_dir/
ln -s /usr/share/debootstrap/scripts/gutsy \
"config/fake_debootstrap_dir/scripts/$SUITE"
echo 'export DEBOOTSTRAP_DIR="$PWD/config/fake_debootstrap_dir"' \
>> config/bootstrap
;;
esac
# cribbed from cdimage, perhaps this should be a small helper script in germinate?
add_inheritance () {
case " $inherit " in
*" $1 "*)
;;
*)
inherit="${inherit:+$inherit }$1"
;;
esac
}
expand_inheritance () {
for seed in $(grep "^$1:" config/germinate-output/structure | cut -d: -f2); do
expand_inheritance "$seed"
done
add_inheritance "$1"
}
inheritance () {
inherit=
expand_inheritance "$1"
echo "$inherit"
}
if [ "$PREINSTALLED" = "true" ]; then
if [ -n "$PREINSTALL_POOL_SEEDS" ]; then
mkdir -p config/germinate-output
case $PROJECT in
kubuntu-active*)
SEED=kubuntu-active.$SUITE
;;
kubuntu*)
SEED=kubuntu.$SUITE
;;
xubuntu*)
SEED=xubuntu.$SUITE
;;
*)
SEED=ubuntu.$SUITE
;;
esac
(cd config/germinate-output && germinate --no-rdepends --no-installer \
-S $SEEDMIRROR -m $MIRROR -d $SUITE -s $SEED \
${COMPONENTS:+-c "$COMPONENTS"} -a $ARCH)
UNWANTED_SEEDS="${LIVE_TASK:+$LIVE_TASK }boot installer required"
for i in $UNWANTED_SEEDS; do
UNWANTED_SEEDS="${UNWANTED_SEEDS:+$UNWANTED_SEEDS }$(inheritance $i)"
done
for i in $PREINSTALL_POOL_SEEDS; do
PREINSTALL_POOL_SEEDS="${PREINSTALL_POOL_SEEDS:+$PREINSTALL_POOL_SEEDS }$(inheritance $i)"
done
for i in $PREINSTALL_POOL_SEEDS; do
case " $UNWANTED_SEEDS " in
*" $i "*)
;;
*)
PPS_EXP="${PPS_EXP:+$PPS_EXP }$i"
;;
esac
done
for i in $PPS_EXP; do
PREINSTALL_POOL="$PREINSTALL_POOL $(awk '{print $1}' \
config/germinate-output/$i | egrep -v '^-|^Package|^\|' | tr '\n' ' ')"
done
fi
if [ -n "$PREINSTALL_POOL" ]; then
mkdir -p config/gnupg
mkdir -p config/indices
for component in $COMPONENTS; do
(cd config/indices && \
wget $MIRROR/indices/override.$SUITE.$component && \
wget $MIRROR/indices/override.$SUITE.extra.$component \
)
done
cat > config/hooks/100-preinstall-pool.chroot <<EOF
#! /bin/sh
mkdir -p /var/lib/preinstalled-pool/pool/
cd /var/lib/preinstalled-pool/pool/
apt-get -y download $PREINSTALL_POOL
EOF
fi
fi
|