Compare commits
32 Commits
ff924bd735
...
e5e85eac48
| Author | SHA1 | Date | |
|---|---|---|---|
| e5e85eac48 | |||
| f5eb145667 | |||
| 64c3c168a4 | |||
| 54ba3423ff | |||
| 976abf9040 | |||
| 447e712de8 | |||
| 24d707831d | |||
| 7f0f2615ed | |||
| dcd930af40 | |||
| 39b7da2648 | |||
| e6a8e8d77c | |||
| 53fbb2ebdc | |||
| fc13233b46 | |||
| 70fdb51758 | |||
| 1634caf8aa | |||
| c7bd17778e | |||
| 2a37aacddb | |||
| 9e4109c70d | |||
| aabd17db9a | |||
| fe794e874f | |||
| bea86308c5 | |||
| 48f1cc132a | |||
| 37a1ac35ac | |||
| b3148f822f | |||
| 92b70e3a4a | |||
| 4bef3bdab0 | |||
| b577fc1155 | |||
| d43cc9f6c8 | |||
| e25bab1031 | |||
| 7d4e771a57 | |||
| e1e0a55101 | |||
| 5e70364ec9 |
230
installJRMC
230
installJRMC
@@ -16,8 +16,13 @@
|
|||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
declare -g SCRIPTVERSION="1.0-rc1"
|
declare -g SCRIPTVERSION="1.0-rc2"
|
||||||
declare -g OUTPUTDIR="$PWD/output"
|
declare -g OUTPUTDIR="$PWD/output"
|
||||||
|
|
||||||
|
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,76.0.html" # MC30 (Buster)
|
||||||
|
declare -g DEBIANBASE="buster"
|
||||||
|
declare -g MCVERSION_HARDCODE="30.0.44" # Hardcoded fallback
|
||||||
|
|
||||||
declare -g CREATEREPO_WEBROOT="/var/www/jriver"
|
declare -g CREATEREPO_WEBROOT="/var/www/jriver"
|
||||||
declare -g USER="${SUDO_USER:-$USER}"
|
declare -g USER="${SUDO_USER:-$USER}"
|
||||||
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
||||||
@@ -41,7 +46,7 @@ printHelp() {
|
|||||||
--compat
|
--compat
|
||||||
Build/install MC locally without minimum library specifiers
|
Build/install MC locally without minimum library specifiers
|
||||||
--mcversion VERSION
|
--mcversion VERSION
|
||||||
Specify the MC version, ex. "30.0.17" (Default: latest)
|
Specify the MC version, ex. "30.0.17" (Default: latest version)
|
||||||
--outputdir PATH
|
--outputdir PATH
|
||||||
Generate rpmbuild output in this directory (Default: ./output)
|
Generate rpmbuild output in this directory (Default: ./output)
|
||||||
--restorefile RESTOREFILE
|
--restorefile RESTOREFILE
|
||||||
@@ -158,7 +163,7 @@ parseInput() {
|
|||||||
shift && OUTPUTDIR="$1"
|
shift && OUTPUTDIR="$1"
|
||||||
;;
|
;;
|
||||||
--mcversion)
|
--mcversion)
|
||||||
shift && MCVERSION="$1"
|
shift && declare -g MCVERSION_INPUT="$1"
|
||||||
;;
|
;;
|
||||||
--restorefile)
|
--restorefile)
|
||||||
shift && RESTOREFILE="$1"
|
shift && RESTOREFILE="$1"
|
||||||
@@ -235,6 +240,9 @@ init() {
|
|||||||
|
|
||||||
declare -g ID RPM_MGR
|
declare -g ID RPM_MGR
|
||||||
|
|
||||||
|
echo "Starting installJRMC"
|
||||||
|
debug || echo "To enable debugging output, use --debug or -d"
|
||||||
|
|
||||||
if [[ -e "/etc/os-release" ]]; then
|
if [[ -e "/etc/os-release" ]]; then
|
||||||
source "/etc/os-release"
|
source "/etc/os-release"
|
||||||
else
|
else
|
||||||
@@ -294,6 +302,7 @@ init() {
|
|||||||
pkg_install_local() { installMCRPM; }
|
pkg_install_local() { installMCRPM; }
|
||||||
pkg_remove(){ sudo "$RPM_MGR" remove -y "$@"; }
|
pkg_remove(){ sudo "$RPM_MGR" remove -y "$@"; }
|
||||||
pkg_update(){ sudo "$RPM_MGR" makecache; }
|
pkg_update(){ sudo "$RPM_MGR" makecache; }
|
||||||
|
pkg_swap() { sudo dnf swap -y "$1" "$2"; }
|
||||||
pkg_query(){ rpm -q "$@"; }
|
pkg_query(){ rpm -q "$@"; }
|
||||||
firewall_cmd(){ sudo firewall-cmd "$@"; }
|
firewall_cmd(){ sudo firewall-cmd "$@"; }
|
||||||
;;
|
;;
|
||||||
@@ -327,51 +336,55 @@ init() {
|
|||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Uses several methods to determine the latest JRiver MC version
|
# Uses several methods to determine the latest JRiver MC version
|
||||||
# TODO but how to determine build distro `$BASE=buster`?
|
# TODO but how to determine build distro `$DEBIANBASE=buster`?
|
||||||
#######################################
|
#######################################
|
||||||
getVersion() {
|
setMCVersion() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
declare -g MCVERSION VERSION_SOURCE MVERSION MCPKG MCRPM BASE="buster" #BASE_NEXT="bullseye"
|
declare -g MCVERSION MCVERSION_SOURCE MVERSION MCPKG MCRPM
|
||||||
declare boardurl="https://yabb.jriver.com/interact/index.php/board,76.0.html" # MC30 (Buster)
|
declare cnt
|
||||||
|
|
||||||
# User input
|
# User input
|
||||||
if [[ -v MCVERSION && "$MCVERSION" =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
if [[ -v MCVERSION_INPUT ]]; then
|
||||||
VERSION_SOURCE="user input"
|
if ! [[ "$MCVERSION_INPUT" =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||||
|
err "Incorrect --mcversion format provided"
|
||||||
|
printHelp && exit 1
|
||||||
|
fi
|
||||||
|
MCVERSION="$MCVERSION_INPUT"
|
||||||
|
MCVERSION_SOURCE="user input"
|
||||||
# Containerized package manager
|
# Containerized package manager
|
||||||
elif installPackage --silent buildah &&
|
elif installPackage --silent buildah &&
|
||||||
cnt=$(buildah from --quiet debian:$BASE) &>/dev/null &&
|
cnt=$(buildah from --quiet debian:$DEBIANBASE-slim) &>/dev/null &&
|
||||||
buildah run "$cnt" -- bash -c \
|
buildah run "$cnt" -- bash -c \
|
||||||
"echo 'deb [trusted=no arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $BASE main' > /etc/apt/sources.list 2>&1" &>/dev/null &&
|
"echo 'deb [trusted=no arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $DEBIANBASE main' > /etc/apt/sources.list 2>&1" &>/dev/null &&
|
||||||
buildah run "$cnt" -- bash -c \
|
buildah run "$cnt" -- bash -c \
|
||||||
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null &&
|
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null &&
|
||||||
MCVERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null &&
|
MCVERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null &&
|
||||||
[[ "$MCVERSION" =~ ([0-9]+.[0-9]+.[0-9]+) ]] &&
|
[[ "$MCVERSION" =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||||
VERSION_SOURCE="containerized package manager"; then
|
MCVERSION_SOURCE="containerized package manager"
|
||||||
buildah rm "$cnt" &>/dev/null
|
buildah rm "$cnt" &>/dev/null
|
||||||
# Webscrape
|
# Webscrape
|
||||||
elif installPackage wget && MCVERSION=$(wget -qO- "$boardurl" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) &&
|
elif installPackage wget && MCVERSION=$(wget -qO- "$BOARDURL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) &&
|
||||||
[[ "$MCVERSION" =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
[[ "$MCVERSION" =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
||||||
VERSION_SOURCE="webscrape"
|
MCVERSION_SOURCE="webscrape"
|
||||||
# Hardcoded
|
# Hardcoded
|
||||||
else
|
else
|
||||||
MCVERSION="30.0.17"
|
MCVERSION="$MCVERSION_HARDCODE"
|
||||||
VERSION_SOURCE="hardcoded version"
|
MCVERSION_SOURCE="hardcoded version"
|
||||||
err "Warning! Using hardcoded version number"
|
err "Warning! Using hardcoded version number."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MVERSION="${MCVERSION%%.*}"
|
MVERSION="${MCVERSION%%.*}"
|
||||||
MCPKG="mediacenter$MVERSION"
|
MCPKG="mediacenter$MVERSION"
|
||||||
MCRPM="$OUTPUTDIR/RPMS/x86_64/mediacenter$MVERSION-$MCVERSION.x86_64.rpm"
|
MCRPM="$OUTPUTDIR/RPMS/x86_64/mediacenter$MVERSION-$MCVERSION.x86_64.rpm"
|
||||||
|
|
||||||
if [[ "$VERSION_SOURCE" == "user input" ]]; then
|
if [[ "$MCVERSION_SOURCE" == "user input" ]]; then
|
||||||
# Append explicit package version when user provides --mcversion
|
# Append explicit package version when user provides --mcversion
|
||||||
[[ "$ID" =~ ^(fedora|centos|suse)$ ]] && MCPKG+="-$MCVERSION"
|
[[ "$ID" =~ ^(fedora|centos|suse)$ ]] && MCPKG+="-$MCVERSION"
|
||||||
[[ "$ID" =~ ^(debian|ubuntu)$ ]] && MCPKG+="=$MCVERSION"
|
[[ "$ID" =~ ^(debian|ubuntu)$ ]] && MCPKG+="=$MCVERSION"
|
||||||
else
|
|
||||||
echo "To override, use --mcversion"
|
|
||||||
fi
|
fi
|
||||||
echo "Using MC version $MCVERSION determined by $VERSION_SOURCE"
|
echo "Using MC version $MCVERSION determined by $MCVERSION_SOURCE."
|
||||||
|
[[ "$MCVERSION_SOURCE" == "user input" ]] || echo "To override, use --mcversion."
|
||||||
debug "MVERSION: $MVERSION, MCVERSION: $MCVERSION, MCPKG: $MCPKG, MCRPM: $MCRPM"
|
debug "MVERSION: $MVERSION, MCVERSION: $MCVERSION, MCPKG: $MCPKG, MCRPM: $MCRPM"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,38 +395,32 @@ getVersion() {
|
|||||||
# One or more package names
|
# One or more package names
|
||||||
# Options:
|
# Options:
|
||||||
# --skip-check-installed: Do not check if package is already installed
|
# --skip-check-installed: Do not check if package is already installed
|
||||||
# --nogpgcheck: Disable GPG checks for RPM based distros
|
# --no-gpg-check: Disable GPG checks for RPM based distros
|
||||||
# --allow-downgrades: Useful for installing compatability versions on DEB based distros
|
# --allow-downgrades: Useful for installing specific MC versions
|
||||||
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
|
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
|
||||||
#######################################
|
#######################################
|
||||||
installPackage() {
|
installPackage() {
|
||||||
debug "Running: ${FUNCNAME[0]}" "$@"
|
debug "Running: ${FUNCNAME[0]}" "$@"
|
||||||
|
|
||||||
declare -a pkg_array install_flags
|
declare -a pkg_array install_flags
|
||||||
declare pkg skip_check_installed silent _return pkg_install_cmd
|
declare input pkg skip_check_installed silent pkg_install_cmd refresh allow_downgrades no_gpg_check
|
||||||
|
declare -A pkg_aliases
|
||||||
|
|
||||||
if _input=$(getopt -o +s -l skip-check-installed,allow-erasing,allow-downgrades,nogpgcheck,silent -- "$@"); then
|
if input=$(getopt -o +s -l skip-check-installed,allow-downgrades,no-gpg-check,refresh,silent -- "$@"); then
|
||||||
eval set -- "$_input"
|
eval set -- "$input"
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--skip-check-installed)
|
--skip-check-installed)
|
||||||
skip_check_installed=1
|
skip_check_installed=1
|
||||||
;;
|
;;
|
||||||
--allow-downgrades)
|
--allow-downgrades)
|
||||||
[[ "$ID" =~ ^(debian|ubuntu)$ ]] &&
|
allow_downgrades=1
|
||||||
install_flags+=(--allow-downgrades)
|
|
||||||
;;
|
;;
|
||||||
--allow-erasing)
|
--no-gpg-check)
|
||||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
no_gpg_check=1
|
||||||
install_flags+=(--allowerasing)
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
--nogpgcheck)
|
--refresh)
|
||||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
refresh=1
|
||||||
install_flags+=(--nogpgcheck)
|
|
||||||
elif [[ "$ID" == "suse" ]]; then
|
|
||||||
install_flags+=(--allow-unsigned-rpm)
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
--silent|-s)
|
--silent|-s)
|
||||||
silent=1
|
silent=1
|
||||||
@@ -430,25 +437,42 @@ installPackage() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Aliases
|
# Package aliases
|
||||||
if [[ "$ID" =~ ^(debian|ubuntu)$ ]]; then
|
case "$ID" in
|
||||||
declare -A PKG_ALIASES
|
debian|ubuntu)
|
||||||
PKG_ALIASES["xorg-x11-utils"]="xorg-x11"
|
pkg_aliases["rpm-build"]="rpm"
|
||||||
PKG_ALIASES["rpm-build"]="rpm"
|
pkg_aliases["createrepo_c"]="createrepo"
|
||||||
PKG_ALIASES["createrepo_c"]="createrepo"
|
pkg_aliases["tigervnc-server"]="tigervnc-standalone-server"
|
||||||
PKG_ALIASES["tigervnc-server"]="tigervnc-standalone-server"
|
;;
|
||||||
fi
|
esac
|
||||||
|
|
||||||
|
# Filter installed packages
|
||||||
for pkg in "$@"; do
|
for pkg in "$@"; do
|
||||||
if [[ ! -v skip_check_installed && -v PKG_ALIASES[$pkg] ]]; then
|
if [[ -v pkg_aliases[$pkg] ]]; then
|
||||||
pkg=${PKG_ALIASES[$pkg]}
|
pkg=${pkg_aliases[$pkg]}
|
||||||
fi
|
fi
|
||||||
# Check if already installed
|
if (( skip_check_installed )) || ! (hash "$pkg" &>/dev/null || pkg_query "$pkg" &>/dev/null); then
|
||||||
if (( skip_check_installed )) || ! (hash $pkg &>/dev/null || pkg_query "$pkg" &>/dev/null); then
|
|
||||||
pkg_array+=("$pkg")
|
pkg_array+=("$pkg")
|
||||||
|
else
|
||||||
|
debug "$pkg already installed, skipping installation"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Generate distro-specific install flags
|
||||||
|
case "$ID" in
|
||||||
|
debian|ubuntu)
|
||||||
|
(( allow_downgrades )) && install_flags+=(--allow-downgrades)
|
||||||
|
;;
|
||||||
|
fedora|centos)
|
||||||
|
(( allow_downgrades )) && install_flags+=(--allowerasing)
|
||||||
|
(( no_gpg_check )) && install_flags+=(--nogpgcheck)
|
||||||
|
(( refresh )) && install_flags+=(--refresh)
|
||||||
|
;;
|
||||||
|
suse)
|
||||||
|
(( no_gpg_check )) && install_flags+=(--allow-unsigned-rpm)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Install packages from package array
|
# Install packages from package array
|
||||||
if [[ ${#pkg_array[@]} -ge 1 ]]; then
|
if [[ ${#pkg_array[@]} -ge 1 ]]; then
|
||||||
pkg_install_cmd="pkg_install ${install_flags[*]} ${pkg_array[*]}"
|
pkg_install_cmd="pkg_install ${install_flags[*]} ${pkg_array[*]}"
|
||||||
@@ -486,9 +510,9 @@ installMCFromRepo() {
|
|||||||
sudo rm -rf "$repo_dir"/mediacenter*.list
|
sudo rm -rf "$repo_dir"/mediacenter*.list
|
||||||
installPackage wget
|
installPackage wget
|
||||||
sudo bash -c "cat <<-EOF > $repo_dir/jriver.list
|
sudo bash -c "cat <<-EOF > $repo_dir/jriver.list
|
||||||
deb [trusted=yes arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $BASE main
|
deb [trusted=yes arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $DEBIANBASE main
|
||||||
EOF"
|
EOF"
|
||||||
wget -qO- "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" | sudo tee /etc/apt/trusted.gpg.d/jriver.asc
|
wget -qO- "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" | sudo tee /etc/apt/trusted.gpg.d/jriver.asc &>/dev/null
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
err "An MC repository for $ID is not yet available."
|
err "An MC repository for $ID is not yet available."
|
||||||
@@ -504,8 +528,11 @@ installMCFromRepo() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare pkg_install_cmd="installPackage --skip-check-installed --allow-erasing --nogpgcheck $MCPKG"
|
# Install mesa-va-drivers-freeworld separately from the RPM for dnf swap
|
||||||
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null"
|
installMesa
|
||||||
|
|
||||||
|
declare pkg_install_cmd="installPackage --skip-check-installed --allow-downgrades --no-gpg-check $MCPKG"
|
||||||
|
debug "$pkg_install_cmd"
|
||||||
if ! eval "$pkg_install_cmd"; then
|
if ! eval "$pkg_install_cmd"; then
|
||||||
err "Package install failed!"
|
err "Package install failed!"
|
||||||
return 1
|
return 1
|
||||||
@@ -622,6 +649,7 @@ buildRPM() {
|
|||||||
requires=("${requires[@]/libvulkan1/vulkan-loader}")
|
requires=("${requires[@]/libvulkan1/vulkan-loader}")
|
||||||
requires=("${requires[@]/libepoxy0/libepoxy}")
|
requires=("${requires[@]/libepoxy0/libepoxy}")
|
||||||
requires=("${requires[@]/python/python3}")
|
requires=("${requires[@]/python/python3}")
|
||||||
|
recommends+=(mesa-va-drivers-freeworld)
|
||||||
;;
|
;;
|
||||||
suse)
|
suse)
|
||||||
requires=("${requires[@]/libc6/glibc}")
|
requires=("${requires[@]/libc6/glibc}")
|
||||||
@@ -710,7 +738,6 @@ buildRPM() {
|
|||||||
|
|
||||||
# Run rpmbuild
|
# Run rpmbuild
|
||||||
echo "Building MC $MCVERSION RPM, this may take awhile"
|
echo "Building MC $MCVERSION RPM, this may take awhile"
|
||||||
(( DEBUG )) || echo "Use --debug for verbose output"
|
|
||||||
rpmbuild_cmd="rpmbuild --define=\"%_topdir $OUTPUTDIR\" --define=\"%_libdir /usr/lib\" -bb"
|
rpmbuild_cmd="rpmbuild --define=\"%_topdir $OUTPUTDIR\" --define=\"%_libdir /usr/lib\" -bb"
|
||||||
rpmbuild_cmd+=" $OUTPUTDIR/SPECS/mediacenter.spec"
|
rpmbuild_cmd+=" $OUTPUTDIR/SPECS/mediacenter.spec"
|
||||||
debug "$rpmbuild_cmd" || rpmbuild_cmd+=" &>/dev/null"
|
debug "$rpmbuild_cmd" || rpmbuild_cmd+=" &>/dev/null"
|
||||||
@@ -732,7 +759,7 @@ buildRPM() {
|
|||||||
installMCDEB() {
|
installMCDEB() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
declare pkg_install_cmd="installPackage --skip-check-installed --nogpgcheck"
|
declare pkg_install_cmd="installPackage --skip-check-installed --no-gpg-check --allow-downgrades"
|
||||||
if (( COMPAT_SWITCH )); then
|
if (( COMPAT_SWITCH )); then
|
||||||
declare extract_dir && extract_dir="$(mktemp -d)"
|
declare extract_dir && extract_dir="$(mktemp -d)"
|
||||||
pushd "$extract_dir" &>/dev/null || return
|
pushd "$extract_dir" &>/dev/null || return
|
||||||
@@ -748,7 +775,6 @@ installMCDEB() {
|
|||||||
ar rcs "$MCDEB" "debian-binary" "control.tar.xz" "data.tar.xz"
|
ar rcs "$MCDEB" "debian-binary" "control.tar.xz" "data.tar.xz"
|
||||||
popd &>/dev/null || return
|
popd &>/dev/null || return
|
||||||
rm -rf "$extract_dir"
|
rm -rf "$extract_dir"
|
||||||
pkg_install_cmd+=" --allow-downgrades"
|
|
||||||
fi
|
fi
|
||||||
pkg_install_cmd+=" $MCDEB"
|
pkg_install_cmd+=" $MCDEB"
|
||||||
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null"
|
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null"
|
||||||
@@ -761,10 +787,41 @@ installMCDEB() {
|
|||||||
#######################################
|
#######################################
|
||||||
installMCRPM() {
|
installMCRPM() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
installPackage --skip-check-installed --nogpgcheck --allow-erasing "$MCRPM"
|
|
||||||
|
# Install mesa-va-freeworld separately from the RPM for dnf swap
|
||||||
|
installMesa
|
||||||
|
|
||||||
|
installPackage --skip-check-installed --no-gpg-check --allow-downgrades "$MCRPM"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Installs mesa-va-drivers-freeworld
|
||||||
|
#######################################
|
||||||
|
installMesa() {
|
||||||
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
|
# Currently only necessary in Fedora/CentOS
|
||||||
|
case "$ID" in
|
||||||
|
fedora|centos)
|
||||||
|
if ! pkg_query mesa-va-drivers-freeworld &>/dev/null; then
|
||||||
|
if pkg_query mesa-va-drivers &>/dev/null; then
|
||||||
|
declare pkg_swap_cmd="pkg_swap mesa-va-drivers mesa-va-drivers-freeworld"
|
||||||
|
debug "$pkg_swap_cmd" || pkg_swap_cmd+=" &>/dev/null"
|
||||||
|
if ! eval "$pkg_swap_cmd"; then
|
||||||
|
err "Package swap failed!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pkg_install mesa-va-drivers-freeworld
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Installs local Media Center PKGBUILD
|
# Installs local Media Center PKGBUILD
|
||||||
#######################################
|
#######################################
|
||||||
@@ -845,9 +902,9 @@ symlinkCerts() {
|
|||||||
|
|
||||||
# Have to use command array instead of eval because of whitespace in $mc_cert_link
|
# Have to use command array instead of eval because of whitespace in $mc_cert_link
|
||||||
if [[ -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then
|
if [[ -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then
|
||||||
ln_cmd="sudo ln -fs /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem $mc_cert_link" # For RHEL
|
ln_cmd="sudo ln -fs /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \"$mc_cert_link\"" # For RHEL
|
||||||
elif [[ -f /var/lib/ca-certificates/ca-bundle.pem ]]; then
|
elif [[ -f /var/lib/ca-certificates/ca-bundle.pem ]]; then
|
||||||
ln_cmd="sudo ln -fs /var/lib/ca-certificates/ca-bundle.pem $mc_cert_link" # For SUSE
|
ln_cmd="sudo ln -fs /var/lib/ca-certificates/ca-bundle.pem \"$mc_cert_link\"" # For SUSE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "$ln_cmd" || ln_cmd+=" &>/dev/null"
|
debug "$ln_cmd" || ln_cmd+=" &>/dev/null"
|
||||||
@@ -1014,7 +1071,7 @@ setDisplay() {
|
|||||||
setServiceVars() {
|
setServiceVars() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
declare -g SERVICE_NAME SERVICE_FNAME TIMER_NAME TIMER_FNAME USER_STRING GRAPHICAL_TARGET
|
declare -g SERVICE_NAME SERVICE_FNAME TIMER_NAME TIMER_FNAME USER_STRING DISPLAY_STRING GRAPHICAL_TARGET
|
||||||
declare -g SERVICE_TYPE="${SERVICE_TYPE:-system}"
|
declare -g SERVICE_TYPE="${SERVICE_TYPE:-system}"
|
||||||
declare service_dir="/usr/lib/systemd/$SERVICE_TYPE"
|
declare service_dir="/usr/lib/systemd/$SERVICE_TYPE"
|
||||||
|
|
||||||
@@ -1036,12 +1093,23 @@ setServiceVars() {
|
|||||||
systemctl_enable_cmd(){ systemctl --user enable --now "$@"; }
|
systemctl_enable_cmd(){ systemctl --user enable --now "$@"; }
|
||||||
systemctl_disable_cmd(){ systemctl --user disable --now "$@"; }
|
systemctl_disable_cmd(){ systemctl --user disable --now "$@"; }
|
||||||
systemctl_is_enabled_cmd(){ systemctl --user is-enabled -q "$@"; }
|
systemctl_is_enabled_cmd(){ systemctl --user is-enabled -q "$@"; }
|
||||||
systemctl_is_active(){ sudo systemctl is-active -q "$@"; }
|
systemctl_is_active_cmd(){ systemctl --user is-active -q "$@"; }
|
||||||
GRAPHICAL_TARGET="default.target"
|
GRAPHICAL_TARGET="default.target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ! -d "$service_dir" ]] && sudo mkdir -p "$service_dir"
|
[[ ! -d "$service_dir" ]] && sudo mkdir -p "$service_dir"
|
||||||
|
|
||||||
|
# TODO Ubuntu needs these in the service file, fedora (and others?) does not
|
||||||
|
case "$ID" in
|
||||||
|
ubuntu|debian)
|
||||||
|
DISPLAY_STRING="Environment=DISPLAY=$DISPLAY"
|
||||||
|
DISPLAY_STRING+=$'\n'"Environment=XAUTHORITY=$XAUTHORITY"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
DISPLAY_STRING=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$SERVICE_TYPE" == "system" && "$USER" != "root" ]]; then
|
if [[ "$SERVICE_TYPE" == "system" && "$USER" != "root" ]]; then
|
||||||
SERVICE_FNAME="$service_dir/${1}@.service"
|
SERVICE_FNAME="$service_dir/${1}@.service"
|
||||||
TIMER_FNAME="$service_dir/${1}@.timer"
|
TIMER_FNAME="$service_dir/${1}@.timer"
|
||||||
@@ -1075,6 +1143,7 @@ service_jriver-mediacenter() {
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
$USER_STRING
|
$USER_STRING
|
||||||
|
$DISPLAY_STRING
|
||||||
Type=simple
|
Type=simple
|
||||||
Environment=DISPLAY=$DISPLAY
|
Environment=DISPLAY=$DISPLAY
|
||||||
Environment=XAUTHORITY=$XAUTHORITY
|
Environment=XAUTHORITY=$XAUTHORITY
|
||||||
@@ -1168,15 +1237,6 @@ service_jriver-x11vnc() {
|
|||||||
|
|
||||||
setVNCPass x11vnc
|
setVNCPass x11vnc
|
||||||
|
|
||||||
# Get current desktop resolution
|
|
||||||
# TODO: may need to break this out into its own function and get smarter at identifying multi-monitors
|
|
||||||
# _getResolution() {
|
|
||||||
# debug "Running: ${FUNCNAME[0]}"
|
|
||||||
# installPackage xorg-x11-utils
|
|
||||||
# _res=$(xdpyinfo | grep dimensions | awk '{print $2}')
|
|
||||||
# }
|
|
||||||
# _getResolution
|
|
||||||
|
|
||||||
# If .Xauthority file is missing, generate a dummy for x11vnc -auth guess
|
# If .Xauthority file is missing, generate a dummy for x11vnc -auth guess
|
||||||
if [[ ! -f "$HOME/.Xauthority" ]]; then
|
if [[ ! -f "$HOME/.Xauthority" ]]; then
|
||||||
[[ "$XDG_SESSION_TYPE" == "wayland" ]] && ask_ok "Unsupported Wayland session detected for x11vnc, continue?" || return 1
|
[[ "$XDG_SESSION_TYPE" == "wayland" ]] && ask_ok "Unsupported Wayland session detected for x11vnc, continue?" || return 1
|
||||||
@@ -1275,7 +1335,7 @@ service_jriver-createrepo() {
|
|||||||
# installPackage buildah podman
|
# installPackage buildah podman
|
||||||
|
|
||||||
# # Eventually try to switch to Debian
|
# # Eventually try to switch to Debian
|
||||||
# # if ! CNT=$(buildah from debian:$BASE); then
|
# # if ! CNT=$(buildah from debian:$DEBIANBASE); then
|
||||||
# # echo "Bad base image for container $CNAME, skipping"
|
# # echo "Bad base image for container $CNAME, skipping"
|
||||||
# # continue
|
# # continue
|
||||||
# # fi
|
# # fi
|
||||||
@@ -1451,7 +1511,7 @@ migrateLibrary() {
|
|||||||
[[ -d "$previous_config_path" ]] &&
|
[[ -d "$previous_config_path" ]] &&
|
||||||
mkdir -p "$current_config_path"; then
|
mkdir -p "$current_config_path"; then
|
||||||
echo "Migrating $previous_config_path to $current_config_path"
|
echo "Migrating $previous_config_path to $current_config_path"
|
||||||
cp -a "$previous_config_path"/* "$current_config_path" &>/dev/null
|
cp -fa "$previous_config_path"/* "$current_config_path" &>/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1534,7 +1594,7 @@ uninstall() {
|
|||||||
|
|
||||||
tests() {
|
tests() {
|
||||||
# To test on Mint/16.04: sudo apt install -y spice-vdagent ca-certificates git; export GIT_SSL_NO_VERIFY=1
|
# To test on Mint/16.04: sudo apt install -y spice-vdagent ca-certificates git; export GIT_SSL_NO_VERIFY=1
|
||||||
exit $?
|
: # TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1555,7 +1615,7 @@ main() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
getVersion
|
setMCVersion
|
||||||
|
|
||||||
if (( UNINSTALL_SWITCH )); then
|
if (( UNINSTALL_SWITCH )); then
|
||||||
if askOk "Do you really want to uninstall JRiver Media Center?"; then
|
if askOk "Do you really want to uninstall JRiver Media Center?"; then
|
||||||
@@ -1566,12 +1626,16 @@ main() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install external repos, if required
|
# Install external repos
|
||||||
case "$ID" in
|
case "$ID" in
|
||||||
ubuntu)
|
ubuntu)
|
||||||
if ! grep ^deb /etc/apt/sources.list|grep -q universe; then
|
if ! grep ^deb /etc/apt/sources.list|grep -q universe; then
|
||||||
echo "Adding universe repository"
|
echo "Adding universe repository"
|
||||||
sudo add-apt-repository universe
|
declare add_universe_cmd="sudo add-apt-repository -y universe"
|
||||||
|
debug "$add_universe_cmd" || add_universe_cmd+=" &>/dev/null"
|
||||||
|
if ! exec "$add_universe_cmd"; then
|
||||||
|
err "Adding universe repository failed"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
centos)
|
centos)
|
||||||
@@ -1579,6 +1643,16 @@ main() {
|
|||||||
echo "Adding EPEL repository"
|
echo "Adding EPEL repository"
|
||||||
installPackage epel-release
|
installPackage epel-release
|
||||||
fi
|
fi
|
||||||
|
if ! pkg_query rpmfusion-free-release &>/dev/null; then
|
||||||
|
installPackage --skip-check-installed \
|
||||||
|
"https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$VERSION_ID.noarch.rpm"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
fedora)
|
||||||
|
if ! pkg_query rpmfusion-free-release &>/dev/null; then
|
||||||
|
installPackage --skip-check-installed \
|
||||||
|
"https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$VERSION_ID.noarch.rpm"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user