This repository was archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fish
executable file
·71 lines (54 loc) · 2.01 KB
/
build.fish
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
#!/usr/bin/env fish
set -l options (fish_opt --short a --long architecture --required-val)
set -a options (fish_opt --short m --long manifest --required-val)
set -a options (fish_opt --short n --long name --required-val)
set -a options (fish_opt --short h --long help)
argparse --max-args 0 $options -- $argv
or exit
if set -q _flag_help
echo "build.fish [-a|--architecture] [-h|--help] [-m|--manifest] [-n|--name]"
exit 0
end
set -l architecture (buildah info --format={{".host.arch"}})
if set -q _flag_architecture
set architecture $_flag_architecture
end
echo "The image will be built for the $architecture architecture."
if set -q _flag_manifest
set -l manifest $_flag_manifest
echo "The image will be added to the $manifest manifest."
end
set -l name screen
if set -q _flag_name
set name $_flag_name
end
set -l container (buildah from --arch $architecture scratch)
set -l mountpoint (buildah mount $container)
podman run --rm --arch $architecture --volume $mountpoint:/mnt:Z registry.fedoraproject.org/fedora:latest \
bash -c "dnf -y install --installroot /mnt --releasever 34 glibc-minimal-langpack screen --nodocs --setopt install_weak_deps=False"
or exit
podman run --rm --arch $architecture --volume $mountpoint:/mnt:Z registry.fedoraproject.org/fedora:latest \
bash -c "dnf clean all -y --installroot /mnt --releasever 34"
or exit
podman run --rm --arch $architecture --volume $mountpoint:/mnt:Z registry.fedoraproject.org/fedora:latest \
bash -c "useradd --root /mnt user"
or exit
buildah unmount $container
or exit
buildah config --user user $container
or exit
buildah config --entrypoint '["screen"]' $container
or exit
buildah config --label io.containers.autoupdate=registry $container
or exit
buildah config --author [email protected] $container
or exit
buildah config --arch $architecture $container
or exit
if set -q manifest
buildah commit --rm --squash --manifest $manifest $container $name
or exit
else
buildah commit --rm --squash $container $name
or exit
end