Skip to content

Commit

Permalink
fix: /opt symlink issue & migrate removal + install to dnf
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Dec 22, 2024
1 parent 97566b8 commit 0bb79d0
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions modules/dnf/dnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if [[ ${#OPTFIX[@]} -gt 0 ]]; then
echo "Creating symlinks to fix packages that install to /opt"
# Create symlink for /opt to /var/opt since it is not created in the image yet
mkdir -p "/var/opt"
ln -s "/var/opt" "/opt"
ln -snf "/var/opt" "/opt"
# Create symlinks for each directory specified in recipe.yml
for OPTPKG in "${OPTFIX[@]}"; do
OPTPKG="${OPTPKG%\"}"
Expand Down Expand Up @@ -124,31 +124,10 @@ echo_rpm_install() {

if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#REMOVE_PKGS[@]} -gt 0 ]]; then
echo "Installing & Removing RPMs"
echo_rpm_install
echo "Removing: ${REMOVE_PKGS[*]}"
# Doing both actions in one command allows for replacing required packages with alternatives
# When --install= flag is used, URLs & local packages are not supported
if ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
rpm-ostree install "${HTTPS_PKGS[@]}"
elif ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
rpm-ostree install "${LOCAL_PKGS[@]}"
elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}"
elif ! ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}"
rpm-ostree install "${LOCAL_PKGS[@]}"
elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}"
rpm-ostree install "${HTTPS_PKGS[@]}"
elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
rpm-ostree override remove "${REMOVE_PKGS[@]}"
rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}"
fi
echo_rpm_install
dnf -y remove "${REMOVE_PKGS[@]}"
dnf -y install "${INSTALL_PKGS[@]}"
elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
echo "Installing RPMs"
echo_rpm_install
Expand Down

0 comments on commit 0bb79d0

Please sign in to comment.