Add sanity warnings

This commit is contained in:
2024-11-04 12:39:58 -05:00
parent 98f898f0e3
commit 7b924710b4

View File

@@ -13,6 +13,8 @@
# #
# BUGS # BUGS
# 1. No createrepo on Mint # 1. No createrepo on Mint
#
# Be careful with tabs in heredocs
shopt -s extglob shopt -s extglob
declare -g SCRIPT_VERSION="1.3.11-dev" declare -g SCRIPT_VERSION="1.3.11-dev"
@@ -193,6 +195,11 @@ parse_input() {
else else
err "Incorrect options provided"; print_help; exit 1 err "Incorrect options provided"; print_help; exit 1
fi fi
# Print some warnings for unsupported argument combinations
if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then
err "--install=local is not compatible with --mcrepo as only the default ($MC_REPO) DEB is available"
fi
} }
# @description Perform OS detection and generate OS-specific functions # @description Perform OS detection and generate OS-specific functions
@@ -259,7 +266,7 @@ init() {
*suse*) *suse*)
ID="suse" ID="suse"
# Currently there is no remote repository for SUSE # Currently there is no remote repository for SUSE
# installJRMC can easily build one but I'd rather a SUSEian provide it # installJRMC can easily create one but I'd rather a SUSEian provide it
# So use local rpmbuild method by default for SUSE # So use local rpmbuild method by default for SUSE
if [[ $# -le 2 ]]; then if [[ $# -le 2 ]]; then
case "$1" in case "$1" in
@@ -480,16 +487,14 @@ install_package() {
# Generate installation flags based on the distribution # Generate installation flags based on the distribution
case $ID in case $ID in
debian|ubuntu) debian|ubuntu)
((allow_downgrades)) && install_flags+=(--allow-downgrades) ((allow_downgrades)) && install_flags+=(--allow-downgrades) ;;
;;
fedora|centos) fedora|centos)
((allow_downgrades)) && install_flags+=(--allowerasing) ((allow_downgrades)) && install_flags+=(--allowerasing)
((no_gpg_check)) && install_flags+=(--nogpgcheck) ((no_gpg_check)) && install_flags+=(--nogpgcheck)
((refresh)) && install_flags+=(--refresh) ((refresh)) && install_flags+=(--refresh)
;; ;;
suse) suse)
((no_gpg_check)) && install_flags+=(--allow-unsigned-rpm) ((no_gpg_check)) && install_flags+=(--allow-unsigned-rpm) ;;
;;
esac esac
# Install packages if any need installation # Install packages if any need installation
@@ -884,6 +889,7 @@ install_mc_deb() {
--allow-downgrades \ --allow-downgrades \
"$MC_DEB"; then "$MC_DEB"; then
err "Local MC DEB installation failed" err "Local MC DEB installation failed"
err "Only the default MC repo can be used for --install=local"
if ask_ok "Remove source DEB and retry"; then if ask_ok "Remove source DEB and retry"; then
execute rm -f "$MC_DEB" execute rm -f "$MC_DEB"
exec "$SCRIPT_PATH" "$@" "--no-update" exec "$SCRIPT_PATH" "$@" "--no-update"