From 95695fc7b03189b3be2f646e65e797f2921cab0a Mon Sep 17 00:00:00 2001 From: bryan Date: Tue, 14 Feb 2023 14:03:44 -0500 Subject: [PATCH] Add --arch for cross-compile --- README.md | 8 ++++---- installJRMC | 37 ++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 41c045a..ad0f0b8 100755 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@ This program will install [JRiver Media Center](https://www.jriver.com/) (JRMC) `installJRMC [--option [ARGUMENT]]` -Running `installJRMC` without any options will install the latest version of JRiver Media Center from the official JRiver repository (Ubuntu/Debian) or my [unofficial repository](https://repos.bryanroessler.com/jriver/) (Fedora/CentOS) using the system package manager (`--install repo`). If any other option is specified, then the default install method (i.e. `--install repo` or `--install local`) will need to be explicitly specified. This makes it possible to install services and containers independent of MC. - -**Note**: As of v1.0b14 major version library migrations are performed if the destination config directory `$HOME/.jriver/Media Center XX` is missing for major release `XX`. However, it is still a good idea to create a manual library backup before migrating major versions. +Running `installJRMC` without any options will install the latest version of JRiver Media Center (MC) from the official JRiver repository (Ubuntu/Debian) or my [unofficial repository](https://repos.bryanroessler.com/jriver/) (Fedora/CentOS) using the system package manager (`--install repo`). If any other option is specified, then the default install method (i.e. `--install repo` or `--install local`) will need to be explicitly specified. This makes it possible to install services and containers independent of MC. ## Options @@ -24,6 +22,8 @@ $ installJRMC --help Build/install MC without minimum dependency version requirements --mcversion VERSION Build or install a specific MC version, ex. "30.0.55" (default: latest version) +--arch ARCH + Specify the MC architecture, ex. "amd64", "arm64", etc (default: host architecture) --outputdir PATH Generate rpmbuild output in this PATH (default: ./output) --restorefile RESTOREFILE @@ -136,6 +136,6 @@ Multiple services (but not `--service-types`) can be installed at one time using ## Additional Info -Did you find `installJRMC` useful? [Buy me a coffee!](https://paypal.me/bryanroessler?locale.x=en_US) +Did you find `installJRMC` useful? [Buy me a coffee!](https://paypal.me/bryanroessler) Did you find a bug? Let me know on [Interact!](https://yabb.jriver.com/interact/index.php/topic,134152.0.html) diff --git a/installJRMC b/installJRMC index a72aee2..d2dceb5 100755 --- a/installJRMC +++ b/installJRMC @@ -16,7 +16,7 @@ shopt -s extglob -declare -g SCRIPTVERSION="1.0-rc5" +declare -g SCRIPTVERSION="1.0-dev" declare -g OUTPUTDIR="$PWD/output" # MC30 (Buster) @@ -46,7 +46,9 @@ printHelp() { --compat Build/install MC locally without minimum dependency version requirements --mcversion VERSION - Specify the MC version, ex. 30.0.55" (default: latest version) + Specify the MC version, ex. "30.0.55" (default: latest version) + --arch VERSION + Specify the MC architecture, ex. "amd64", "arm64", etc (default: host architecture) --outputdir PATH Generate rpmbuild output in this directory (default: ./output) --restorefile RESTOREFILE @@ -142,7 +144,7 @@ parseInput() { LOCAL_INSTALL_SWITCH=1 fi - long_opts="install:,build::,outputdir:,mcversion:,restorefile:,betapass:," + long_opts="install:,build::,outputdir:,mcversion:,restorefile:,betapass:,arch:," long_opts+="service-type:,service:,services:,version,debug,help,uninstall," long_opts+="createrepo::,createrepo-webroot:,createrepo-user:," long_opts+="vncpass:,display:,container:,tests,compat" @@ -176,6 +178,10 @@ parseInput() { MCVERSION="$1" USER_VERSION_SWITCH=1 ;; + --arch) + shift + ARCH="$1" + ;; --restorefile) shift && RESTOREFILE="$1" ;; @@ -249,7 +255,7 @@ parseInput() { init() { debug "Running: ${FUNCNAME[0]}" - declare -g ID RPM_MGR + declare -g ID RPM_MGR ARCH echo "Starting installJRMC" debug || echo "To enable debugging output, use --debug or -d" @@ -263,7 +269,16 @@ init() { exit 1 fi - debug "Detected host platform: $ID $VERSION_ID" + # Detect architecture and translate to MC convention + # Also catch user input in getopt + ARCH=$(uname -m) + case "$ARCH" in + x86_64) + ARCH="amd64" + ;; + esac + + debug "Detected host platform: $ID $VERSION_ID $ARCH" # normalize ID and set distro-specific vars case "$ID" in @@ -564,7 +579,7 @@ installMCFromRepo() { acquireDeb() { debug "Running: ${FUNCNAME[0]}" - declare -g MCDEB="$OUTPUTDIR/SOURCES/MediaCenter-$MCVERSION-amd64.deb" + declare -g MCDEB="$OUTPUTDIR/SOURCES/MediaCenter-$MCVERSION-$ARCH.deb" # If necessary, create SOURCES dir [[ -d "$OUTPUTDIR/SOURCES" ]] || execute "mkdir -p $OUTPUTDIR/SOURCES" @@ -577,13 +592,13 @@ acquireDeb() { if [[ -v BETAPASS ]] && echo "Checking beta repo for DEB package" && wget -q -O "$MCDEB" \ - "https://files.jriver.com/mediacenter/channels/v$MVERSION/beta/$BETAPASS/MediaCenter-$MCVERSION-amd64.deb"; then + "https://files.jriver.com/mediacenter/channels/v$MVERSION/beta/$BETAPASS/MediaCenter-$MCVERSION-$ARCH.deb"; then echo "Found!" elif echo "Checking latest repo for DEB package" && wget -q -O "$MCDEB" \ - "https://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-amd64.deb"; then + "https://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-$ARCH.deb"; then echo "Found!" elif echo "Checking test repo for DEB package" && wget -q -O "$MCDEB" \ - "https://files.jriver.com/mediacenter/test/MediaCenter-$MCVERSION-amd64.deb"; then + "https://files.jriver.com/mediacenter/test/MediaCenter-$MCVERSION-$ARCH.deb"; then echo "Found!" else err "Cannot find DEB file" @@ -712,7 +727,7 @@ buildRPM() { Release: 1 Summary: JRiver Media Center Group: Applications/Media - Source0: http://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-amd64.deb + Source0: http://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-$ARCH.deb BuildArch: x86_64 %define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}.%%{ARCH}.rpm @@ -877,7 +892,7 @@ installMCARCH() { 'vorbis-tools: ogg vorbis support' 'musepack-tools: musepack support' ) - source=("http://files.jriver.com/mediacenter/channels/v30/latest/MediaCenter-$MCVERSION-amd64.deb") + source=("http://files.jriver.com/mediacenter/channels/v30/latest/MediaCenter-$MCVERSION-$ARCH.deb") package() { cd "\$srcdir"