forked from canonical/lxd-pkg-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
1637 lines (1499 loc) · 48.3 KB
/
snapcraft.yaml
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
name: lxd
base: core24
assumes:
- snapd2.39
version: git
grade: devel
summary: LXD - container and VM manager
license: AGPL-3.0
title: LXD
description: |-
LXD is a system container and virtual machine manager.
It offers a simple CLI and REST API to manage local or remote instances,
uses an image based workflow and support for a variety of advanced features.
Images are available for all Ubuntu releases and architectures as well
as for a wide number of other Linux distributions. Existing
integrations with many deployment and operation tools, makes it work
just like a public cloud, except everything is under your control.
LXD containers are lightweight, secure by default and a great
alternative to virtual machines when running Linux on Linux.
LXD virtual machines are modern and secure, using UEFI and secure-boot
by default and a great choice when a different kernel or operating
system is needed.
With clustering, up to 50 LXD servers can be easily joined and managed
together with the same tools and APIs and without needing any external
dependencies.
Supported configuration options for the snap (snap set lxd [<key>=<value>...]):
- apparmor.unprivileged-restrictions-disable: Whether to disable restrictions on unprivileged user namespaces [default=true]
- ceph.builtin: Use snap-specific Ceph configuration [default=false]
- ceph.external: Use the system's ceph tools (ignores ceph.builtin) [default=false]
- criu.enable: Enable experimental live-migration support [default=false]
- daemon.debug: Increase logging to debug level [default=false]
- daemon.group: Set group of users that have full control over LXD [default=lxd]
- daemon.user.group: Set group of users that have restricted LXD access [default=lxd]
- daemon.preseed: Pass a YAML configuration to `lxd init` on initial start
- daemon.syslog: Send LXD log events to syslog [default=false]
- daemon.verbose: Increase logging to verbose level [default=false]
- lvm.external: Use the system's LVM tools [default=false]
- lxcfs.pidfd: Start per-container process tracking [default=false]
- lxcfs.loadavg: Start tracking per-container load average [default=false]
- lxcfs.cfs: Consider CPU shares for CPU usage [default=false]
- lxcfs.debug: Increase logging to debug level [default=false]
- minio.path: Path to the directory containing the minio and mc binaries to use with LXD [default=""]
- openvswitch.builtin: Run a snap-specific OVS daemon [default=false]
- openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false]
- ovn.builtin: Use snap-specific OVN configuration [default=false]
- ui.enable: Enable the web interface [default=true]
- zfs.external: Use the system's ZFS tools [default=false]
For system-wide configuration of the CLI, place your configuration in
/var/snap/lxd/common/global-conf/ (config.yml and servercerts)
contact: [email protected]
issues: https://github.com/canonical/lxd/issues
source-code: https://github.com/canonical/lxd
website: https://ubuntu.com/lxd
confinement: strict
plugs:
ceph-conf:
interface: content
target: "$SNAP_DATA/microceph"
ovn-certificates:
interface: content
target: "$SNAP_DATA/microovn/certificates"
ovn-chassis:
interface: content
target: "$SNAP_DATA/microovn/chassis"
gpu-2404:
interface: content
target: $SNAP/gpu-2404
# default-provider: mesa-2404
qemu-external:
interface: content
content: qemu-external-binaries
target: $SNAP/external/qemu
layout:
/usr/share/libdrm:
bind: $SNAP/gpu-2404/libdrm
/usr/share/drirc.d:
symlink: $SNAP/gpu-2404/drirc.d
apps:
# Main commands
activate:
command: commands/daemon.activate
daemon: oneshot
plugs:
- lxd-support
- system-observe
daemon:
command-chain:
- bin/gpu-2404-custom-wrapper
command: commands/daemon.start
reload-command: commands/daemon.reload
stop-command: commands/daemon.stop
stop-timeout: 600s
restart-condition: on-failure
daemon: simple
slots:
- lxd
plugs:
- lxd-support
- network-bind
- system-observe
sockets:
unix:
listen-stream: $SNAP_COMMON/lxd/unix.socket
socket-mode: 0660
user-daemon:
command: commands/lxd-user
stop-timeout: 600s
restart-condition: on-failure
daemon: simple
plugs:
- lxd-support
- network-bind
- system-observe
sockets:
unix:
listen-stream: $SNAP_COMMON/lxd-user/unix.socket
socket-mode: 0660
lxc:
command: commands/lxc
completer: etc/bash_completion.d/snap.lxd.lxc
plugs:
- lxd-support
- system-observe
lxd:
command: commands/lxd
plugs:
- lxd-support
- system-observe
# Sub-commands
buginfo:
command: commands/buginfo
plugs:
- lxd-support
- system-observe
check-kernel:
command: commands/lxd-check-kernel
plugs:
- lxd-support
- system-observe
hooks:
connect-plug-ceph-conf:
plugs:
- lxd-support
- system-observe
disconnect-plug-ceph-conf:
plugs:
- lxd-support
- system-observe
connect-plug-ovn-certificates:
plugs:
- lxd-support
- system-observe
disconnect-plug-ovn-certificates:
plugs:
- lxd-support
- system-observe
connect-plug-ovn-chassis:
plugs:
- lxd-support
- system-observe
disconnect-plug-ovn-chassis:
plugs:
- lxd-support
- system-observe
connect-plug-qemu-external:
plugs:
- lxd-support
- system-observe
disconnect-plug-qemu-external:
plugs:
- lxd-support
- system-observe
configure:
plugs:
- lxd-support
- network
- system-observe
remove:
plugs:
- lxd-support
- system-observe
parts:
# Dependencies
btrfs:
plugin: nil
stage-packages:
- btrfs-progs
organize:
sbin/: bin/
prime:
- bin/btrfs
- bin/btrfstune
- bin/mkfs.btrfs
ceph:
after:
- libatomic
plugin: nil
stage-packages:
# XXX: explicitly depend on libsnappy1v5 due to https://bugs.launchpad.net/ubuntu/+source/ceph/+bug/2072656
- on amd64:
- ceph-common
- libsnappy1v5
- on arm64:
- ceph-common
- libsnappy1v5
- on ppc64el:
- ceph-common
- libsnappy1v5
- on s390x:
- ceph-common
- libsnappy1v5
organize:
usr/bin/: bin/
usr/lib/: lib/
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
prime:
- bin/ceph
- bin/radosgw-admin
- bin/rbd
- lib/*/ceph
- lib/*/libcephfs*
- lib/python3
- lib/*/libboost_context.so*
- lib/*/libboost_filesystem.so*
- lib/*/libboost_iostreams.so*
- lib/*/libboost_program_options.so*
- lib/*/libboost_thread.so*
- lib/*/libbrotlicommon.so*
- lib/*/libbrotlidec.so*
- lib/*/libcurl-gnutls.so*
- lib/*/libdaxctl.so*
- lib/*/libibverbs.so*
- lib/*/libicudata.so*
- lib/*/libicuuc.so*
- lib/*/liblber-2.5.so*
- lib/*/liblber.so*
- lib/*/libldap-2.5.so*
- lib/*/libldap.so*
- lib/*/liblmdb.so*
- lib/*/liblua5.4.so*
- lib/*/libncurses.so*
- lib/*/libndctl.so*
- lib/*/libnghttp2.so*
- lib/*/liboath.so*
- lib/*/libpmemobj.so*
- lib/*/libpmem.so*
- lib/*/libpsl.so*
- lib/*/librabbitmq.so*
- lib/*/librados.so*
- lib/*/librbd.so*
- lib/*/librdmacm.so*
- lib/*/librtmp.so*
- lib/*/libsasl2.so*
- lib/*/libsnappy.so*
- lib/*/libssh.so*
- lib/*/libtcmalloc.so*
- lib/*/libunwind.so*
criu:
source: https://github.com/checkpoint-restore/criu
source-commit: c2b48ff423aa663b3534a5ba96907366e4c1b408 # v4.0
source-depth: 1
source-type: git
plugin: nil
build-packages:
- asciidoc
- libcap-dev
- libnet1-dev
- libnl-3-dev
- libprotobuf-c-dev
- libprotobuf-dev
- protobuf-c-compiler
- protobuf-compiler
- xmlto
stage-packages:
- libnet1
- libprotobuf-c1
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && [ "$(uname -m)" != "armv7l" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && [ "$(uname -m)" != "armv7l" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && [ "$(uname -m)" != "armv7l" ] && exit 0
set -ex
git config user.email "[email protected]"
git config user.name "LXD snap builder"
make criu
mkdir -p "${CRAFT_PART_INSTALL}/criu/"
cp criu/criu "${CRAFT_PART_INSTALL}/criu/"
organize:
usr/lib/: lib/
prime:
- criu/*
- lib/*/libnet*
- lib/*/libproto*
dqlite:
source: https://github.com/canonical/dqlite
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --prefix=
- --enable-build-raft
stage-packages:
- liblz4-1
- libuv1t64
- sqlite3
build-packages:
- liblz4-dev
- libsqlite3-dev
- libuv1-dev
organize:
usr/bin/: bin/
usr/lib/: lib/
prime:
- bin/sqlite3
- lib/libdqlite*so*
- lib/*/libsqlite3*so*
- lib/*/libuv*
#- lib/*/liblz4.so* # use liblz4.so from the base snap
edk2:
source: https://github.com/tianocore/edk2
source-depth: 1
source-commit: 8736b8fdca85e02933cdb0a13309de14c9799ece # edk2-stable202311
source-submodules: []
source-type: git
plugin: nil
build-packages:
- on amd64:
- g++
- acpica-tools
- nasm
- uuid-dev
- on arm64:
- g++
- acpica-tools
- nasm
- uuid-dev
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
set -ex
# Fix submodule sources
# see https://github.com/tianocore/edk2/commit/95d8a1c255cfb8e063d679930d08ca6426eb5701
sed -i "s#https://github.com/Zeex/subhook.git#https://github.com/tianocore/edk2-subhook.git#g" .gitmodules
# Pull submodules after switching to source-commit
git submodule update --init --recursive
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
set -ex
# Git cherry-picks
git config user.email "[email protected]"
git config user.name "LXD snap builder"
# Apply patches
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0001-force-DUID-LLT.patch"
cp "${CRAFT_PROJECT_DIR}/patches/edk2-0002-logo.bmp" MdeModulePkg/Logo/Logo.bmp
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0003-boot-delay.patch"
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0004-gcc-errors.patch"
patch --binary -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0005-disable-dynamic-mmio-winsize.patch"
# revert "ArmVirtPkg: make EFI_LOADER_DATA non-executable" as it breaks almost everything
git revert 2997ae38739756ecba9b0de19e86032ebc689ef9
patch --binary -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0006-disable-EFI-memory-attributes-protocol.patch"
patch --binary -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0007-Disable-the-Shell-when-SecureBoot-is-enabled.patch"
# Arch-specific logic
ARCH="X64"
PKG="OvmfPkg/OvmfPkgX64.dsc"
FV_CODE="OVMF_CODE"
FV_VARS="OVMF_VARS"
if [ "$(uname -m)" = "aarch64" ]; then
ARCH="AARCH64"
PKG="ArmVirtPkg/ArmVirtQemu.dsc"
FV_CODE="QEMU_EFI"
FV_VARS="QEMU_VARS"
fi
# Run in a bash sub-shell as edksetup.sh requires it
build_edk2() {
TARGET_CODE="$1"
shift
TARGET_VARS="$1"
shift
TARGET_BUILD_TYPE="$1"
shift
set -ex
(
cat << EOF
. ./edksetup.sh
make -C BaseTools ARCH="${ARCH}"
build -a "${ARCH}" -t GCC5 -b "${TARGET_BUILD_TYPE}" -p "${PKG}" \
-DSMM_REQUIRE=FALSE \
-DSECURE_BOOT_ENABLE=TRUE \
-DNETWORK_IP4_ENABLE=TRUE \
-DNETWORK_IP6_ENABLE=TRUE \
-DNETWORK_TLS_ENABLE=TRUE \
-DNETWORK_HTTP_BOOT_ENABLE=TRUE \
-DTPM2_ENABLE=TRUE \
-DTPM2_CONFIG_ENABLE=TRUE \
$@
EOF
) | bash -e
cp Build/*/${TARGET_BUILD_TYPE}*/FV/${FV_CODE}.fd "${TARGET_CODE}"
cp Build/*/${TARGET_BUILD_TYPE}*/FV/${FV_VARS}.fd "${TARGET_VARS}"
if [ "$(uname -m)" = "aarch64" ]; then
truncate -s 64m "${TARGET_CODE}"
truncate -s 64m "${TARGET_VARS}"
fi
}
# Create the firmware path
mkdir -p "${CRAFT_PART_INSTALL}/share/qemu/"
# Primary firmware (4MB)
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.fd" \
RELEASE \
-DFD_SIZE_4MB
# Debug firmware (4MB, debug mode)
# Can be enabled with the LXD boot.debug_edk2 instance option
# Set DEBUG_VERBOSE flag
if [ "$(uname -m)" = "aarch64" ]; then
sed -i "s#DEBUG_PRINT_ERROR_LEVEL = 0x8000004F#DEBUG_PRINT_ERROR_LEVEL = 0x8040004F#g" ArmVirtPkg/ArmVirt.dsc.inc
fi
if [ "$(uname -m)" = "x86_64" ]; then
sed -i "s#PcdDebugPrintErrorLevel|0x8000004F#PcdDebugPrintErrorLevel|0x8040004F#g" "${PKG}"
fi
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB.debug.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.debug.fd" \
DEBUG \
-DFD_SIZE_4MB
rm "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.debug.fd"
prime:
- share/qemu/*
libatomic:
plugin: nil
stage-packages:
- libatomic1
organize:
usr/lib/: lib/
prime:
- lib/*/libatomic.so*
libtpms:
source: https://github.com/stefanberger/libtpms
source-commit: f8c2dc7e12a730dcca4220d7ac5ad86d13dfd630 # v0.9.6
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --prefix=
- --with-tpm2
- --with-openssl
organize:
usr/lib/: lib/
prime:
- lib/libtpms*so*
libusb:
source: https://github.com/libusb/libusb
source-commit: d52e355daa09f17ce64819122cb067b8a2ee0d4b # v1.0.27
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --prefix=
organize:
usr/lib/: lib/
prime:
- lib/libusb*so*
logrotate:
plugin: nil
stage-packages:
- logrotate
organize:
usr/bin/: bin/
usr/lib/: lib/
usr/sbin/: bin/
stage:
- bin/logrotate
prime:
- bin/logrotate
lvm:
plugin: nil
stage-packages:
- dmeventd
- lvm2
- thin-provisioning-tools
organize:
sbin/: bin/
usr/lib/: lib/
usr/sbin/: bin/
override-build: |-
# Patch lvm.conf to:
# 1) Disable bits that don't apply in a snap'ed env. Handle commented
# out variants that represent builtin values.
# * udev_sync
# * udev_rules
# * use_lvmetad
# * monitoring
# 2) Uncomment all executable directives to override their builtin
# values. Replace paths in /usr/bin, /usr/sbin, /bin and /sbin
# by /snap/lxd/current/bin to use executables from the snap.
sed -i \
-e "s%\(# \)\?udev_sync = 1%udev_sync = 0%" \
-e "s%\(# \)\?udev_rules = 1%udev_rules = 0%" \
-e "s%\(# \)\?use_lvmetad = 1%use_lvmetad = 0%" \
-e "s%\(# \)\?monitoring = 1%monitoring = 0%" \
-e "/# .*_\?executable =/s/# //" \
-e "s%\(/usr\)\?/s\?bin/%/snap/lxd/current/bin/%" \
"${CRAFT_PART_INSTALL}/etc/lvm/lvm.conf"
craftctl default
prime:
- bin/cache_*
- bin/dmeventd
- bin/era_*
- bin/lv*
- bin/pdata_tools
- bin/pv*
- bin/thin_*
- bin/vg*
- -bin/vgimportclone
- -bin/lvmconf
- -bin/lvmdump
- -bin/lvmetad
- -bin/lvmpolld
- etc/lvm/lvm.conf
- etc/lvm/profile/*
- lib/*/device-mapper/*
- lib/*/libaio.so*
- lib/*/libdevmapper*
- lib/*/liblvm*
- lib/*/libreadline.so*
nftables:
plugin: nil
stage-packages:
- nftables
organize:
usr/lib/: lib/
usr/sbin/: bin/
prime:
- bin/nft
- lib/*/libjansson*so*
- lib/*/libnftables*so*
nvidia-container:
source: https://github.com/NVIDIA/libnvidia-container
source-commit: 63d366ee3b4183513c310ac557bf31b05b83328f # v1.17.2
source-depth: 1
source-type: git
plugin: make
build-environment:
- GIT_TAG: "1.17.2" # Enables source-depth: 1, should match git tag without "v" prefix.
build-packages:
- bmake
- curl
- libelf-dev
- libseccomp-dev
- lsb-release
- libtirpc-dev
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
set -ex
# Git cherry-picks
git config user.email "[email protected]"
git config user.name "LXD snap builder"
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/nvidia-0001-Fix-for-22.04-build.patch"
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/nvidia-0002-pre-load-libdl.patch"
mkdir -p "${CRAFT_PART_INSTALL}/bin/"
cp "${CRAFT_PROJECT_DIR}/snapcraft/wrappers/nvidia-container-cli" "${CRAFT_PART_INSTALL}/bin/"
set +ex
craftctl default
organize:
usr/local/bin/nvidia-container-cli: bin/nvidia-container-cli.real
usr/local/lib: lib/
prime:
- bin/nvidia-container-cli*
- lib/libnvidia-container*.so*
nvidia-container-toolkit:
source: https://github.com/NVIDIA/nvidia-container-toolkit
source-depth: 1
source-commit: fa66e4cd562804509055e44a88f666673e6d27c0 # v1.17.2
source-type: git
build-snaps:
- go
plugin: make
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
set -ex
make binaries
mkdir -p "${CRAFT_PART_INSTALL}/bin/"
cp nvidia-ctk "${CRAFT_PART_INSTALL}/bin/"
organize:
usr/bin/: bin/
prime:
- bin/nvidia-ctk
nvme:
plugin: nil
stage-packages:
- nvme-cli
organize:
usr/lib/: lib/
usr/sbin/: bin/
prime:
- bin/nvme
- lib/*/libnvme*
openvswitch:
source: https://github.com/openvswitch/ovs
source-commit: dfe601bbc154c836e6ec3526a1eb331c1c09a06e # v3.3.2
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --enable-ssl
- --prefix=
organize:
sbin/: bin/
usr/bin/: bin/
prime:
- bin/ovs-appctl
- bin/ovs-vsctl
- bin/ovs-vswitchd
- bin/ovsdb-*
- share/openvswitch/
ovn:
after:
- openvswitch
source: https://github.com/ovn-org/ovn
source-commit: 459a3bab4c4a11b904aa3c37015372d34e1e1209 # v24.03.3
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --enable-ssl
- --prefix=
- --with-ovs-source=../../openvswitch/build/
prime:
- bin/ovn-nbctl
- bin/ovn-sbctl
spice-protocol:
source: https://gitlab.freedesktop.org/spice/spice-protocol
source-commit: 6f453a775d87087c6ba59fc180c1a1e466631a47 # v0.14.4
source-depth: 1
source-type: git
plugin: meson
prime: []
build-packages:
- meson
- ninja-build
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
spice-server:
after:
- spice-protocol
source: https://gitlab.freedesktop.org/spice/spice
source-commit: 0c2c1413a8b387ea597a95b6c867470a7c56c8ab # v0.15.2
# XXX: source-depth does not work with submodules
#source-depth: 1
source-type: git
plugin: meson
meson-parameters:
- --prefix=/
- -Dgstreamer=no
- -Dmanual=false
- -Dlz4=false
- -Dsasl=false
- -Dopus=disabled
- -Dsmartcard=disabled
- -Dtests=false
build-packages:
- libjpeg-turbo8-dev
- python3-pyparsing
- python3-six
- meson
- ninja-build
stage-packages:
- libjpeg-turbo8
- libpixman-1-0
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
organize:
sbin/: bin/
usr/lib: lib/
usr/local/lib/: lib/
prime:
- lib/*/libjpeg*so*
- lib/*/libspice-server*so*
- lib/*/libpixman*so*
swtpm:
after:
- libtpms
source: https://github.com/stefanberger/swtpm
source-commit: f756ee8a281ddff7e09b49e1ef00d5cbb42abb63 # v0.9.0
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --prefix=
- --with-seccomp
- --with-openssl
- --without-cuse
build-packages:
- expect
- gawk
- iproute2
- libjson-glib-dev
- libseccomp-dev
- python3-cryptography
- python3-setuptools
- socat
stage-packages:
- libjson-glib-1.0-0
organize:
usr/bin/: bin/
usr/lib/: lib/
lib/swtpm/: lib/
prime:
- bin/swtpm
- lib/libswtpm*so*
- lib/*/libjson-glib-1.0.so*
qemu:
after:
- libatomic
- libusb
- spice-protocol
- spice-server
source: https://git.launchpad.net/ubuntu/+source/qemu
source-commit: 00b8bba93d55baefdc68d06e6ab78934825a32b7 # import/1%8.2.2+ds-0ubuntu1.4
source-depth: 1
source-type: git
plugin: autotools
autotools-configure-parameters:
- --disable-bochs
- --disable-cloop
- --disable-dmg
- --disable-docs
- --disable-guest-agent
- --disable-parallels
- --disable-pvrdma
- --disable-qed
- --disable-slirp
- --disable-user
- --disable-vdi
- --disable-vnc
- --disable-xen
- --disable-xkbcommon
- --enable-attr
- --enable-cap-ng
- --enable-kvm
- --enable-libusb
- --enable-usb-redir
- --enable-linux-aio
- --enable-linux-io-uring
- --enable-numa
- --enable-pie
- --enable-rbd
- --enable-seccomp
- --enable-spice
- --enable-system
- --enable-tcg
- --enable-tools
- --enable-vhost-crypto
- --enable-vhost-kernel
- --enable-vhost-net
- --enable-vhost-user
- --enable-virtfs
- --firmwarepath=/snap/lxd/current/share/qemu/
- --localstatedir=/var/
- --disable-install-blobs # Ubuntu sources don't have the ROM blobs in them.
build-packages:
- bison
- bzip2
- flex
- pkg-config
- libaio-dev
- libcap-ng-dev
- libfdt-dev
- libglib2.0-dev
- libnuma-dev
- libpixman-1-dev
- libseccomp-dev
- liburing-dev
- libusbredirhost-dev
- quilt
- on amd64: # workaround for armhf, because it lacks of librbd-dev
- librbd-dev
- on arm64:
- librbd-dev
- on ppc64el:
- librbd-dev
- on s390x:
- librbd-dev
stage-packages:
- genisoimage
- ipxe-qemu # This is needed due to --disable-install-blobs.
- libfdt1
- libmagic1t64
- libnuma1
- libpixman-1-0
- libusbredirhost1t64
- libusbredirparser1t64
- liburing2
- seabios # This is needed due to --disable-install-blobs.
- qemu-system-data # This is needed due to --disable-install-blobs.
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
set -ex
# Mangle the configure a bit
QEMUARCH="$(uname -m)"
[ "${QEMUARCH}" = "ppc64le" ] && QEMUARCH="ppc64"
# Apply patches from Ubuntu sources.
QUILT_PATCHES=debian/patches quilt push -a
sed -i "s/^unset target_list$/target_list=\"${QEMUARCH}-softmmu\"/" configure
sed -i 's#libseccomp_minver=".*#libseccomp_minver="0.0"#g' configure
# Extract efi-virtio.rom from ipxe-qemu.
# This doesn't work in the organize section below.
mkdir -p "${CRAFT_PART_INSTALL}"/share/qemu
mv "${CRAFT_PART_INSTALL}"/usr/lib/ipxe/qemu/efi-virtio.rom "${CRAFT_PART_INSTALL}"/share/qemu/
set +ex
craftctl default
organize:
usr/bin/: bin/
usr/lib/: lib/
usr/local/bin/: bin/
usr/local/lib/: lib/
usr/local/libexec/: bin/
usr/local/share/: share/
usr/share/qemu/kvmvapic.bin: share/qemu/
usr/share/qemu/s390-ccw.img: share/qemu/
usr/share/qemu/s390-netboot.img: share/qemu/
usr/share/qemu/slof.bin: share/qemu/
usr/share/seabios/bios-256k.bin: share/qemu/
usr/share/seabios/vgabios-*: share/qemu/
prime:
- bin/genisoimage*
- bin/mkisofs*
- bin/qemu-system-*
- bin/qemu-img*
- bin/virtfs-proxy-helper*
- lib/*/libatomic.so*
- lib/*/libmagic*so*
- lib/*/libnuma*so*
- lib/*/libpixman*so*
- lib/*/liburing*so*
- lib/*/libusbredir*so*
- lib/*/libfdt*.so*
- share/qemu/keymaps/*
- share/qemu/bios-256k.bin
- share/qemu/efi-virtio.rom
- share/qemu/kvmvapic.bin
- share/qemu/s390-ccw.img
- share/qemu/s390-netboot.img
- share/qemu/slof.bin
- share/qemu/vgabios-bochs-display.bin
- share/qemu/vgabios-qxl.bin
- share/qemu/vgabios-ramfb.bin
- share/qemu/vgabios-stdvga.bin
- share/qemu/vgabios-virtio.bin
qemu-ovmf-secureboot:
after:
- edk2
- qemu
source: edk2-vars-generator
plugin: nil
build-packages:
- dosfstools
- mtools
- python3-pexpect
- xorriso
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
export ARCH="$(basename "$(readlink -f "${CRAFT_STAGE}"/lib/*-linux-gnu*/)")"
export LD_LIBRARY_PATH="${CRAFT_STAGE}/lib:${CRAFT_STAGE}/lib/${ARCH}"
set -ex
FIRMWARE="OVMF"
if [ "$(uname -m)" = "aarch64" ]; then
FIRMWARE="AAVMF"
fi
mkdir -p "${CRAFT_PART_INSTALL}/share/qemu/"
# 4MB variant
./edk2-vars-generator -f "${FIRMWARE}" \
-e ../../edk2/build/Build/*/RELEASE*/*/EnrollDefaultKeys.efi \
-s ../../edk2/build/Build/*/RELEASE*/*/Shell.efi \
-c "${CRAFT_STAGE}/share/qemu/OVMF_CODE.4MB.fd" \