Add the ability to specify a version from repo
This commit is contained in:
51
installJRMC
51
installJRMC
@@ -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 repository files
|
||||||
|
_addRepo() {
|
||||||
# Add repositories to OS-specific package managers
|
# Add repositories to OS-specific package managers
|
||||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||||
|
|
||||||
_bash_cmd 'cat <<-EOF > /etc/yum.repos.d/jriver.repo
|
_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,26 +633,51 @@ 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"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fedora/CentOS use a universal package name -- easy
|
||||||
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; 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%\'}"
|
||||||
_mcpkg="${_mcpkg#\'}"
|
_mcpkg="${_mcpkg#\'}"
|
||||||
fi
|
# If the version is missing or bad then fall back to scraping Interact
|
||||||
# If that fails, fall back to scraping Interact
|
if [[ ! "$_mcpkg" =~ ^mediacenter[0-9][0-9]$ ]]; then
|
||||||
if ! [[ "$_mcpkg" =~ ^[0-9][0-9]\.[0-9]\.[0-9]\+$ ]]; then
|
|
||||||
_setVersion
|
_setVersion
|
||||||
_mcpkg="mediacenter$_mversion"
|
_mcpkg="mediacenter$_mversion"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n $_specific_version ]]; then
|
||||||
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||||
|
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
|
||||||
if [[ -n $_debug ]]; then
|
if [[ -n $_debug ]]; then
|
||||||
_installPackage "$_mcpkg"
|
_installPackage "$_mcpkg"
|
||||||
else
|
else
|
||||||
_installPackage "$_mcpkg" > /dev/null 2>&1
|
_installPackage "$_mcpkg" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
# Rationale: More compact to check this once
|
# Rationale: More compact to check this once
|
||||||
|
|||||||
Reference in New Issue
Block a user