Compare commits
58 Commits
9cf7b6d2b8
...
7bad2bf96c
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bad2bf96c | |||
| 58674364c6 | |||
| 3d2f343e00 | |||
| 00de925240 | |||
| 0dee6d3971 | |||
| 6fa7df13dd | |||
| 61eebeb41b | |||
| 2f99036efb | |||
| 5a226d9d6d | |||
| bb92bbb10e | |||
| c81d262d79 | |||
| 6fd84a2192 | |||
| 7447507362 | |||
| 659be95c17 | |||
| 196ba6dd75 | |||
| 05a1289180 | |||
| d810f2c011 | |||
| 066ea36dec | |||
| b9f1e6a752 | |||
| 299428fc1f | |||
| 8dbb03050b | |||
| 5c6be534a1 | |||
| a0d2ef0ff7 | |||
| 237e0b6f31 | |||
| ff8395d60e | |||
| fc7d57c026 | |||
| 199fd942fb | |||
| 5f682707f6 | |||
| 3897ac7697 | |||
| ba2fe7015e | |||
| ead614921a | |||
| 1c9f918ac8 | |||
| f9d6c40c00 | |||
| e9e69e7ccc | |||
| a1e4d4cf8c | |||
| b954f89580 | |||
| 764fd6f634 | |||
| dc4cd48245 | |||
| 82f2dd1c81 | |||
| 079548861a | |||
| 7f04e44c21 | |||
| b65ad93698 | |||
| bb3f4c83c8 | |||
| 6350495d3c | |||
| 08dfb31600 | |||
| 5c4cb6cb80 | |||
| 0993fc7ee3 | |||
| 5816564b66 | |||
| 7de110a0ed | |||
| 420d4b4685 | |||
| edadb4f0f8 | |||
| 8191f2d675 | |||
| f6a879f105 | |||
| addb4021d0 | |||
| 3fd3d1d424 | |||
| bef5b1ebf8 | |||
| b07c2dba60 | |||
| 7e032a392b |
79
installJRMC
79
installJRMC
@@ -18,7 +18,7 @@
|
||||
# * Be careful with tabs in heredocs
|
||||
shopt -s extglob
|
||||
|
||||
declare -g SCRIPT_VERSION="1.5.1"
|
||||
declare -g SCRIPT_VERSION="1.5.2"
|
||||
declare -g MC_REPO="bullseye" # should match the MC_VERSION
|
||||
# declare -g MC_REPO="bookworm" # should match the MC_VERSION
|
||||
declare -g MC_VERSION="33.0.72" # do find all replace
|
||||
@@ -118,8 +118,8 @@ print_help() {
|
||||
parse_input() {
|
||||
debug "Running: ${FUNCNAME[0]} $*"
|
||||
declare -gi BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
|
||||
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH \
|
||||
COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
||||
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH SNAP_INSTALL_SWITCH \
|
||||
APPIMAGE_INSTALL_SWITCH COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
||||
declare -g USER_MC_VERSION USER_MC_RELEASE USER_MC_REPO MJR_FILE \
|
||||
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
||||
local long_opts short_opts input
|
||||
@@ -141,13 +141,14 @@ parse_input() {
|
||||
local|rpm|deb) BUILD_SWITCH=1; LOCAL_INSTALL_SWITCH=1 ;;
|
||||
repo|remote) REPO_INSTALL_SWITCH=1 ;;
|
||||
container) CONTAINER_INSTALL_SWITCH=1 ;;
|
||||
snap) SNAP_INSTALL_SWITCH=1 ;;
|
||||
appimage) APPIMAGE_INSTALL_SWITCH=1 ;;
|
||||
*) err "Invalid --install option passed"; exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
--build|-b) BUILD_SWITCH=1; shift; BUILD_TARGET="$1" ;;
|
||||
--outputdir) shift; OUTPUT_DIR="$1" ;;
|
||||
--mcversion)
|
||||
shift
|
||||
--mcversion) shift;
|
||||
if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$ ]]; then
|
||||
USER_MC_VERSION="${1%-*}"
|
||||
USER_MC_RELEASE="${1#*-}"
|
||||
@@ -205,7 +206,8 @@ parse_input() {
|
||||
|
||||
# Fallback to default install method in some scenarios
|
||||
if ! ((UNINSTALL_SWITCH + BUILD_SWITCH + CREATEREPO_SWITCH +
|
||||
LOCAL_INSTALL_SWITCH + CONTAINER_INSTALL_SWITCH)) &&
|
||||
LOCAL_INSTALL_SWITCH + CONTAINER_INSTALL_SWITCH + SNAP_INSTALL_SWITCH +
|
||||
APPIMAGE_INSTALL_SWITCH)) &&
|
||||
[[ ${#SERVICES[@]} -eq 0 && ${#CONTAINERS[@]} -eq 0 ]]; then
|
||||
debug "Automatically using --install=repo"
|
||||
REPO_INSTALL_SWITCH=1
|
||||
@@ -213,7 +215,7 @@ parse_input() {
|
||||
|
||||
# Print some warnings for unsupported argument combinations
|
||||
if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then
|
||||
err "--install=local is not compatible with --mcrepo as only the default ($MC_REPO) DEB is available"
|
||||
err "--install=local is incompatible with --mcrepo as only the default ($MC_REPO) DEB is available"
|
||||
fi
|
||||
|
||||
if [[ -n $BETA_PASS ]] && ((REPO_INSTALL_SWITCH)); then
|
||||
@@ -430,7 +432,7 @@ get_latest_mc_version() {
|
||||
mc_version_source="containerized package manager"
|
||||
execute buildah rm "$cnt"
|
||||
# Fallback to webscrape
|
||||
elif MC_VERSION=$(download_stdout "$BOARD_URL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) \
|
||||
elif MC_VERSION=$(download "$BOARD_URL" "-" | 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"
|
||||
# Fallback to hardcoded value
|
||||
@@ -645,6 +647,7 @@ install_mc_repo() {
|
||||
for f in "${old_repo_files[@]}"; do
|
||||
[[ -f $f ]] && execute sudo rm -f "$f"
|
||||
done
|
||||
|
||||
read -r -d '' repo_text <<-EOF
|
||||
Types: deb
|
||||
URIs: http://dist.jriver.com/$channel/mediacenter/
|
||||
@@ -661,8 +664,8 @@ install_mc_repo() {
|
||||
fi
|
||||
repo_text="deb [signed-by=$keyfile arch=amd64,i386,armhf,arm64] http://dist.jriver.com/$channel/mediacenter/ $MC_REPO main"
|
||||
fi
|
||||
echo "Installing JRiver Media Center RPM key"
|
||||
download "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" |
|
||||
echo "Installing JRiver Media Center GPG key"
|
||||
download "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" "-" |
|
||||
gpg --dearmor | sudo tee "$keyfile" &>/dev/null
|
||||
;;
|
||||
*)
|
||||
@@ -697,7 +700,9 @@ acquire_deb() {
|
||||
declare -g MC_SOURCE
|
||||
local fname
|
||||
|
||||
# Usually JRiver exlcudes the release number from the filename
|
||||
[[ -d $OUTPUT_DIR/SOURCES ]] || execute mkdir -p "$OUTPUT_DIR/SOURCES"
|
||||
|
||||
# Usually JRiver excludes the release number from the filename
|
||||
# but in some cases (test builds) it may be included
|
||||
if [[ $MC_RELEASE -gt 1 ]]; then
|
||||
fname="MediaCenter-$MC_VERSION-$MC_RELEASE-$ARCH.deb"
|
||||
@@ -924,7 +929,7 @@ build_rpm() {
|
||||
fi
|
||||
}
|
||||
|
||||
# @description Installs Media Center DEB package and optional compatability fixes
|
||||
# @description Installs Media Center via DEB package w/ optional compatability fixes
|
||||
install_mc_deb() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
@@ -939,7 +944,7 @@ install_mc_deb() {
|
||||
# Remove libwebkit2gtk and their fantastic package versioning strategy
|
||||
sed -i 's/,\s*libwebkit2gtk[^,]*,\?|libwebkit2gtk[^,]*,\?//g' "control"
|
||||
|
||||
# TODO workaround for ZorinOS
|
||||
# TODO workaround for legacy ZorinOS
|
||||
[[ $ID == "ubuntu" && ${VERSION_ID%.*} -le 16 ]] \
|
||||
&& grep -q zorin /etc/os-release \
|
||||
&& sed -i 's/libva2/libva1/g' "control"
|
||||
@@ -969,7 +974,7 @@ install_mc_deb() {
|
||||
fi
|
||||
}
|
||||
|
||||
# @description Installs Media Center RPM package
|
||||
# @description Installs MC via RPM package
|
||||
install_mc_rpm() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
install_package --no-install-check --no-gpg-check --allow-downgrades "$MC_RPM"
|
||||
@@ -1003,7 +1008,7 @@ install_mc_generic() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# @description Installs Media Center Arch PKGBUILD
|
||||
# @description Installs MC via PKGBUILD
|
||||
install_mc_arch() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
@@ -1014,7 +1019,7 @@ install_mc_arch() {
|
||||
pkgver=$MC_VERSION
|
||||
pkgrel=1
|
||||
pkgdesc="The Most Comprehensive Media Software"
|
||||
arch=('x86_64')
|
||||
arch=('$(uname -m)')
|
||||
url="http://www.jriver.com/"
|
||||
license=('custom')
|
||||
depends=('alsa-lib' 'ca-certificates' 'gtk3' 'gcc-libs' 'libx11' 'libxext' 'libxcb' 'libxau' 'libxdmcp' 'util-linux' 'mesa-libgl' 'webkit2gtk')
|
||||
@@ -1271,11 +1276,11 @@ set_service_vars() {
|
||||
fi
|
||||
|
||||
# systemctl commands
|
||||
RELOAD=(execute "${systemctl_prefix[@]}" daemon-reload)
|
||||
ENABLE=(execute "${systemctl_prefix[@]}" enable --now)
|
||||
DISABLE=(execute "${systemctl_prefix[@]}" disable --now)
|
||||
IS_ENABLED=(execute "${systemctl_prefix[@]}" is-enabled -q)
|
||||
IS_ACTIVE=(execute "${systemctl_prefix[@]}" is-active -q)
|
||||
RELOAD=("${systemctl_prefix[@]}" daemon-reload)
|
||||
ENABLE=("${systemctl_prefix[@]}" enable --now)
|
||||
DISABLE=("${systemctl_prefix[@]}" disable --now)
|
||||
IS_ENABLED=("${systemctl_prefix[@]}" is-enabled --quiet)
|
||||
IS_ACTIVE=("${systemctl_prefix[@]}" is-active --quiet)
|
||||
|
||||
[[ -d $service_dir ]] || execute sudo mkdir -p "$service_dir"
|
||||
|
||||
@@ -1706,7 +1711,6 @@ main() {
|
||||
fi
|
||||
|
||||
if ((BUILD_SWITCH)) && [[ $ID != "arch" ]]; then
|
||||
[[ -d $OUTPUT_DIR/SOURCES ]] || execute mkdir -p "$OUTPUT_DIR/SOURCES"
|
||||
acquire_deb || { err "Could not download Media Center DEB package"; return 1; }
|
||||
|
||||
if [[ $BUILD_TARGET =~ centos|fedora|suse || $CREATEREPO_TARGET =~ centos|fedora|suse ]]; then
|
||||
@@ -1752,16 +1756,6 @@ main() {
|
||||
done
|
||||
unset service
|
||||
fi
|
||||
|
||||
# for _container in "${CONTAINERS[@]}"; do
|
||||
# if ! "_container_$_container"; then
|
||||
# if [[ $? -eq 127 ]]; then
|
||||
# err "Container $_container does not exist, check container name"
|
||||
# else
|
||||
# err "Failed to create container: $_container"
|
||||
# fi
|
||||
# fi
|
||||
# done
|
||||
}
|
||||
|
||||
# @section Helper functions
|
||||
@@ -1790,32 +1784,17 @@ download() {
|
||||
if [[ -n "$output" ]]; then
|
||||
cmd+=(--output "$output")
|
||||
else
|
||||
cmd+=(-O)
|
||||
cmd+=(--remote-name)
|
||||
fi
|
||||
elif command -v wget &>/dev/null || install_package --silent wget; then
|
||||
cmd=(wget --quiet)
|
||||
[[ -n "$output" ]] && cmd+=("--output-document=$output")
|
||||
[[ -n "$output" ]] && cmd+=(--output-document="$output")
|
||||
else
|
||||
err "Unable to install wget or curl"
|
||||
return 1
|
||||
fi
|
||||
|
||||
"${cmd[@]}" "$url"
|
||||
}
|
||||
download_stdout() {
|
||||
local url="$1"
|
||||
local -a cmd
|
||||
|
||||
if command -v curl &>/dev/null; then
|
||||
cmd=(curl --silent --fail --location -o - "$url")
|
||||
elif command -v wget &>/dev/null; then
|
||||
cmd=(wget --quiet -O - "$url")
|
||||
else
|
||||
err "Neither curl nor wget is available"
|
||||
return 1
|
||||
fi
|
||||
|
||||
"${cmd[@]}"
|
||||
execute "${cmd[@]}" "$url"
|
||||
}
|
||||
|
||||
# Roughly turn debugging on for pre-init
|
||||
|
||||
Reference in New Issue
Block a user