1 Commits

Author SHA1 Message Date
fb96c7e74e Major refactor, bump version to 0.2 2020-04-24 15:14:33 -04:00

View File

@@ -337,6 +337,8 @@ EOF
# Installs a package using the system package manager # Installs a package using the system package manager
# Arguments: # Arguments:
# One or more package names # One or more package names
# Options:
# --noquery, -n: Do not query the package state
# Returns: # Returns:
# Will exit 1 if failed # Will exit 1 if failed
####################################### #######################################
@@ -344,6 +346,29 @@ EOF
_runDebug "${FUNCNAME[0]}" "$@" _runDebug "${FUNCNAME[0]}" "$@"
unset _noquery _pkg_array _url_pkg_array
if _input=$(getopt -o +n -l noquery -- "$@"); then
eval set -- "$_input"
while true; do
case "$1" in
--noquery|-n)
local _noquery="true"
;;
--)
shift
break
;;
esac
shift
done
else
err "Incorrect options provided"
_printHelpAndExit 1
fi
echo "DEBUG:" "$@"
# We will add packages to this array if their command is not available # We will add packages to this array if their command is not available
local -a _pkg_array local -a _pkg_array
local -a _url_pkg_array local -a _url_pkg_array
@@ -353,13 +378,15 @@ EOF
# Clean up package name and handle OS-specific tweaks # Clean up package name and handle OS-specific tweaks
_packageQuirks "$_pkg" _packageQuirks "$_pkg"
# Insert the package name to test if already installed # Insert the package name to test if already installed
if [[ -n $_force ]] || [[ "$_pkg" != "" ]] && ! _pkg_query "$_pkg" > /dev/null 2>&1; then if [[ "$_pkg" != "" ]]; then
if [[ -n $_noquery ]] || ! _pkg_query "$_pkg" > /dev/null 2>&1; then
if [[ -n $_url_pkg ]]; then if [[ -n $_url_pkg ]]; then
_url_pkg_array+=("$_url_pkg") _url_pkg_array+=("$_url_pkg")
else else
_pkg_array+=("$_pkg") _pkg_array+=("$_pkg")
fi fi
fi fi
fi
done done
[[ -n $_debug ]] && echo "_pkg_array:" "${_pkg_array[@]}" [[ -n $_debug ]] && echo "_pkg_array:" "${_pkg_array[@]}"
@@ -367,6 +394,7 @@ EOF
# Install from package name (with gpg check) # Install from package name (with gpg check)
if [[ ${#_pkg_array[@]} -ge 1 ]]; then if [[ ${#_pkg_array[@]} -ge 1 ]]; then
echo "Installing:" "${_pkg_array[@]}" echo "Installing:" "${_pkg_array[@]}"
if [[ -n $_debug ]]; then if [[ -n $_debug ]]; then
if ! _pkg_install "${_pkg_array[@]}"; then if ! _pkg_install "${_pkg_array[@]}"; then
@@ -1201,7 +1229,7 @@ EOF"
if [[ -n $_rpminstall ]]; then if [[ -n $_rpminstall ]]; then
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_installPackage rpmfusion-free-release epel-release _installPackage rpmfusion-free-release epel-release
_installPackage "$_mcrpm" _installPackage --noquery "$_mcrpm"
_symlinkCerts _symlinkCerts
_restoreLicense _restoreLicense
_openFirewall _openFirewall