Rollup for new minor version, may be buggy
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
.old/
|
.old/
|
||||||
.vscode/
|
.vscode/
|
||||||
README.bbcode
|
|
||||||
installJRMC.zip
|
installJRMC.zip
|
||||||
README.shdoc.md
|
README.shdoc.md
|
||||||
output/
|
output/
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -29,7 +29,7 @@ $ installJRMC --help
|
|||||||
--compat
|
--compat
|
||||||
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. "34.0.20" or "33" (default: latest)
|
Build or install a specific MC version, ex. "34.0.31" or "33" (default: latest)
|
||||||
--mcrepo REPO
|
--mcrepo REPO
|
||||||
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
||||||
--arch ARCH
|
--arch ARCH
|
||||||
@@ -114,9 +114,9 @@ Multiple services (but not `--service-types`) can be installed at one time using
|
|||||||
|
|
||||||
Install the latest version of MC from the best available repository.
|
Install the latest version of MC from the best available repository.
|
||||||
|
|
||||||
* `installJRMC --mcversion 32 --debug`
|
* `installJRMC --mcversion 33 --debug`
|
||||||
|
|
||||||
Install the latest version of MC32 from the best available repository with debugging output.
|
Install the latest version of MC33 from the best available repository with debugging output.
|
||||||
|
|
||||||
* `installJRMC --install local --compat`
|
* `installJRMC --install local --compat`
|
||||||
|
|
||||||
@@ -126,9 +126,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.
|
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.20`
|
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 34.0.31`
|
||||||
|
|
||||||
Build and install an MC 34.0.20 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
Build and install an MC 34.0.31 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
||||||
|
|
||||||
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
||||||
|
|
||||||
|
|||||||
73
installJRMC
73
installJRMC
@@ -19,8 +19,8 @@
|
|||||||
# * Avoid execute() for stdout
|
# * Avoid execute() for stdout
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
declare -g SCRIPT_VERSION="1.6.6-dev"
|
declare -g SCRIPT_VERSION="1.34.0-dev"
|
||||||
declare -g MC_VERSION="34.0.20" # do find all replace
|
declare -g MC_VERSION="34.0.31" # do find all replace
|
||||||
declare -g MC_REPO="bookworm" # should match the MC_VERSION
|
declare -g MC_REPO="bookworm" # should match the MC_VERSION
|
||||||
declare -g BOARD_ID="89.0" # MC34
|
declare -g BOARD_ID="89.0" # MC34
|
||||||
declare -gi UPDATE_SWITCH=1 # set to 0 to disable automatic self-update
|
declare -gi UPDATE_SWITCH=1 # set to 0 to disable automatic self-update
|
||||||
@@ -151,10 +151,10 @@ parse_input() {
|
|||||||
if [[ $1 =~ ^([0-9]+)(\.[0-9]+\.[0-9]+)?(-([0-9]+))?$ ]]; then
|
if [[ $1 =~ ^([0-9]+)(\.[0-9]+\.[0-9]+)?(-([0-9]+))?$ ]]; then
|
||||||
# Major version is required
|
# Major version is required
|
||||||
USER_MC_MVERSION="${BASH_REMATCH[1]}"
|
USER_MC_MVERSION="${BASH_REMATCH[1]}"
|
||||||
# If we get the full version, use it
|
|
||||||
[[ -n ${BASH_REMATCH[2]} ]] && USER_MC_VERSION="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
|
|
||||||
# Set default release to 1 if not provided
|
# Set default release to 1 if not provided
|
||||||
USER_MC_RELEASE="${BASH_REMATCH[4]:-1}"
|
USER_MC_RELEASE="${BASH_REMATCH[4]:-1}"
|
||||||
|
# If we get the full version, use it
|
||||||
|
[[ -n ${BASH_REMATCH[2]} ]] && USER_MC_VERSION="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
# Set major version defaults
|
# Set major version defaults
|
||||||
case "$USER_MC_MVERSION" in
|
case "$USER_MC_MVERSION" in
|
||||||
@@ -291,7 +291,7 @@ init() {
|
|||||||
raspbian) ID="debian" ;;
|
raspbian) ID="debian" ;;
|
||||||
manjaro|arch) ID="arch"
|
manjaro|arch) ID="arch"
|
||||||
if ((REPO_INSTALL_SWITCH)); then
|
if ((REPO_INSTALL_SWITCH)); then
|
||||||
debug "Automatically using --install=local for SUSE"
|
debug "Automatically using --install=local for Arch"
|
||||||
REPO_INSTALL_SWITCH=0
|
REPO_INSTALL_SWITCH=0
|
||||||
BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
LOCAL_INSTALL_SWITCH=1
|
LOCAL_INSTALL_SWITCH=1
|
||||||
@@ -480,27 +480,20 @@ install_package() {
|
|||||||
|
|
||||||
# Filter out already installed packages to create pkg_array
|
# Filter out already installed packages to create pkg_array
|
||||||
for pkg in "$@"; do
|
for pkg in "$@"; do
|
||||||
|
# Use alias if present, otherwise just pkg itself
|
||||||
|
pkg_names=("$pkg")
|
||||||
if [[ -v pkg_aliases[$pkg] ]]; then
|
if [[ -v pkg_aliases[$pkg] ]]; then
|
||||||
debug "Aliasing $pkg to ${pkg_aliases[$pkg]}"
|
debug "Aliasing $pkg to ${pkg_aliases[$pkg]}"
|
||||||
IFS=' ' read -ra pkgs <<< "${pkg_aliases[$pkg]}"
|
IFS=' ' read -ra pkg_names <<< "${pkg_aliases[$pkg]}"
|
||||||
for _pkg in "${pkgs[@]}"; do
|
|
||||||
if ((no_install_check)) ||
|
|
||||||
! { command -v "$_pkg" &>/dev/null ||
|
|
||||||
"${PKG_QUERY[@]}" "$_pkg" &>/dev/null; }; then
|
|
||||||
pkg_array+=("$_pkg")
|
|
||||||
else
|
|
||||||
debug "$_pkg is already installed, skipping installation"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
if ((no_install_check)) ||
|
|
||||||
! { command -v "$pkg" &>/dev/null ||
|
|
||||||
"${PKG_QUERY[@]}" "$pkg" &>/dev/null; }; then
|
|
||||||
pkg_array+=("$pkg")
|
|
||||||
else
|
|
||||||
debug "$pkg is already installed, skipping installation"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
for p in "${pkg_names[@]}"; do
|
||||||
|
if (( no_install_check )) ||
|
||||||
|
! { command -v "$p" &>/dev/null || "${PKG_QUERY[@]}" "$p" &>/dev/null; }; then
|
||||||
|
pkg_array+=("$p")
|
||||||
|
else
|
||||||
|
debug "$p is already installed, skipping installation"
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate installation flags based on the distribution
|
# Generate installation flags based on the distribution
|
||||||
@@ -520,7 +513,7 @@ install_package() {
|
|||||||
((no_gpg_check)) && install_flags+=(--allow-unsigned-rpm) ;;
|
((no_gpg_check)) && install_flags+=(--allow-unsigned-rpm) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Install packages if any need installation
|
# Install packages
|
||||||
if [[ ${#pkg_array[@]} -gt 0 ]]; then
|
if [[ ${#pkg_array[@]} -gt 0 ]]; then
|
||||||
if ! execute "${PKG_INSTALL[@]}" "${install_flags[@]}" "${pkg_array[@]}"; then
|
if ! execute "${PKG_INSTALL[@]}" "${install_flags[@]}" "${pkg_array[@]}"; then
|
||||||
((silent)) || err "Failed to install ${pkg_array[*]}"
|
((silent)) || err "Failed to install ${pkg_array[*]}"
|
||||||
@@ -569,7 +562,7 @@ install_external_repos() {
|
|||||||
# Install mesa-va-drivers-freeworld separately from the RPM using dnf swap
|
# Install mesa-va-drivers-freeworld separately from the RPM using dnf swap
|
||||||
install_mesa_freeworld
|
install_mesa_freeworld
|
||||||
;;
|
;;
|
||||||
suse) : # TODO may be needed if X11_XOrg is unavailable in default repos
|
suse) : # TODO may be needed if X11_XOrg is made unavailable in default repos
|
||||||
# if ! zypper repos | grep -q "X11_XOrg"; then
|
# if ! zypper repos | grep -q "X11_XOrg"; then
|
||||||
# echo "Installing the X11 repository"
|
# echo "Installing the X11 repository"
|
||||||
# execute sudo zypper --non-interactive --quiet addrepo \
|
# execute sudo zypper --non-interactive --quiet addrepo \
|
||||||
@@ -625,7 +618,7 @@ install_mc_repo() {
|
|||||||
repo_file="/etc/apt/sources.list.d/jriver.sources"
|
repo_file="/etc/apt/sources.list.d/jriver.sources"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove old repo
|
# Remove deprecated repo files
|
||||||
old_repo_files=(
|
old_repo_files=(
|
||||||
"/etc/apt/sources.list.d/jriver.list"
|
"/etc/apt/sources.list.d/jriver.list"
|
||||||
"/etc/apt/sources.list.d/jriver-beta.list"
|
"/etc/apt/sources.list.d/jriver-beta.list"
|
||||||
@@ -924,9 +917,14 @@ build_rpm() {
|
|||||||
echo "Build successful. The RPM file is located at: $MC_RPM"
|
echo "Build successful. The RPM file is located at: $MC_RPM"
|
||||||
else
|
else
|
||||||
err "Build failed"
|
err "Build failed"
|
||||||
# After failire, remove the source DEB and reaquire it on next run
|
# After failure, remove the source DEB and reaquire it on next run
|
||||||
[[ -f $MC_DEB ]] && echo "Removing source DEB" && execute sudo rm -f "$MC_DEB"
|
if [[ -f $MC_DEB ]]; then
|
||||||
exit 1
|
echo "Removing source DEB"
|
||||||
|
if ! execute rm -f "$MC_DEB"; then
|
||||||
|
execute sudo rm -f "$MC_DEB"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1110,7 +1108,6 @@ install_mc_arch() {
|
|||||||
# @description Copy the RPM to createrepo-webroot and run createrepo as the createrepo-user
|
# @description Copy the RPM to createrepo-webroot and run createrepo as the createrepo-user
|
||||||
run_createrepo() {
|
run_createrepo() {
|
||||||
debug "${FUNCNAME[0]}()"
|
debug "${FUNCNAME[0]}()"
|
||||||
local -a cr_cmd
|
|
||||||
|
|
||||||
install_package createrepo_c
|
install_package createrepo_c
|
||||||
|
|
||||||
@@ -1135,15 +1132,10 @@ run_createrepo() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run createrepo
|
# Run createrepo
|
||||||
cr_cmd=(sudo -u "$CREATEREPO_USER" createrepo -q "$CREATEREPO_WEBROOT")
|
local -a cr_opts=(-q "$CREATEREPO_WEBROOT")
|
||||||
[[ -d $CREATEREPO_WEBROOT/repodata ]] && cr_cmd+=(--update)
|
# [[ -d "$CREATEREPO_WEBROOT/repodata" ]] && cr_opts+=(--update) # TODO temporarily disabled for legacy createrepo
|
||||||
|
if ! execute sudo -u "$CREATEREPO_USER" createrepo "${cr_opts[@]}"; then
|
||||||
if ! execute "${cr_cmd[@]}"; then
|
if ! (execute sudo createrepo "${cr_opts[@]}" && execute sudo chown -R "$CREATEREPO_USER:$CREATEREPO_USER" "$CREATEREPO_WEBROOT"); then
|
||||||
cr_cmd=(sudo createrepo "$CREATEREPO_WEBROOT")
|
|
||||||
[[ -d $CREATEREPO_WEBROOT/repodata ]] && cr_cmd+=(--update)
|
|
||||||
|
|
||||||
if ! (execute "${cr_cmd[@]}" ||
|
|
||||||
execute sudo chown -R "$CREATEREPO_USER:$CREATEREPO_USER" "$CREATEREPO_WEBROOT"); then
|
|
||||||
err "createrepo failed"
|
err "createrepo failed"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -1727,9 +1719,10 @@ update() {
|
|||||||
|
|
||||||
# @description installJRMC main function
|
# @description installJRMC main function
|
||||||
main() {
|
main() {
|
||||||
debug "${FUNCNAME[0]}()" "$@"
|
debug "${FUNCNAME[0]}()" "$@" # prints function name and arguments
|
||||||
|
|
||||||
echo "Starting installJRMC $SCRIPT_VERSION"
|
echo "Starting installJRMC $SCRIPT_VERSION"
|
||||||
|
|
||||||
if ((DEBUG)); then
|
if ((DEBUG)); then
|
||||||
echo "Debugging on"
|
echo "Debugging on"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user