feat: Add support for using %OS_VERSION% in install url (#260)

This commit is contained in:
Gerald Pinder 2024-06-11 15:15:22 -04:00 committed by GitHub
commit b7de5f34ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -6,7 +6,7 @@ The module first downloads the repository files from repositories declared under
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 <packages> --install <packages>` 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.
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.
:::note
[Removed packages are still present in the underlying ostree repository](https://coreos.github.io/rpm-ostree/administrator-handbook/#removing-a-base-package), what `remove` does is kind of like hiding them from the system, it doesn't free up storage space.
@ -21,4 +21,4 @@ When removing certain packages, some problem probably in upstream `rpm-ostree` c
Resolving dependencies...done
error: Could not depsolve transaction; 1 problem detected:
Problem: conflicting requests
```
```

View file

@ -37,8 +37,9 @@ get_yaml_array REMOVE '.remove[]' "$1"
if [[ ${#INSTALL[@]} -gt 0 ]]; then
for PKG in "${INSTALL[@]}"; do
if [[ "$PKG" =~ ^https?:\/\/.* ]]; then
echo "Installing directly from URL: ${PKG}"
rpm-ostree install "$PKG"
REPLACED_PKG="${PKG//%OS_VERSION%/${OS_VERSION}}"
echo "Installing directly from URL: ${REPLACED_PKG}"
rpm-ostree install "$REPLACED_PKG"
INSTALL=( "${INSTALL[@]/$PKG}" ) # delete URL from install array
fi
done