forked from ublue-os/akmods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-prep.sh
executable file
·115 lines (100 loc) · 4.44 KB
/
build-prep.sh
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
111
112
113
114
115
#!/bin/sh
set -oeux pipefail
### PREPARE REPOS
ARCH="$(rpm -E '%_arch')"
RELEASE="$(rpm -E '%fedora')"
# Modularity repositories are not available on Fedora 39 and above, so don't try to disable them
if [[ "${RELEASE}" -le 38 ]]; then
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-{cisco-openh264,modular,updates-modular}.repo
else
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo
fi
# enable RPMs with alternatives to create them in this image build
mkdir -p /var/lib/alternatives
# enable more repos
RPMFUSION_MIRROR_RPMS="https://mirrors.rpmfusion.org"
if [ -n "${RPMFUSION_MIRROR}" ]; then
RPMFUSION_MIRROR_RPMS=${RPMFUSION_MIRROR}
fi
rpm-ostree install \
${RPMFUSION_MIRROR_RPMS}/free/fedora/rpmfusion-free-release-${RELEASE}.noarch.rpm \
${RPMFUSION_MIRROR_RPMS}/nonfree/fedora/rpmfusion-nonfree-release-${RELEASE}.noarch.rpm \
fedora-repos-archive
# after F40 launches, bump to 41
if [[ "${FEDORA_MAJOR_VERSION}" -ge 40 ]]; then
# pre-release rpmfusion is in a different location
sed -i "s%free/fedora/releases%free/fedora/development%" /etc/yum.repos.d/rpmfusion-*.repo
# pre-release rpmfusion needs to enable testing
sed -i '0,/enabled=0/{s/enabled=0/enabled=1/}' /etc/yum.repos.d/rpmfusion-*-updates-testing.repo
fi
if [ -n "${RPMFUSION_MIRROR}" ]; then
# force use of single rpmfusion mirror
echo "Using single rpmfusion mirror: ${RPMFUSION_MIRROR}"
sed -i.bak "s%^metalink=%#metalink=%" /etc/yum.repos.d/rpmfusion-*.repo
sed -i "s%^#baseurl=http://download1.rpmfusion.org%baseurl=${RPMFUSION_MIRROR}%" /etc/yum.repos.d/rpmfusion-*.repo
fi
### PREPARE CUSTOM KERNEL SUPPORT
if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then
echo "Installing ASUS Kernel:"
wget https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel/repo/fedora-$(rpm -E %fedora)/lukenukem-asus-kernel-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_lukenukem-asus-kernel.repo
rpm-ostree cliwrap install-to-root /
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:lukenukem:asus-kernel \
kernel \
kernel-core \
kernel-devel \
kernel-devel-matched \
kernel-modules \
kernel-modules-core \
kernel-modules-extra
elif [[ "fsync" == "${KERNEL_FLAVOR}" ]]; then
echo "Installing fsync kernel:"
wget https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync/repo/fedora-$(rpm -E %fedora)/sentry-kernel-fsync-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_sentry-kernel-fsync.repo
rpm-ostree cliwrap install-to-root /
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:sentry:kernel-fsync \
kernel \
kernel-core \
kernel-devel \
kernel-devel-matched \
kernel-modules \
kernel-modules-core \
kernel-modules-extra
elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then
echo "Installing Surface Kernel:"
# Add Linux Surface repo
wget https://pkg.surfacelinux.com/fedora/linux-surface.repo -P /etc/yum.repos.d
wget https://github.com/linux-surface/linux-surface/releases/download/silverblue-20201215-1/kernel-20201215-1.x86_64.rpm -O \
/tmp/surface-kernel.rpm
rpm-ostree cliwrap install-to-root /
rpm-ostree override replace /tmp/surface-kernel.rpm \
--remove kernel-core \
--remove kernel-modules \
--remove kernel-modules-extra \
--install kernel-surface \
--install kernel-surface-core \
--install kernel-surface-devel \
--install kernel-surface-devel-matched \
--install kernel-surface-modules \
--install kernel-surface-modules-core \
--install kernel-surface-modules-extra
else
echo "Default main kernel needs no customization."
fi
### PREPARE BUILD ENV
rpm-ostree install \
akmods \
mock
if [[ ! -s "/tmp/certs/private_key.priv" ]]; then
echo "WARNING: Using test signing key. Run './generate-akmods-key' for production builds."
cp /tmp/certs/private_key.priv{.test,}
cp /tmp/certs/public_key.der{.test,}
fi
install -Dm644 /tmp/certs/public_key.der /etc/pki/akmods/certs/public_key.der
install -Dm644 /tmp/certs/private_key.priv /etc/pki/akmods/private/private_key.priv
# protect against incorrect permissions in tmp dirs which can break akmods builds
chmod 1777 /tmp /var/tmp
# create directories for later copying resulting artifacts
mkdir -p /var/cache/rpms/{kmods,ublue-os}