Skip to content

Commit

Permalink
chore: Install & remove using dnf in single operation cases
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Dec 22, 2024
1 parent b898af2 commit 6523979
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions modules/dnf/dnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ! rpm -q dnf5-plugins &>/dev/null; then
fi

# Pull in repos
get_json_array REPOS 'try .["repos"][]' "$1"
get_json_array REPOS 'try .["repos"][]' "${1}"
if [[ ${#REPOS[@]} -gt 0 ]]; then
echo "Adding repositories"
# Substitute %OS_VERSION% & remove newlines/whitespaces from all repo entries
Expand Down Expand Up @@ -47,7 +47,7 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then
done
fi

get_json_array KEYS 'try .["keys"][]' "$1"
get_json_array KEYS 'try .["keys"][]' "${1}"
if [[ ${#KEYS[@]} -gt 0 ]]; then
echo "Adding keys"
for KEY in "${KEYS[@]}"; do
Expand All @@ -57,7 +57,7 @@ if [[ ${#KEYS[@]} -gt 0 ]]; then
fi

# Create symlinks to fix packages that create directories in /opt
get_json_array OPTFIX 'try .["optfix"][]' "$1"
get_json_array OPTFIX 'try .["optfix"][]' "${1}"
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
Expand All @@ -73,8 +73,8 @@ if [[ ${#OPTFIX[@]} -gt 0 ]]; then
done
fi

get_json_array INSTALL_PKGS 'try .["install"][]' "$1"
get_json_array REMOVE_PKGS 'try .["remove"][]' "$1"
get_json_array INSTALL_PKGS 'try .["install"][]' "${1}"
get_json_array REMOVE_PKGS 'try .["remove"][]' "${1}"

CLASSIC_INSTALL=false
HTTPS_INSTALL=false
Expand Down Expand Up @@ -152,11 +152,11 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#REMOVE_PKGS[@]} -gt 0 ]]; then
elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
echo "Installing RPMs"
echo_rpm_install
rpm-ostree install "${INSTALL_PKGS[@]}"
dnf -y install "${INSTALL_PKGS[@]}"
elif [[ ${#REMOVE_PKGS[@]} -gt 0 ]]; then
echo "Removing RPMs"
echo "Removing: ${REMOVE_PKGS[*]}"
rpm-ostree override remove "${REMOVE_PKGS[@]}"
dnf -y remove "${REMOVE_PKGS[@]}"
fi

get_json_array REPLACE 'try .["replace"][]' "$1"
Expand Down

0 comments on commit 6523979

Please sign in to comment.