forked from canonical/ubuntu-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
77 lines (74 loc) · 2.47 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
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.4+snap5"
grade: stable
confinement: classic
base: core22
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/core22/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/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
- fdisk
- gdisk
- fakeroot
- debootstrap
- gpg
- germinate
- git
- mtools
- make
- qemu-user-static
- qemu-utils
- u-boot-tools
- devscripts
- grub-common
- libpython3-stdlib
- libpython3.10-stdlib
- libpython3.10-minimal
- python3
- python3-apt
- python3-minimal
- python3.10-minimal
- e2fsprogs
build-attributes: [ enable-patchelf ]
override-build: |
# Check if mkfs configuration for every series are up to date
./tools/check-mkfs-confs.sh
mv mkfs "$SNAPCRAFT_PART_INSTALL"/etc/ubuntu-image/
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 symlink /usr/bin/fakeroot -> /usr/bin/fakeroot-tcp
cd $SNAPCRAFT_PART_INSTALL/usr/bin/
ln -s fakeroot-tcp fakeroot
# Create a symbolic link to /usr/lib/<arch> where libfakeroot will live
cd $SNAPCRAFT_PART_INSTALL/usr/lib/
ln -s ${SNAPCRAFT_ARCH_TRIPLET} lib-arch