forked from ublue-os/uupd
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
72 lines (58 loc) · 1.88 KB
/
justfile
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
set shell := ["bash", "-uc"]
export UBLUE_ROOT := env_var_or_default("UBLUE_ROOT", "/app/output")
export TARGET := "uupd"
export SOURCE_DIR := UBLUE_ROOT + "/" + TARGET
export RPMBUILD := UBLUE_ROOT + "/rpmbuild"
default:
just --list
build:
go build -o output/uupd
run: build
sudo ./output/uupd
spec: output
rpkg spec --outdir "$PWD/output"
build-rpm:
rpkg local --outdir "$PWD/output"
builddep:
dnf builddep -y output/uupd.spec
container-install-deps:
#!/usr/bin/env bash
set -eou pipefail
dnf install \
--disablerepo='*' \
--enablerepo='fedora,updates' \
--setopt install_weak_deps=0 \
--nodocs \
--assumeyes \
'dnf-command(builddep)' \
rpkg \
rpm-build \
git
# Used internally by build containers
container-rpm-build: container-install-deps spec builddep build-rpm
#!/usr/bin/env bash
set -eou pipefail
# clean up files
for RPM in ${UBLUE_ROOT}/*/*.rpm; do
NAME="$(rpm -q $RPM --queryformat='%{NAME}')"
mkdir -p "${UBLUE_ROOT}/ublue-os/rpms/"
cp "${RPM}" "${UBLUE_ROOT}/ublue-os/rpms/$(rpm -q "${RPM}" --queryformat='%{NAME}.rpm')"
done
output:
mkdir -p output
dnf-install:
dnf install -y "output/noarch/*.rpm"
container-build:
podman build . -t test-container -f Containerfile
container-test:
#!/usr/bin/env bash
set -eou pipefail
podman run -d --replace --name uupd-test --security-opt label=disable --device /dev/fuse:rw --privileged --systemd true test-container
while [[ "$(podman exec uupd-test systemctl is-system-running)" != "running" && "$(podman exec uupd-test systemctl is-system-running)" != "degraded" ]]; do
echo "Waiting for systemd to finish booting..."
sleep 1
done
podman exec -t uupd-test systemd-run --machine 0@ --pipe --quiet /usr/bin/uupd --dry-run
podman rm -f uupd-test
clean:
rm -rf "$UBLUE_ROOT"