From bbddb6c3f75fe2e36d9832b30bab4e389744bb0a Mon Sep 17 00:00:00 2001 From: Shohamza Date: Sat, 15 Jun 2024 06:08:34 +0000 Subject: [PATCH] feat: added support for importing custom keys for rpm-ostree module --- modules/rpm-ostree/README.md | 2 ++ modules/rpm-ostree/module.yml | 3 +++ modules/rpm-ostree/rpm-ostree.sh | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/modules/rpm-ostree/README.md b/modules/rpm-ostree/README.md index 398bdc7..a0e0daf 100644 --- a/modules/rpm-ostree/README.md +++ b/modules/rpm-ostree/README.md @@ -4,6 +4,8 @@ The [`rpm-ostree`](https://coreos.github.io/rpm-ostree/) module offers pseudo-de The module first downloads the repository files from repositories declared under `repos:` into `/etc/yum.repos.d/`. The magic string `%OS_VERSION%` is substituted with the current VERSION_ID (major Fedora version), which can be used, for example, for pulling correct versions of repositories from [Fedora's Copr](https://copr.fedorainfracloud.org/). +If you use a repo that requires adding custom keys (eg. brave browser) you can import the keys by decalring the key urls in under `keys:`. The magic string acts the same as it does in `repos`. + Then the module installs the packages declared under `install:` using `rpm-ostree install`, it removes the packages declared under `remove:` using `rpm-ostree override remove`. If there are packages declared under both `install:` and `remove:` a hybrid command `rpm-ostree remove --install ` is used, which should allow you to switch required packages for other ones. Installing RPM packages directly from a `http(s)` url that points to the RPM file is also supported, you can just put the URLs under `install:` and they'll be installed along with the other packages. The magic string `%OS_VERSION%` is substituted with the current VERSION_ID (major Fedora version) like with the `repos:` property. diff --git a/modules/rpm-ostree/module.yml b/modules/rpm-ostree/module.yml index ba8ca49..72224a2 100644 --- a/modules/rpm-ostree/module.yml +++ b/modules/rpm-ostree/module.yml @@ -6,6 +6,9 @@ example: | repos: - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%OS_VERSION%/atim-starship-fedora-%OS_VERSION%.repo # when including COPR repos, use the %OS_VERSION% magic string - https://pkgs.tailscale.com/stable/fedora/tailscale.repo + - https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + keys: + - https://brave-browser-rpm-release.s3.brave.com/brave-core.asc install: - python3-pip - libadwaita diff --git a/modules/rpm-ostree/rpm-ostree.sh b/modules/rpm-ostree/rpm-ostree.sh index 021cd4c..9c72283 100644 --- a/modules/rpm-ostree/rpm-ostree.sh +++ b/modules/rpm-ostree/rpm-ostree.sh @@ -13,6 +13,14 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then done fi +get_yaml_array KEYS '.keys[]' "$1" +if [[ ${#KEYS[@]} -gt 0 ]]; then + echo "Adding keys" + for KEY in "${KEYS[@]}"; do + rpm --import "${KEY//[$'\t\r\n ']}" + done +fi + # Create symlinks to fix packages that create directories in /opt get_yaml_array OPTFIX '.optfix[]' "$1" if [[ ${#OPTFIX[@]} -gt 0 ]]; then