-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathHydrunfile
executable file
·110 lines (82 loc) · 2.32 KB
/
Hydrunfile
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
#!/bin/bash
set -e
# Test
if [ "$1" = "test" ]; then
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend
# Run tests
make test
exit 0
fi
# Go
if [ "$1" = "go" ]; then
# Install native dependencies
apt update
apt install -y curl make
# Install bagop
curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)"
install /tmp/bagop /usr/local/bin
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend
# Build
CGO_ENABLED=0 bagop -j "$(nproc)" -b "$2" -x '(android/*|ios/*|plan9/*|aix/*|linux/loong64|freebsd/*|wasip1/*|js/*|openbsd/*|windows/*|darwin/*|solaris/*|dragonfly/*|netbsd/*|illumos/*)' -p "make build/$2 DST=\$DST" -d out
exit 0
fi
# OS
if [ "$1" = "os" ]; then
# Install native dependencies
dnf install -y @c-development @development-tools go curl make file cpio unzip rsync bc openssh-clients which wget perl
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies for packager
make depend
# Build packager
make build/drafter-packager
# Install packager
make install/drafter-packager
# Generate dependencies for OS
make depend/os OS_DEFCONFIG="$2"
# Build OS
FORCE_UNSAFE_CONFIGURE=1 make build/os
# Package OS
drafter-packager --package-path "out/$3" --devices '[
{
"name": "kernel",
"path": "out/blueprint/vmlinux"
},
{
"name": "disk",
"path": "out/blueprint/rootfs.ext4"
}
]'
exit 0
fi
# OCI runtime bundle
if [ "$1" = "oci" ]; then
# Install native dependencies
dnf install -y go curl make jq skopeo dnf-plugins-core openssh-clients git e2fsprogs
dnf copr enable -y ganto/umoci
dnf install -y golang-github-opencontainers-umoci
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies for packager
make depend
# Build packager
make build/drafter-packager
# Install packager
make install/drafter-packager
# Build OCI runtime bundle
make build/oci OCI_IMAGE_URI="$2" OCI_IMAGE_ARCHITECTURE="$3"
# Package OCI runtime bundle
drafter-packager --package-path "out/$4" --devices '[
{
"name": "oci",
"path": "out/blueprint/oci.ext4"
}
]'
exit 0
fi