Add --arch for cross-compile

This commit is contained in:
2023-02-14 14:03:44 -05:00
parent 29e94c7488
commit 95695fc7b0
2 changed files with 30 additions and 15 deletions

View File

@@ -6,9 +6,7 @@ This program will install [JRiver Media Center](https://www.jriver.com/) (JRMC)
`installJRMC [--option [ARGUMENT]]` `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. 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.
**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.
## Options ## Options
@@ -24,6 +22,8 @@ $ installJRMC --help
Build/install MC without minimum dependency version requirements Build/install MC without minimum dependency version requirements
--mcversion VERSION --mcversion VERSION
Build or install a specific MC version, ex. "30.0.55" (default: latest 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 --outputdir PATH
Generate rpmbuild output in this PATH (default: ./output) Generate rpmbuild output in this PATH (default: ./output)
--restorefile RESTOREFILE --restorefile RESTOREFILE
@@ -136,6 +136,6 @@ Multiple services (but not `--service-types`) can be installed at one time using
## Additional Info ## 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) Did you find a bug? Let me know on [Interact!](https://yabb.jriver.com/interact/index.php/topic,134152.0.html)

View File

@@ -16,7 +16,7 @@
shopt -s extglob shopt -s extglob
declare -g SCRIPTVERSION="1.0-rc5" declare -g SCRIPTVERSION="1.0-dev"
declare -g OUTPUTDIR="$PWD/output" declare -g OUTPUTDIR="$PWD/output"
# MC30 (Buster) # MC30 (Buster)
@@ -46,7 +46,9 @@ printHelp() {
--compat --compat
Build/install MC locally without minimum dependency version requirements Build/install MC locally without minimum dependency version requirements
--mcversion VERSION --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 --outputdir PATH
Generate rpmbuild output in this directory (default: ./output) Generate rpmbuild output in this directory (default: ./output)
--restorefile RESTOREFILE --restorefile RESTOREFILE
@@ -142,7 +144,7 @@ parseInput() {
LOCAL_INSTALL_SWITCH=1 LOCAL_INSTALL_SWITCH=1
fi 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+="service-type:,service:,services:,version,debug,help,uninstall,"
long_opts+="createrepo::,createrepo-webroot:,createrepo-user:," long_opts+="createrepo::,createrepo-webroot:,createrepo-user:,"
long_opts+="vncpass:,display:,container:,tests,compat" long_opts+="vncpass:,display:,container:,tests,compat"
@@ -176,6 +178,10 @@ parseInput() {
MCVERSION="$1" MCVERSION="$1"
USER_VERSION_SWITCH=1 USER_VERSION_SWITCH=1
;; ;;
--arch)
shift
ARCH="$1"
;;
--restorefile) --restorefile)
shift && RESTOREFILE="$1" shift && RESTOREFILE="$1"
;; ;;
@@ -249,7 +255,7 @@ parseInput() {
init() { init() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare -g ID RPM_MGR declare -g ID RPM_MGR ARCH
echo "Starting installJRMC" echo "Starting installJRMC"
debug || echo "To enable debugging output, use --debug or -d" debug || echo "To enable debugging output, use --debug or -d"
@@ -263,7 +269,16 @@ init() {
exit 1 exit 1
fi 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 # normalize ID and set distro-specific vars
case "$ID" in case "$ID" in
@@ -564,7 +579,7 @@ installMCFromRepo() {
acquireDeb() { acquireDeb() {
debug "Running: ${FUNCNAME[0]}" 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 # If necessary, create SOURCES dir
[[ -d "$OUTPUTDIR/SOURCES" ]] || execute "mkdir -p $OUTPUTDIR/SOURCES" [[ -d "$OUTPUTDIR/SOURCES" ]] || execute "mkdir -p $OUTPUTDIR/SOURCES"
@@ -577,13 +592,13 @@ acquireDeb() {
if [[ -v BETAPASS ]] && if [[ -v BETAPASS ]] &&
echo "Checking beta repo for DEB package" && wget -q -O "$MCDEB" \ 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!" echo "Found!"
elif echo "Checking latest repo for DEB package" && wget -q -O "$MCDEB" \ 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!" echo "Found!"
elif echo "Checking test repo for DEB package" && wget -q -O "$MCDEB" \ 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!" echo "Found!"
else else
err "Cannot find DEB file" err "Cannot find DEB file"
@@ -712,7 +727,7 @@ buildRPM() {
Release: 1 Release: 1
Summary: JRiver Media Center Summary: JRiver Media Center
Group: Applications/Media 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 BuildArch: x86_64
%define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}.%%{ARCH}.rpm %define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}.%%{ARCH}.rpm
@@ -877,7 +892,7 @@ installMCARCH() {
'vorbis-tools: ogg vorbis support' 'vorbis-tools: ogg vorbis support'
'musepack-tools: musepack 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() { package() {
cd "\$srcdir" cd "\$srcdir"