Add the ability to specify a version from repo

This commit is contained in:
2020-04-30 12:15:09 -04:00
parent c9a9d82d3a
commit 3f4bc9dd98

View File

@@ -47,7 +47,7 @@ OPTIONS
--outputdir PATH --outputdir PATH
Generate rpmbuild output in this directory (Default: $PWD/outputdir) Generate rpmbuild output in this directory (Default: $PWD/outputdir)
--mcversion VERSION --mcversion VERSION
Build or install a specific version (Default: scrape the latest version from Interact) Build or install a specific version (Default: install the latest version)
--restorefile RESTOREFILE --restorefile RESTOREFILE
Restore file location for registration (Default: skip registration) Restore file location for registration (Default: skip registration)
--betapass PASSWORD --betapass PASSWORD
@@ -604,26 +604,28 @@ EOF
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
echo "Installing latest JRiver Media Center from repo..." echo "Installing JRiver Media Center from repo..."
local _mcpkg local _mcpkg
# Add repositories to OS-specific package managers # Add repository files
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then _addRepo() {
# Add repositories to OS-specific package managers
_bash_cmd 'cat <<-EOF > /etc/yum.repos.d/jriver.repo if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_bash_cmd 'cat <<-EOF > /etc/yum.repos.d/jriver.repo
[jriver] [jriver]
name=JRiver Media Center repo by BryanC name=JRiver Media Center repo by BryanC
baseurl=https://repos.bryanroessler.com/jriver baseurl=https://repos.bryanroessler.com/jriver
gpgcheck=0 gpgcheck=0
EOF' EOF'
_mcpkg="MediaCenter" elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | _ifSudo apt-key add - > /dev/null 2>&1
wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | _ifSudo apt-key add - > /dev/null 2>&1 _bash_cmd 'cat <<-EOF > /etc/apt/sources.list.d/jriver.list
_bash_cmd 'cat <<-EOF > /etc/apt/sources.list.d/jriver.list
deb [arch=amd64,i386,armhf] http://dist.jriver.com/latest/mediacenter/ jessie main deb [arch=amd64,i386,armhf] http://dist.jriver.com/latest/mediacenter/ jessie main
EOF' EOF'
fi fi
}
_addRepo
# Update package list # Update package list
if ! _pkg_update > /dev/null 2>&1; then if ! _pkg_update > /dev/null 2>&1; then
@@ -631,25 +633,50 @@ EOF'
exit 1 exit 1
fi fi
# Find latest mversion to install on Ubuntu/Debian # If user specifies a version, use that
if [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then if [[ -n $_mcversion ]]; then
# Try parsing the latest mediacenter?? version from the repo _setVersion
if _mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}'); then _specific_version="$_mcversion"
_mcpkg="${_mcpkg%\'}" fi
_mcpkg="${_mcpkg#\'}"
fi # Fedora/CentOS use a universal package name -- easy
# If that fails, fall back to scraping Interact if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
if ! [[ "$_mcpkg" =~ ^[0-9][0-9]\.[0-9]\.[0-9]\+$ ]]; then _mcpkg="MediaCenter"
fi
# Ubuntu/Debian incorporate the mversion into the package name -- more fun!
if [[ "$ID" =~ ^(ubuntu|debian)$ ]] && [[ -z $_mversion ]]; then
# Try parsing the latest mversion from the repo
_mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}')
_mcpkg="${_mcpkg%\'}"
_mcpkg="${_mcpkg#\'}"
# If the version is missing or bad then fall back to scraping Interact
if [[ ! "$_mcpkg" =~ ^mediacenter[0-9][0-9]$ ]]; then
_setVersion _setVersion
_mcpkg="mediacenter$_mversion" _mcpkg="mediacenter$_mversion"
fi fi
fi fi
if [[ -n $_specific_version ]]; then
if [[ -n $_debug ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_installPackage "$_mcpkg" if [[ -n $_debug ]]; then
_installPackage "$_mcpkg-$_mcversion"
else
_installPackage "$_mcpkg-$_mcversion" > /dev/null 2>&1
fi
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
if [[ -n $_debug ]]; then
_installPackage "$_mcpkg=$_mcversion"
else
_installPackage "$_mcpkg=$_mcversion" > /dev/null 2>&1
fi
fi
else else
_installPackage "$_mcpkg" > /dev/null 2>&1 if [[ -n $_debug ]]; then
_installPackage "$_mcpkg"
else
_installPackage "$_mcpkg" > /dev/null 2>&1
fi
fi fi
# shellcheck disable=SC2181 # shellcheck disable=SC2181