Compare commits
18 Commits
eb8664d7e5
...
df9c1ccbea
| Author | SHA1 | Date | |
|---|---|---|---|
| df9c1ccbea | |||
| d62f844371 | |||
| f2d08bc3e6 | |||
| ce2b1e70c6 | |||
| 1e1e7e3792 | |||
| c44bfe8aa3 | |||
| 10d9e9e213 | |||
| f80f9ccd08 | |||
| 175c6deb5a | |||
| 9d8e338872 | |||
| 558c7a059c | |||
| f92a89c99c | |||
| 68c03ab186 | |||
| 9587308d84 | |||
| 3848e880ed | |||
| dc16e06ea8 | |||
| c5921c33cc | |||
| 0795491d61 |
@@ -25,13 +25,13 @@ $ installJRMC --help
|
||||
--install, -i repo|local
|
||||
repo: Install MC from repository, future updates will be handled by the system package manager
|
||||
local: Build and install MC package from official source package
|
||||
--build[=suse|fedora|centos]
|
||||
--build[=suse|fedora|centos|mandriva]
|
||||
Build RPM from source DEB but do not install
|
||||
Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=')
|
||||
--compat
|
||||
Build/install MC without minimum dependency version requirements
|
||||
--mcversion VERSION
|
||||
Specify the MC version, ex. "33", "34.0.36", or "34.0.36-1" (default: latest)
|
||||
Specify the MC version, ex. "33", "34.0.42", or "34.0.42-1" (default: latest)
|
||||
--arch ARCH
|
||||
Specify the target MC architecture, ex. "amd64", "arm64", etc (default: host architecture)
|
||||
--mcrepo REPO
|
||||
@@ -48,7 +48,7 @@ $ installJRMC --help
|
||||
Starts services at boot (system) or user login (user) (default: per-service, see SERVICES)
|
||||
--container, -c CONTAINER (TODO: Under construction)
|
||||
See CONTAINERS section below for a list of containers to deploy
|
||||
--createrepo[=suse|fedora|centos]
|
||||
--createrepo[=suse|fedora|centos|mandriva]
|
||||
Build rpm, copy to webroot, and run createrepo.
|
||||
Optionally, specify a target distro for non-native repo (ex. --createrepo=fedora, note the '=')
|
||||
--createrepo-webroot PATH
|
||||
@@ -128,8 +128,8 @@ Install the latest version of MC33 from the best available repository with debug
|
||||
Install a more widely-compatible version of the latest MC version.
|
||||
[code]installJRMC --install repo --service jriver-mediacenter --service-type user[/code]
|
||||
Install MC from the repository and start/enable jriver-mediacenter.service as a user service.
|
||||
[code]installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 34.0.36[/code]
|
||||
Build and install an MC 34.0.36 comptability RPM locally and activate it using the /path/to/license.mjr
|
||||
[code]installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 34.0.42[/code]
|
||||
Build and install an MC 34.0.42 comptability RPM locally and activate it using the /path/to/license.mjr
|
||||
[code]installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user[/code]
|
||||
Build an RPM locally for the current distro, move it to the webroot, and run createrepo as www-user.
|
||||
[code]installJRMC --service jriver-createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user[/code]
|
||||
|
||||
10
README.md
10
README.md
@@ -22,13 +22,13 @@ $ installJRMC --help
|
||||
--install, -i repo|local
|
||||
repo: Install MC from repository, future updates will be handled by the system package manager
|
||||
local: Build and install MC package locally from official source package
|
||||
--build[=suse|fedora|centos]
|
||||
--build[=suse|fedora|centos|mandriva]
|
||||
Build RPM from source DEB but do not install
|
||||
Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=')
|
||||
--compat
|
||||
Build/install MC without minimum dependency version requirements
|
||||
--mcversion VERSION
|
||||
Build or install a specific MC version, ex. "34.0.36" or "33" (default: latest)
|
||||
Build or install a specific MC version, ex. "34.0.42" or "33" (default: latest)
|
||||
--mcrepo REPO
|
||||
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
||||
--arch ARCH
|
||||
@@ -45,7 +45,7 @@ $ installJRMC --help
|
||||
Starts services at boot (system) or user login (user) (default: per-service, see SERVICES)
|
||||
--container, -c CONTAINER (TODO: Under construction)
|
||||
See CONTAINERS section below for a list of containers to deploy
|
||||
--createrepo[=suse|fedora|centos]
|
||||
--createrepo[=suse|fedora|centos|mandriva]
|
||||
Build rpm, copy to webroot, and run createrepo.
|
||||
Optionally, specify a target distro for non-native repo (ex. --createrepo=fedora, note the '=')
|
||||
--createrepo-webroot PATH
|
||||
@@ -133,9 +133,9 @@ Multiple services (but not `--service-types`) can be installed at one time using
|
||||
|
||||
Install MC from the repository and start/enable `jriver-mediacenter.service` as a user service.
|
||||
|
||||
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 34.0.36`
|
||||
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 34.0.42`
|
||||
|
||||
Build and install an MC 34.0.36 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
||||
Build and install an MC 34.0.42 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
||||
|
||||
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
||||
|
||||
|
||||
212
installJRMC
212
installJRMC
@@ -21,8 +21,8 @@
|
||||
# shellcheck disable=SC2317
|
||||
shopt -s extglob
|
||||
|
||||
declare -g SCRIPT_VERSION="1.34.3"
|
||||
declare -g MC_VERSION="34.0.36" # do find all replace (hardcoded fallback)
|
||||
declare -g SCRIPT_VERSION="1.34.4"
|
||||
declare -g MC_VERSION="34.0.42" # do find all replace (hardcoded fallback)
|
||||
declare -g MC_REPO="bookworm" # should match the MC_VERSION
|
||||
declare -g BOARD_ID="89.0" # MC34 board ID for automatic version detection
|
||||
declare -gi SELF_UPDATE_SWITCH=1 # 0 to disable installJRMC self-update
|
||||
@@ -48,7 +48,7 @@ print_help() {
|
||||
--install, -i repo|local
|
||||
repo: Install MC from repository, updates are handled by the system package manager
|
||||
local: Build and install MC locally from official source package
|
||||
--build[=suse|fedora|centos]
|
||||
--build[=suse|fedora|centos|mandriva]
|
||||
Build RPM from source DEB but do not install
|
||||
Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=')
|
||||
--compat
|
||||
@@ -71,7 +71,7 @@ print_help() {
|
||||
Starts services at boot (system) or at user login (user) (default: per service, see SERVICES)
|
||||
--container, -c CONTAINER (TODO: Under construction)
|
||||
See CONTAINERS section below for a list of possible services to install
|
||||
--createrepo[=suse|fedora|centos]
|
||||
--createrepo[=suse|fedora|centos|mandriva]
|
||||
Build rpm, copy to webroot, and run createrepo.
|
||||
Use in conjunction with --build=TARGET for crossbuilding repos
|
||||
Optionally, specify a target distro for non-native repo (ex. --createrepo=fedora, note the '=')
|
||||
@@ -252,6 +252,8 @@ init() {
|
||||
# Run the self-updater if enabled
|
||||
((SELF_UPDATE_SWITCH)) && update "$@"
|
||||
|
||||
fix_permissions "$HOME/.jriver" "$USER"
|
||||
|
||||
# Get host information
|
||||
[[ -f /etc/os-release ]] && source /etc/os-release
|
||||
|
||||
@@ -285,6 +287,13 @@ init() {
|
||||
rhel|almalinux) ID="centos" ;;
|
||||
linuxmint|neon|zorin|*ubuntu*) ID="ubuntu" ;;
|
||||
raspbian) ID="debian" ;;
|
||||
*mandriva*) ID="mandriva"
|
||||
if ((REPO_INSTALL_SWITCH)); then
|
||||
debug "Automatically using --install=local for Mandriva"
|
||||
REPO_INSTALL_SWITCH=0
|
||||
BUILD_SWITCH=1
|
||||
LOCAL_INSTALL_SWITCH=1
|
||||
fi ;;
|
||||
manjaro|arch) ID="arch"
|
||||
if ((REPO_INSTALL_SWITCH)); then
|
||||
debug "Automatically using --install=local for Arch"
|
||||
@@ -328,7 +337,7 @@ init() {
|
||||
|
||||
# Set distro-specific package manager commands for normalized IDs
|
||||
case $ID in
|
||||
fedora|centos)
|
||||
fedora|centos|mandriva)
|
||||
local rpm_mgr
|
||||
rpm_mgr=$(command -v dnf &>/dev/null && echo "dnf" || echo "yum")
|
||||
PKG_INSTALL=(sudo "$rpm_mgr" install -y)
|
||||
@@ -397,7 +406,7 @@ init() {
|
||||
if [[ -n $USER_MC_VERSION ]]; then
|
||||
# Append explicit package version when user provides --mcversion
|
||||
case $ID in
|
||||
fedora|centos|suse) MC_PKG+="-$MC_VERSION" ;;
|
||||
fedora|centos|suse|mandriva) MC_PKG+="-$MC_VERSION" ;;
|
||||
debian|ubuntu) MC_PKG+="=$MC_VERSION" ;;
|
||||
esac
|
||||
fi
|
||||
@@ -424,7 +433,7 @@ get_latest_mc_version() {
|
||||
# Fallback to hardcoded value
|
||||
else
|
||||
mc_version_source="hardcoded"
|
||||
err "Warning! Using hardcoded version number"
|
||||
echo "Warning! Using hardcoded version number"
|
||||
fi
|
||||
|
||||
echo "Selected MC version $MC_VERSION from the $MC_REPO repo (via $mc_version_source)"
|
||||
@@ -461,18 +470,19 @@ install_package() {
|
||||
shift
|
||||
done
|
||||
|
||||
# Define package aliases based on the distribution
|
||||
# Define distribution-specific package aliases
|
||||
case $ID in
|
||||
debian|ubuntu)
|
||||
pkg_aliases=(
|
||||
[rpm-build]="rpm"
|
||||
[createrepo_c]="createrepo"
|
||||
[tigervnc-server]="tigervnc-standalone-server"
|
||||
) ;;
|
||||
suse)
|
||||
pkg_aliases=(
|
||||
[buildah]="buildah fuse-overlayfs"
|
||||
) ;;
|
||||
debian|ubuntu) pkg_aliases=(
|
||||
[rpm-build]="rpm"
|
||||
[createrepo_c]="createrepo"
|
||||
[tigervnc-server]="tigervnc-standalone-server"
|
||||
) ;;
|
||||
suse) pkg_aliases=(
|
||||
[buildah]="buildah fuse-overlayfs"
|
||||
) ;;
|
||||
mandriva) pkg_aliases=(
|
||||
[dpkg]="dpkg gnutar"
|
||||
) ;;
|
||||
esac
|
||||
|
||||
# Filter out already installed packages to create pkg_array
|
||||
@@ -498,7 +508,7 @@ install_package() {
|
||||
debian|ubuntu)
|
||||
((allow_downgrades)) && install_flags+=(--allow-downgrades)
|
||||
((reinstall)) && install_flags+=(--reinstall) ;;
|
||||
fedora|centos)
|
||||
fedora|centos|mandriva)
|
||||
((allow_downgrades)) && install_flags+=(--allowerasing)
|
||||
((no_gpg_check)) && install_flags+=(--nogpgcheck)
|
||||
((refresh)) && install_flags+=(--refresh)
|
||||
@@ -566,6 +576,11 @@ install_external_repos() {
|
||||
# execute sudo zypper --non-interactive --quiet refresh
|
||||
# fi
|
||||
;;
|
||||
mandriva)
|
||||
local branch
|
||||
branch=$(grep ^PRETTY_NAME= /etc/os-release | tr -d '"' | rev | cut -d' ' -f1 | rev | tr '[:upper:]' '[:lower:]')
|
||||
execute sudo dnf config-manager --set-enabled "${branch}-${ARCH}-extra"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -652,14 +667,13 @@ install_mc_repo() {
|
||||
;;
|
||||
*)
|
||||
err "An MC repository for $ID is not yet available"
|
||||
err "Use --install local to install MC on $ID"
|
||||
err "Use --install=local to install MC on $ID"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -f $repo_file ]]; then
|
||||
ask_ok "Replace existing $repo_file repository file" && execute sudo rm -f "$repo_file"
|
||||
fi
|
||||
# Remove existing repository file if it exists
|
||||
[[ -f $repo_file ]] && execute sudo rm -f "$repo_file"
|
||||
|
||||
echo "Adding MC repository file: $repo_file"
|
||||
debug "$repo_text"
|
||||
@@ -672,7 +686,7 @@ install_mc_repo() {
|
||||
err "Failed to add temporary repository"
|
||||
return 1
|
||||
fi
|
||||
"${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
|
||||
execute "${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
|
||||
|
||||
echo "Installing $MC_PKG package"
|
||||
if ! install_package \
|
||||
@@ -728,7 +742,7 @@ acquire_deb() {
|
||||
[[ -f $MC_DEB ]] &&
|
||||
execute sudo buildah umount "$CNT" &&
|
||||
execute sudo buildah rm "$CNT"; }; then
|
||||
err "Failed to download DEB using containerized package manager"
|
||||
debug "Failed to download DEB using containerized package manager"
|
||||
echo "Using legacy download method"
|
||||
# Define the repository search order
|
||||
local -a repos
|
||||
@@ -739,12 +753,13 @@ acquire_deb() {
|
||||
|
||||
# Loop through the repositories and attempt to download
|
||||
for repo in "${repos[@]}"; do
|
||||
echo "Checking $repo for DEB package"
|
||||
echo -n "$repo --> "
|
||||
if download "$repo" "$MC_DEB"; then
|
||||
echo "Found"
|
||||
echo "Found!"
|
||||
MC_SOURCE="$repo"
|
||||
break
|
||||
fi
|
||||
echo "Not found"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -763,7 +778,10 @@ build_rpm() {
|
||||
# skip rebuilding the rpm if it already exists
|
||||
debug "Checking for existing MC RPM: $MC_RPM"
|
||||
if [[ -f $MC_RPM && -f $spec_file ]]; then
|
||||
echo "Spec file and $MC_RPM already exists. Skipping build step"
|
||||
echo "Skipping build step: .spec and ouput RPM already exist"
|
||||
debug "RPM .spec file: $spec_file"
|
||||
debug "RPM: $MC_RPM"
|
||||
echo "Remove either to force rebuild"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -820,16 +838,15 @@ build_rpm() {
|
||||
requires=("${requires[@]/libva-drm2/libva}")
|
||||
requires=("${requires[@]/libepoxy0/libepoxy}")
|
||||
requires=("${requires[@]/liblcms2-2/lcms2}")
|
||||
requires=("${requires[@]/python/python3}")
|
||||
requires=("${requires[@]/libwebkit2gtk-4.0*/webkit2gtk4.0}")
|
||||
requires=("${requires[@]/libwebkit2gtk-4.1*/webkit2gtk4.1}")
|
||||
requires=("${requires[@]/libsdbus-c++1/sdbus-cpp}")
|
||||
recommends=("${recommends[@]/fdkaac/fdk-aac-free}")
|
||||
recommends+=("mesa-va-drivers-freeworld|mesa-va-drivers")
|
||||
recommends+=("mesa-vulkan-drivers-freeworld|mesa-vulkan-drivers")
|
||||
recommends+=("mesa-vdpau-driver-freeworld|mesa-vdpau-driver")
|
||||
;;
|
||||
suse)
|
||||
requires=("${requires[@]/python*/python313}")
|
||||
requires=("${requires[@]/libc6/glibc}")
|
||||
requires=("${requires[@]/libasound2/alsa-lib}")
|
||||
requires=("${requires[@]/libx11-6/libX11-6}")
|
||||
@@ -857,6 +874,43 @@ build_rpm() {
|
||||
recommends+=(libvulkan_radeon)
|
||||
recommends+=(libvulkan_nouveau)
|
||||
;;
|
||||
mandriva)
|
||||
requires=("${requires[@]/libc6/glibc}")
|
||||
requires=("${requires[@]/libasound2/lib64asound2}")
|
||||
requires=("${requires[@]/libuuid1/lib64uuid1}")
|
||||
requires=("${requires[@]/libx11-6/lib64x11_6}")
|
||||
requires=("${requires[@]/libxext6/lib64xext6}")
|
||||
requires=("${requires[@]/libxcb1/lib64xcb1}")
|
||||
requires=("${requires[@]/libxdmcp6/lib64xdmcp6}")
|
||||
requires=("${requires[@]/libstdc++6/lib64stdc++6}")
|
||||
requires=("${requires[@]/libgtk-3-0/lib64gtk3_0}")
|
||||
requires=("${requires[@]/libgl1/lib64GL1}")
|
||||
requires=("${requires[@]/libgles2/lib64GLESv2_2}")
|
||||
requires=("${requires[@]/libegl-mesa0/lib64EGL_mesa0}")
|
||||
requires=("${requires[@]/libpango1.0-0/lib64pango1.0_0}")
|
||||
requires=("${requires[@]/libpango-1.0-0/lib64pango1.0_0}")
|
||||
requires=("${requires[@]/libpangoft2-1.0-0/lib64pangoft2_1.0_0}")
|
||||
requires=("${requires[@]/libpango-cairo-1.0-0/lib64pangocairo1.0_0}")
|
||||
requires=("${requires[@]/libpangoxft-1.0-0/lib64pangoxft1.0_0}")
|
||||
requires=("${requires[@]/libnss3/lib64nss3}")
|
||||
requires=("${requires[@]/libnspr4/lib64nspr4}")
|
||||
requires=("${requires[@]/libgomp1/lib64gomp1}")
|
||||
requires=("${requires[@]/libfribidi0/lib64fribidi0}")
|
||||
requires=("${requires[@]/libfontconfig1/lib64fontconfig}")
|
||||
requires=("${requires[@]/libfreetype6/lib64freetype6}")
|
||||
requires=("${requires[@]/libharfbuzz0b/lib64harfbuzz}")
|
||||
requires=("${requires[@]/libgbm1/lib64gbm1}")
|
||||
requires=("${requires[@]/libva2/lib64va2}")
|
||||
requires=("${requires[@]/libva-drm2/lib64va-drm2}")
|
||||
requires=("${requires[@]/libvulkan1/lib64vulkan1}")
|
||||
requires=("${requires[@]/mesa-vulkan-drivers/lib64dri-drivers}")
|
||||
requires=("${requires[@]/vulkan-icd/vulkan-loader}")
|
||||
requires=("${requires[@]/libwebkit2gtk-4.1-0/lib64webkit2gtk4.1}")
|
||||
recommends=("${recommends[@]/musepack-tools/mppenc}")
|
||||
for i in "${!recommends[@]}"; do
|
||||
[[ ${recommends[$i]} == "fdkaac" ]] && unset -v 'recommends[i]'
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Convert array to newline delim'd string (for heredoc)
|
||||
@@ -935,19 +989,7 @@ build_rpm() {
|
||||
-bb
|
||||
"$spec_file"
|
||||
)
|
||||
if execute "${rpmbuild_cmd[@]}" && [[ -f $MC_RPM ]] ; then
|
||||
echo "Build successful. The RPM file is located at: $MC_RPM"
|
||||
else
|
||||
err "Build failed"
|
||||
# After failure, remove the source DEB and reaquire it on next run
|
||||
if [[ -f $MC_DEB ]]; then
|
||||
echo "Removing source DEB"
|
||||
if ! execute rm -f "$MC_DEB"; then
|
||||
execute sudo rm -f "$MC_DEB"
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
execute "${rpmbuild_cmd[@]}" && [[ -f $MC_RPM ]]
|
||||
}
|
||||
|
||||
# @description Installs Media Center via DEB package w/ optional compatability fixes
|
||||
@@ -985,7 +1027,7 @@ install_mc_deb() {
|
||||
err "Failed to add temporary repository"
|
||||
return 1
|
||||
fi
|
||||
"${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
|
||||
execute "${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
|
||||
|
||||
# Copy the DEB to a temporary file so _apt can read it
|
||||
debug "Creating temporary deb file owned by _apt"
|
||||
@@ -1236,7 +1278,6 @@ open_firewall() {
|
||||
execute sudo ufw app update "$service"
|
||||
execute sudo ufw allow "$service"
|
||||
else
|
||||
echo "Warning: Install firewall-cmd or ufw to open firewall ports"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1546,16 +1587,16 @@ service_jriver-createrepo() {
|
||||
}
|
||||
|
||||
# @description Detects if MC is installed on btrfs and disables CoW
|
||||
disable_btrfs_cow() {
|
||||
fix_dotjriver_permissions() {
|
||||
debug "${FUNCNAME[0]}()"
|
||||
local mc_user_path="$HOME/.jriver"
|
||||
[[ -d "$mc_user_path" ]] || execute mkdir -p "$mc_user_path"
|
||||
[[ -d "$mc_user_path" ]] && execute sudo chown -R "$USER:$USER" "$mc_user_path"
|
||||
|
||||
# Disable btrfs CoW
|
||||
if [[ $(stat -f -c %T "$mc_user_path") == "btrfs" ]]; then
|
||||
if execute chattr -R +C "$mc_user_path"; then
|
||||
echo "Disabled btrfs CoW for $mc_user_path"
|
||||
# Ensure the user owns their .jriver directory
|
||||
if [[ -d "$HOME/.jriver" ]]; then
|
||||
local owner
|
||||
owner=$(stat -c '%U' "$HOME/.jriver")
|
||||
if [[ "$owner" != "$USER" ]]; then
|
||||
ask_ok "$USER does not currently own $HOME/.jriver, attempt fix?" &&
|
||||
execute sudo chown -R "$USER:$USER" "$HOME/.jriver"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -1649,11 +1690,11 @@ uninstall() {
|
||||
if [[ -d $HOME/.jriver ]]; then
|
||||
if ask_ok "Backup and reset your MC library?"; then
|
||||
execute mv "$HOME/.jriver" "$HOME/.jriver.bk"
|
||||
echo "Your MC library has been backed up to $HOME/.jriver.bk and reset"
|
||||
echo "To restore your MC library backup: mv $HOME/.jriver.bk $HOME/.jriver"
|
||||
echo "Your MC library has been reset and backed up to $HOME/.jriver.bk"
|
||||
echo "To restore your MC library: mv $HOME/.jriver.bk $HOME/.jriver"
|
||||
return
|
||||
fi
|
||||
echo "To backup and reset your MC library: mv $HOME/.jriver $HOME/.jriver.bk"
|
||||
echo "To reset and backup your MC library: mv $HOME/.jriver $HOME/.jriver.bk"
|
||||
echo "To remove your MC library: rm -rf $HOME/.jriver"
|
||||
fi
|
||||
}
|
||||
@@ -1684,28 +1725,28 @@ update() {
|
||||
[[ "$(git -C "$SCRIPT_DIR" config --get remote.origin.url)" =~ installJRMC|installjrmc ]]; then
|
||||
|
||||
# Get the current commit hash
|
||||
local before_pull_hash after_pull_hash
|
||||
local before_pull_hash
|
||||
before_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
||||
|
||||
# Stash local changes before pull
|
||||
execute git -C "$SCRIPT_DIR" stash push --quiet
|
||||
|
||||
# Pull latest changes
|
||||
debug "Running git pull in $SCRIPT_DIR"
|
||||
if ! git -C "$SCRIPT_DIR" pull | grep -q "Already up to date"; then
|
||||
# Get the new commit hash after pull
|
||||
after_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
||||
execute git -C "$SCRIPT_DIR" pull --quiet
|
||||
|
||||
# If the commit hash has changed, an update occurred
|
||||
if [[ "$before_pull_hash" != "$after_pull_hash" ]]; then
|
||||
echo "Detected installJRMC update, restarting"
|
||||
execute git -C "$SCRIPT_DIR" stash pop --quiet
|
||||
exec "$SCRIPT_PATH" "$@" "--no-update"
|
||||
fi
|
||||
fi
|
||||
# Restore local changes
|
||||
execute git -C "$SCRIPT_DIR" stash pop --quiet
|
||||
|
||||
debug "Current commit hash: $before_pull_hash"
|
||||
debug "New commit hash: $(git -C "$SCRIPT_DIR" rev-parse HEAD)"
|
||||
|
||||
# If the commit hash has changed, an update occurred
|
||||
if [[ "$before_pull_hash" != $(git -C "$SCRIPT_DIR" rev-parse HEAD) ]]; then
|
||||
echo "Detected installJRMC update, restarting"
|
||||
exec "$SCRIPT_PATH" "$@" "--no-update"
|
||||
fi
|
||||
else
|
||||
debug "Not in a git repository or not the installJRMC repository. Checking for updates via download."
|
||||
debug "Not in the installJRMC repository, checking for installJRMC update via webscrape."
|
||||
|
||||
local tmp
|
||||
tmp=$(mktemp) || { err "Failed to create temporary file."; return 1; }
|
||||
@@ -1776,7 +1817,6 @@ main() {
|
||||
link_ssl_certs
|
||||
restore_license
|
||||
open_firewall "jriver-mediacenter" "52100-52200/tcp" "1900/udp"
|
||||
disable_btrfs_cow
|
||||
else
|
||||
err "JRiver Media Center installation from remote repository failed"
|
||||
return 1
|
||||
@@ -1786,10 +1826,22 @@ main() {
|
||||
if ((BUILD_SWITCH)); then
|
||||
acquire_deb || { err "Could not download Media Center DEB package"; return 1; }
|
||||
|
||||
if [[ $BUILD_TARGET =~ centos|fedora|suse || $CREATEREPO_TARGET =~ centos|fedora|suse ]]; then
|
||||
if [[ $BUILD_TARGET =~ centos|fedora|suse|mandriva || $CREATEREPO_TARGET =~ centos|fedora|suse|mandriva ]]; then
|
||||
install_package dpkg rpm-build
|
||||
[[ -d $OUTPUT_DIR/SPECS ]] || execute mkdir -p "$OUTPUT_DIR/SPECS"
|
||||
build_rpm
|
||||
if build_rpm; then
|
||||
echo "RPM package built successfully"
|
||||
else
|
||||
err "Failed to build RPM package"
|
||||
# On build failure, remove the source DEB in case it is corrupted
|
||||
if [[ -f $MC_DEB ]]; then
|
||||
echo "Removing source DEB"
|
||||
if ! execute rm -f "$MC_DEB"; then
|
||||
execute sudo rm -f "$MC_DEB"
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1805,7 +1857,6 @@ main() {
|
||||
link_ssl_certs
|
||||
restore_license
|
||||
open_firewall "jriver-mediacenter" "52100-52200/tcp" "1900/udp"
|
||||
disable_btrfs_cow
|
||||
fi
|
||||
|
||||
if ((CREATEREPO_SWITCH)); then
|
||||
@@ -1850,12 +1901,24 @@ execute() {
|
||||
"$@" &>/dev/null
|
||||
fi
|
||||
}
|
||||
fix_permissions() {
|
||||
local dir="$1"
|
||||
local user="$2"
|
||||
local owner
|
||||
[[ -d "$dir" ]] || return 1
|
||||
owner=$(stat -c '%U' "$dir")
|
||||
if [[ "$owner" != "$user" ]]; then
|
||||
echo "Directory $dir is owned by $owner, not $user"
|
||||
if ask_ok "Change ownership of $dir to $user?"; then
|
||||
execute sudo chown -R "$user:$user" "$dir"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
download() {
|
||||
debug "${FUNCNAME[0]}()" "$@"
|
||||
local url="$1"
|
||||
local output="${2:-}"
|
||||
local -a cmd
|
||||
|
||||
if command -v curl &>/dev/null || install_package --silent curl; then
|
||||
cmd=(curl --silent --fail --location)
|
||||
if [[ -n "$output" ]]; then
|
||||
@@ -1870,7 +1933,6 @@ download() {
|
||||
err "Unable to install wget or curl"
|
||||
return 1
|
||||
fi
|
||||
|
||||
debug "${cmd[@]}" "$url"
|
||||
"${cmd[@]}" "$url"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user