mirror-ublue-os-akmods/build-prep.sh
Benjamin Sherman 5f7460cef1 refactor: split build steps into distinct scripts
Adjust build model such that akmods are built before ublue-main, and
then the resulting RPM artifacts are installed in ublue-main in the same
manner used by ublue-config.
2023-05-28 19:46:56 -05:00

39 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
set -oeux pipefail
### PREPARE REPOS
ARCH="$(rpm -E '%_arch')"
RELEASE="$(rpm -E '%fedora')"
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-{cisco-openh264,modular,updates-modular}.repo
wget -P /tmp/rpms \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${RELEASE}.noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${RELEASE}.noarch.rpm
# enable RPMs with alternatives to create them in this image build
mkdir -p /var/lib/alternatives
rpm-ostree install \
/tmp/rpms/*.rpm \
fedora-repos-archive
### 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