diff --git a/quickget b/quickget index 75e0bde..33e4685 100755 --- a/quickget +++ b/quickget @@ -3683,6 +3683,118 @@ fi LANGS=() +os_supported_release() { + if [[ ! " ${RELEASES[*]} " =~ " ${RELEASE} " ]]; then + echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release." + echo -n 'Supported releases: ' + "releases_${OS}" + exit 1 + fi +} + +os_supported_edition() { + if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then + echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n" + echo -n ' - Editions: ' + for EDITION in "${EDITIONS[@]}"; do + echo -n "${EDITION} " + done + echo "" + exit 1 + fi +} + +os_error_edition() { + echo -en "ERROR! You must specify an edition.\n - Editions: " + #TODO ERROR here + "editions_${OS}" + exit 1 +} + +os_supported_lang() { + echo -e "ERROR! ${LANG} is not a supported $(pretty_name "${OS}") language\n" + echo -n ' - Editions: ' + for LANG in "${LANGS[@]}"; do + echo -n "${LANG} " + done + exit 1 +} + +handle_missing() { + # Handle odd missing Fedora combinations + if [[ $OS == fedora ]] ; then + if [[ ${RELEASE} = "33" && ${EDITION} = "i3" ]] || [[ ${RELEASE} = "34" && ${EDITION} = "Cinnamon" ]] || [[ "${RELEASE}" < "39" && ${EDITION} = "Onyx" ]]; then + echo "ERROR! Unsupported combination" + echo " Fedora ${RELEASE} ${EDITION} is not available, please choose another Release or Edition" + exit 1; + fi + fi + # Handle missing Manjaro Sway minimal + if [[ $OS == manjaro ]] ; then + if [[ ${RELEASE} == "sway" && ${EDITION} == "minimal" ]] ; then + echo "ERROR! Unsupported combination" + echo " Manjaro Sway does not have a minimal edition" + exit 1; + fi + fi +} + +os_error() { + echo 'ERROR! You must specify an operating system.' + echo '- Supported Operating Systems:' + os_support | fold -s -w "$(tput cols)" + echo -e "\nTo see all possible arguments, use:\n quickget -h or quickget --help" + exit 1 +} + +os_not_supported() { + echo -e "ERROR! ${OS} is not a supported OS.\n" + os_support | fold -s -w "$(tput cols)" + exit 1 +} + +os_path_error() { + echo 'ERROR! You must specify path.' + os_error + exit 1 +} + +os_error_release() { + echo 'ERROR! You must specify a release.' + case ${OS} in + *ubuntu-server*) + echo -n ' - Releases: ' + releases_ubuntu-server | sed -Ee 's/eol-\S+//g' # hide eol releases + ;; + *ubuntu*) + echo -n ' - Releases: ' + releases_ubuntu | sed -Ee 's/eol-\S+//g' # hide eol releases + ;; + *windows*) + echo -n ' - Releases: ' + "releases_${OS}" + echo -n ' - Languages: ' + "languages_${OS}" && echo "${LANGS[@]}" + ;; + *) + echo -n ' - Releases: ' + "releases_${OS}" | fold -s -w "$(tput cols)" + if [[ $(type -t "editions_${OS}") == function ]]; then + echo -n ' - Editions: ' + "editions_${OS}" | fold -s -w "$(tput cols)" + fi + ;; + esac + exit 1 +} + +CURL=$(command -v curl) +if [ ! -e "${CURL}" ]; then + echo "ERROR! curl not found. Please make install curl" + exit 1 +fi +CURL_VERSION=$("${CURL}" --version | head -1 | cut -d' ' -f2) + if [ -n "${1}" ]; then OS="${1,,}" if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then