Compare commits
10 Commits
cebe87ff8d
...
156718b659
| Author | SHA1 | Date | |
|---|---|---|---|
| 156718b659 | |||
| 346f5838ee | |||
| 0944c18be4 | |||
| d8f7764ad7 | |||
| f4a967853d | |||
| fe7fdbbc7b | |||
| dd2838dbb2 | |||
| c1a9a5330e | |||
| 16c35e2e2c | |||
| be2d29fd7f |
122
installJRMC
122
installJRMC
@@ -16,10 +16,10 @@
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
declare -g SCRIPTVERSION="1.0.3"
|
||||
declare -g SCRIPTVERSION="1.0.4"
|
||||
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,83.0.html" # MC32
|
||||
declare -g MC_REPO="bullseye"
|
||||
declare -g MC_VERSION_HARDCODE="32.0.45" # Do find all replace
|
||||
declare -g MC_VERSION="32.0.45" # Do find all replace
|
||||
declare -g MC_REPO="bullseye" # should match the MC_VERSION
|
||||
|
||||
printHelp() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
@@ -40,7 +40,7 @@ printHelp() {
|
||||
--compat
|
||||
Build/install MC locally without minimum dependency version requirements
|
||||
--mcversion VERSION
|
||||
Specify the MC version, ex. "$MC_VERSION_HARDCODE" (default: latest version)
|
||||
Specify the MC version, ex. "$MC_VERSION" (default: latest version)
|
||||
--arch VERSION
|
||||
Specify the MC architecture, ex. "amd64", "arm64", etc (default: host architecture)
|
||||
--mcrepo REPO
|
||||
@@ -178,7 +178,7 @@ init() {
|
||||
ID="ubuntu"
|
||||
if [[ ${VERSION_ID%.*} -ge 24 ]]; then
|
||||
debug "Switching to noble repo for *buntu 24"
|
||||
declare -g MC_REPO='noble'
|
||||
declare -g USER_MC_REPO='noble' # Pretend to be user input
|
||||
fi
|
||||
;;
|
||||
*suse*)
|
||||
@@ -219,35 +219,35 @@ init() {
|
||||
PKG_REMOVE=(execute sudo "$RPM_MGR" remove -y)
|
||||
PKG_UPDATE=(execute sudo "$RPM_MGR" makecache)
|
||||
PKG_QUERY=(rpm -q)
|
||||
PKG_INSTALL_LOCAL(){ installMCRPM; }
|
||||
PKG_INSTALL_LOCAL(){ installMCRpm; }
|
||||
;;
|
||||
debian|ubuntu)
|
||||
PKG_INSTALL=(execute sudo apt-get -f install -y -q0)
|
||||
PKG_REMOVE=(execute sudo apt-get remove --auto-remove -y -q0)
|
||||
PKG_UPDATE=(execute sudo apt-get update -y -q0)
|
||||
PKG_QUERY=(dpkg -s)
|
||||
PKG_INSTALL_LOCAL(){ installMCDEB; }
|
||||
PKG_INSTALL_LOCAL(){ installMCDeb; }
|
||||
;;
|
||||
suse)
|
||||
PKG_INSTALL=(execute sudo zypper --gpg-auto-import-keys --non-interactive --quiet install --force --no-confirm)
|
||||
PKG_REMOVE=(execute sudo zypper --non-interactive --quiet remove --clean-deps)
|
||||
PKG_UPDATE=(execute sudo zypper --non-interactive --quiet refresh jriver)
|
||||
PKG_QUERY=(rpm -q)
|
||||
PKG_INSTALL_LOCAL(){ installMCRPM; }
|
||||
PKG_INSTALL_LOCAL(){ installMCRpm; }
|
||||
;;
|
||||
arch)
|
||||
PKG_INSTALL=(execute sudo pacman -Sy --noconfirm)
|
||||
PKG_REMOVE=(execute sudo pacman -Rs --noconfirm)
|
||||
PKG_UPDATE=(execute sudo pacman -Syy)
|
||||
PKG_QUERY=(sudo pacman -Qs)
|
||||
PKG_INSTALL_LOCAL(){ installMCARCH; }
|
||||
PKG_INSTALL_LOCAL(){ installMCArch; }
|
||||
;;
|
||||
unknown)
|
||||
PKG_INSTALL=(:)
|
||||
PKG_REMOVE=(:)
|
||||
PKG_UPDATE=(:)
|
||||
PKG_QUERY=(:)
|
||||
PKG_INSTALL_LOCAL(){ installMCGENERIC; }
|
||||
PKG_INSTALL_LOCAL(){ installMCGeneric; }
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ parseInput() {
|
||||
|
||||
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH TEST_SWITCH
|
||||
declare -g LOCAL_INSTALL_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH
|
||||
declare -g YES_SWITCH USER_VERSION_SWITCH USER_ARCH
|
||||
declare -g YES_SWITCH USER_MC_VERSION
|
||||
declare -g RESTOREFILE BETAPASS SERVICE_TYPE
|
||||
declare -g VNCPASS USER_DISPLAY
|
||||
declare -ga SERVICES CONTAINERS
|
||||
@@ -321,14 +321,21 @@ parseInput() {
|
||||
;;
|
||||
--mcversion)
|
||||
shift
|
||||
MC_VERSION="$1"
|
||||
USER_VERSION_SWITCH=1
|
||||
if [[ $1 =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
USER_MC_VERSION="$1"
|
||||
else
|
||||
err "Bad --mcversion"
|
||||
printHelp
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--arch)
|
||||
shift && USER_ARCH="$1"
|
||||
shift
|
||||
echo "Switching from $ARCH to $1 architecture"
|
||||
ARCH="$1"
|
||||
;;
|
||||
--mcrepo)
|
||||
shift && declare -g MC_REPO="$1"
|
||||
shift && declare -g USER_MC_REPO="$1"
|
||||
;;
|
||||
--restorefile)
|
||||
shift && RESTOREFILE="$1"
|
||||
@@ -412,36 +419,47 @@ setMCVersion() {
|
||||
declare cnt
|
||||
|
||||
# User input
|
||||
if (( USER_VERSION_SWITCH )) &&
|
||||
[[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
if [[ -n $USER_MC_VERSION ]]; then
|
||||
MC_VERSION_SOURCE="user input"
|
||||
MC_VERSION="$USER_MC_VERSION"
|
||||
# Containerized package manager
|
||||
elif installPackage --silent buildah &&
|
||||
cnt=$(buildah from --quiet debian:stable-slim) &>/dev/null &&
|
||||
buildah run "$cnt" -- bash -c \
|
||||
"echo 'deb [trusted=no arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $MC_REPO main' > /etc/apt/sources.list 2>&1" &>/dev/null &&
|
||||
buildah run "$cnt" -- bash -c \
|
||||
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null &&
|
||||
MC_VERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null &&
|
||||
[[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
MC_VERSION_SOURCE="containerized package manager"
|
||||
execute buildah rm "$cnt"
|
||||
# Webscrape
|
||||
elif installPackage --silent wget &&
|
||||
MC_VERSION=$(wget -qO- "$BOARDURL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) &&
|
||||
[[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
MC_VERSION_SOURCE="webscrape"
|
||||
# Hardcoded
|
||||
else
|
||||
echo "Determining latest MC version"
|
||||
if installPackage --silent buildah &&
|
||||
hash buildah &>/dev/null &&
|
||||
cnt=$(buildah from --quiet debian:"${MC_REPO/noble/bullseye}"-slim) &>/dev/null &&
|
||||
buildah run "$cnt" -- bash -c \
|
||||
"echo 'deb [trusted=no arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $MC_REPO main' > /etc/apt/sources.list 2>&1" &>/dev/null &&
|
||||
buildah run "$cnt" -- bash -c \
|
||||
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null &&
|
||||
MC_VERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null &&
|
||||
[[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
MC_VERSION_SOURCE="containerized package manager"
|
||||
execute buildah rm "$cnt"
|
||||
# Webscrape
|
||||
elif installPackage wget && MC_VERSION=$(wget -qO- "$BOARDURL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) &&
|
||||
[[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||
MC_VERSION_SOURCE="webscrape"
|
||||
# Hardcoded
|
||||
else
|
||||
declare -g MC_VERSION="$MC_VERSION_HARDCODE"
|
||||
MC_VERSION_SOURCE="hardcoded or MC_VERSION env"
|
||||
err "Warning! Using hardcoded version number"
|
||||
fi
|
||||
MC_VERSION_SOURCE="hardcoded"
|
||||
err "Warning! Using hardcoded version number"
|
||||
fi
|
||||
|
||||
# Set major version var
|
||||
MC_MVERSION="${MC_VERSION%%.*}"
|
||||
|
||||
# Set legacy MC repos based on the major version number
|
||||
# Users can override with --mcrepo
|
||||
if [[ -z $USER_MC_REPO ]]; then
|
||||
case $MC_MVERSION in
|
||||
2[0-6])
|
||||
MC_REPO="jessie"
|
||||
;;
|
||||
2[7-9]|30)
|
||||
MC_REPO="buster"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
MC_PKG="mediacenter$MC_MVERSION"
|
||||
MC_RPM="$OUTPUTDIR/RPMS/x86_64/mediacenter$MC_MVERSION-$MC_VERSION.x86_64.rpm"
|
||||
MC_ROOT="/usr/lib/jriver/Media Center $MC_MVERSION"
|
||||
@@ -459,9 +477,11 @@ setMCVersion() {
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo "Using MC version $MC_VERSION determined by $MC_VERSION_SOURCE"
|
||||
|
||||
echo "Using the $MC_REPO repository"
|
||||
echo "Using MC version $MC_VERSION from the $MC_REPO repo determined by $MC_VERSION_SOURCE"
|
||||
[[ $MC_VERSION_SOURCE == "user input" ]] || echo "To override, use --mcversion"
|
||||
debug "MVERSION: $MC_MVERSION, MC_VERSION: $MC_VERSION, MC_PKG: $MC_PKG, MC_RPM: $MC_RPM"
|
||||
debug "MC_VERSION=$MC_VERSION, MC_REPO=$MC_REPO, MC_PKG=$MC_PKG, MC_RPM=$MC_RPM"
|
||||
}
|
||||
|
||||
|
||||
@@ -664,7 +684,7 @@ installMCFromRepo() {
|
||||
acquireDeb() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
declare -g MC_DEB="$OUTPUTDIR/SOURCES/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb"
|
||||
declare -g MC_DEB="$OUTPUTDIR/SOURCES/MediaCenter-$MC_VERSION-$ARCH.deb"
|
||||
|
||||
debug "MC_DEB=$MC_DEB"
|
||||
|
||||
@@ -676,13 +696,13 @@ acquireDeb() {
|
||||
|
||||
if [[ -v BETAPASS ]] &&
|
||||
echo "Checking beta repo for DEB package" && execute wget -q -O "$MC_DEB" \
|
||||
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/beta/$BETAPASS/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb"; then
|
||||
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/beta/$BETAPASS/MediaCenter-$MC_VERSION-$ARCH.deb"; then
|
||||
echo "Found!"
|
||||
elif echo "Checking latest repo for DEB package" && execute wget -q -O "$MC_DEB" \
|
||||
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb"; then
|
||||
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-$ARCH.deb"; then
|
||||
echo "Found!"
|
||||
elif echo "Checking test repo for DEB package" && execute wget -q -O "$MC_DEB" \
|
||||
"https://files.jriver-cdn.com/mediacenter/test/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb"; then
|
||||
"https://files.jriver-cdn.com/mediacenter/test/MediaCenter-$MC_VERSION-$ARCH.deb"; then
|
||||
echo "Found!"
|
||||
else
|
||||
err "Cannot find DEB file"
|
||||
@@ -811,7 +831,7 @@ buildRPM() {
|
||||
Release: 1
|
||||
Summary: JRiver Media Center
|
||||
Group: Applications/Media
|
||||
Source0: http://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb
|
||||
Source0: http://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-$ARCH.deb
|
||||
BuildArch: x86_64
|
||||
%define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}.%%{ARCH}.rpm
|
||||
|
||||
@@ -876,7 +896,7 @@ buildRPM() {
|
||||
#######################################
|
||||
# Installs Media Center DEB package and optional compatability fixes
|
||||
#######################################
|
||||
installMCDEB() {
|
||||
installMCDeb() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
if (( COMPAT_SWITCH )); then
|
||||
@@ -909,7 +929,7 @@ installMCDEB() {
|
||||
#######################################
|
||||
# Installs Media Center RPM package
|
||||
#######################################
|
||||
installMCRPM() {
|
||||
installMCRpm() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
# Install mesa-va-freeworld separately from the RPM for dnf swap
|
||||
@@ -922,7 +942,7 @@ installMCRPM() {
|
||||
#######################################
|
||||
# Installs Media Center manually
|
||||
#######################################
|
||||
installMCGENERIC() {
|
||||
installMCGeneric() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
declare -a raw_files
|
||||
@@ -953,7 +973,7 @@ installMCGENERIC() {
|
||||
#######################################
|
||||
# Installs local Media Center PKGBUILD
|
||||
#######################################
|
||||
installMCARCH() {
|
||||
installMCArch() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
[[ -d $OUTPUTDIR/PKGBUILD ]] || execute mkdir -p "$OUTPUTDIR/PKGBUILD"
|
||||
@@ -976,7 +996,7 @@ installMCARCH() {
|
||||
'vorbis-tools: ogg vorbis support'
|
||||
'musepack-tools: musepack support'
|
||||
)
|
||||
source=("http://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-${USER_ARCH:-$ARCH}.deb")
|
||||
source=("http://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-$ARCH.deb")
|
||||
|
||||
package() {
|
||||
cd "\$srcdir"
|
||||
|
||||
Reference in New Issue
Block a user