-
Notifications
You must be signed in to change notification settings - Fork 36
/
Containerfile.common
82 lines (73 loc) · 3.4 KB
/
Containerfile.common
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
###
### Containerfile.common - used to build ONLY NON-nvidia kmods
###
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-40}"
ARG KERNEL_FLAVOR="${KERNEL_FLAVOR:-main}"
ARG KERNEL_IMAGE="${KERNEL_IMAGE:-${KERNEL_FLAVOR}-kernel}"
ARG KERNEL_ORG="${KERNEL_ORG:-ublue-os}"
ARG KERNEL_BASE="ghcr.io/${KERNEL_ORG}/${KERNEL_IMAGE}:${FEDORA_MAJOR_VERSION}"
ARG BUILDER_IMAGE="${BUILDER_IMAGE:-quay.io/fedora/fedora}"
ARG BUILDER_BASE="${BUILDER_IMAGE}:${FEDORA_MAJOR_VERSION}"
FROM ${KERNEL_BASE} AS kernel_cache
FROM ${BUILDER_BASE} AS builder
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-40}"
ARG KERNEL_FLAVOR="${KERNEL_FLAVOR:-main}"
ARG RPMFUSION_MIRROR=""
ARG DUAL_SIGN="true"
COPY build*.sh dual-sign*.sh /tmp/
COPY certs /tmp/certs
# cached kernel rpms
COPY --from=kernel_cache /tmp/rpms /tmp/kernel_cache
# files for akmods
COPY ublue-os-akmods-addons.spec /tmp/ublue-os-akmods-addons/ublue-os-akmods-addons.spec
COPY ublue-os-ucore-addons.spec /tmp/ublue-os-ucore-addons/ublue-os-ucore-addons.spec
ADD https://copr.fedorainfracloud.org/coprs/ublue-os/akmods/repo/fedora-${FEDORA_MAJOR_VERSION}/ublue-os-akmods-fedora-${FEDORA_MAJOR_VERSION}.repo \
/tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo
ADD https://negativo17.org/repos/fedora-multimedia.repo \
/tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-multimedia.repo
RUN --mount=type=cache,dst=/var/cache/dnf \
/tmp/build-prep.sh && \
if [[ "${KERNEL_FLAVOR}" =~ "coreos" ]]; then \
/tmp/build-ublue-os-ucore-addons.sh && \
cp /tmp/ublue-os-ucore-addons/rpmbuild/RPMS/noarch/ublue-os-ucore-addons*.rpm \
/var/cache/rpms/ucore/ \
; fi && \
/tmp/build-ublue-os-akmods-addons.sh && \
cp /tmp/ublue-os-akmods-addons/rpmbuild/RPMS/noarch/ublue-os-akmods-addons*.rpm \
/var/cache/rpms/ublue-os/ && \
if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \
export KERNEL_NAME="kernel" \
; else \
export KERNEL_NAME="kernel-surface" \
; fi && \
/tmp/build-kmod-framework-laptop.sh && \
/tmp/build-kmod-kvmfr.sh && \
/tmp/build-kmod-openrazer.sh && \
/tmp/build-kmod-v4l2loopback.sh && \
/tmp/build-kmod-wl.sh && \
/tmp/build-kmod-xpadneo.sh && \
/tmp/build-kmod-xone.sh && \
/tmp/dual-sign.sh && \
for RPM in $(find /var/cache/akmods/ -type f -name \*.rpm); do \
cp "${RPM}" /var/cache/rpms/kmods/; \
done && \
for RPM in $(find /root/rpmbuild/RPMS/"$(uname -m)"/ -type f -name \*.rpm); do \
cp "${RPM}" /var/cache/rpms/kmods/; \
done && \
find /var/cache/rpms
# Remove kernel version from kmod package names
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
kernel_version=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}\n" kernel-core | head -n 1); \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-${kernel_version}*}; \
if [[ "$basename" == *"$kernel_version"* ]]; then \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
else \
echo "Skipping $basename rebuild as its name does not contain $kernel_version"; \
fi; \
done
FROM scratch
COPY --from=builder /var/cache/rpms /rpms