-
Notifications
You must be signed in to change notification settings - Fork 62
/
snapcraft.yaml
78 lines (75 loc) · 2.51 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
name: ubuntu-image
summary: Create Ubuntu images
description: |
Official tool for building Ubuntu images, currently supporing Ubuntu Core
snap-based images and preinstalled Ubuntu classic images.
version: "3.6.0"
grade: stable
confinement: classic
base: core24
source-code: https://github.com/canonical/ubuntu-image
issues: https://bugs.launchpad.net/ubuntu-image/+filebug
# Force the snap to use fakeroot staged within the snap
environment:
FAKEROOT_FLAGS: "--lib $SNAP/usr/lib/lib-arch/libfakeroot/libfakeroot-tcp.so --faked $SNAP/usr/bin/faked-tcp"
PATH: $SNAP/usr/bin:$SNAP/bin:$SNAP/usr/sbin:$SNAP/sbin:$PATH
GCONV_PATH: /snap/core24/current/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gconv
PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
DEBOOTSTRAP_DIR: $SNAP/usr/share/debootstrap
PERL5LIB: $SNAP/usr/share/perl5:$SNAP/usr/share/perl:$PERL5LIB
apps:
ubuntu-image:
command: bin/ubuntu-image
parts:
ubuntu-image:
plugin: nil
source: .
source-type: git
build-packages:
- ubuntu-dev-tools
build-snaps:
- go
stage-packages:
- binfmt-support
- dirmngr
- dosfstools
- fdisk
- gdisk
- fakeroot
- debootstrap
- gpg
- germinate
- git
- mtools
- make
- qemu-user-static
- qemu-utils
- u-boot-tools
- devscripts
- grub-common
- libpython3-stdlib
- libpython3.12-stdlib
- libpython3.12-minimal
- python3
- python3-apt
- python3-minimal
- python3.12-minimal
- e2fsprogs
build-attributes: [ enable-patchelf ]
override-pull: |
# Ensure we don't have a dubious ownership error from git when building.
git config --global --add safe.directory $CRAFT_PROJECT_DIR/.git
craftctl default
override-build: |
mkdir -p "$SNAPCRAFT_PART_INSTALL"/etc/ubuntu-image/
mv mkfs/confs "$SNAPCRAFT_PART_INSTALL"/etc/ubuntu-image/mkfs
ins_bin=$SNAPCRAFT_PART_INSTALL/bin/
mkdir -p "$ins_bin"
# Make ubuntu-image statically compiled to avoid libc deps.
# We need this as setting interpreter/rpath is known to cause
# issues with go binaries (https://github.com/NixOS/patchelf/issues/146).
# On compiling statically go, see https://mt165.co.uk/blog/static-link-go/
CGO_ENABLED=0 go build -o "$ins_bin" ./cmd/ubuntu-image/
# Create a symbolic link to /usr/lib/<arch> where libfakeroot will live
cd $SNAPCRAFT_PART_INSTALL/usr/lib/
ln -s ${CRAFT_ARCH_TRIPLET_BUILD_FOR} lib-arch