Fix --compat on deb distros

This commit is contained in:
2022-01-13 13:26:05 -05:00
parent 5f030454b9
commit 22c2be25bc

View File

@@ -272,6 +272,7 @@ getLatestVersion() {
# Options: # Options:
# --skip-check-installed: Do not check if package is already installed # --skip-check-installed: Do not check if package is already installed
# --nogpgcheck: Disable GPG checks for RPM based distros # --nogpgcheck: Disable GPG checks for RPM based distros
# --allow-downgrades: Useful for installing compatability versions on DEB based distros
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy) # --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
####################################### #######################################
installPackage() { installPackage() {
@@ -280,13 +281,16 @@ installPackage() {
declare -a pkg_array install_flags declare -a pkg_array install_flags
declare pkg skip_check_installed silent _return pkg_install_cmd declare pkg skip_check_installed silent _return pkg_install_cmd
if _input=$(getopt -o +s -l skip-check-installed,nogpgcheck,silent -- "$@"); then if _input=$(getopt -o +s -l skip-check-installed,allow-downgrades,nogpgcheck,silent -- "$@"); then
eval set -- "$_input" eval set -- "$_input"
while true; do while true; do
case "$1" in case "$1" in
--skip-check-installed) --skip-check-installed)
skip_check_installed=1 skip_check_installed=1
;; ;;
--allow-downgrades)
[[ "$ID" =~ (debian|ubuntu|neon) ]] && install_flags+=(--allow-downgrades)
;;
--nogpgcheck) --nogpgcheck)
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
install_flags+=(--nogpgcheck) install_flags+=(--nogpgcheck)