Set _mcpkg even when _mcversion is specified

This commit is contained in:
2020-04-30 12:30:12 -04:00
parent 52bcde5620
commit 14672fe85d

View File

@@ -628,6 +628,7 @@ EOF'
_addRepo _addRepo
# Update package list # Update package list
[[ -n $_debug ]] && echo "Updating package list"
if ! _pkg_update > /dev/null 2>&1; then if ! _pkg_update > /dev/null 2>&1; then
err "Package update failed!" err "Package update failed!"
exit 1 exit 1
@@ -636,25 +637,36 @@ EOF'
# If user specifies a version, use that # If user specifies a version, use that
if [[ -n $_mcversion ]]; then if [[ -n $_mcversion ]]; then
_setVersion _setVersion
_specific_version="$_mcversion" local _specific_version="true"
fi fi
local _mcpkg
# Fedora/CentOS use a universal package name -- easy # Fedora/CentOS use a universal package name -- easy
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_mcpkg="MediaCenter" _mcpkg="MediaCenter"
fi fi
# Ubuntu/Debian incorporate the mversion into the package name -- more fun! # Ubuntu/Debian incorporate the mversion into the package name -- more fun!
if [[ "$ID" =~ ^(ubuntu|debian)$ ]] && [[ -z $_mversion ]]; then if [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
# Try parsing the latest mversion from the repo if [[ -z $_mversion ]]; then
_mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}') # Try parsing the latest mversion from the repo
_mcpkg="${_mcpkg%\'}" if _mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}'); then
_mcpkg="${_mcpkg#\'}" _mcpkg="${_mcpkg%\'}"
# If the version is missing or bad then fall back to scraping Interact _mcpkg="${_mcpkg#\'}"
if [[ ! "$_mcpkg" =~ ^mediacenter[0-9][0-9]$ ]]; then # Scrape Interact
_setVersion else
_setVersion
_mcpkg="mediacenter$_mversion"
fi
else
_mcpkg="mediacenter$_mversion" _mcpkg="mediacenter$_mversion"
fi fi
# Sanity check
if [[ ! "$_mcpkg" =~ ^mediacenter[0-9][0-9]$ ]]; then
err "Could not parse MC package name"
exit 1
fi
fi fi
if [[ -n $_specific_version ]]; then if [[ -n $_specific_version ]]; then