Move UID check after parse

This commit is contained in:
2025-04-28 21:07:11 -04:00
parent 9d0c484aa0
commit 190a6e7b10
2 changed files with 9 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
# installJRMC # installJRMC
This self-contained program will install [JRiver Media Center](https://www.jriver.com/) and associated services on most Linux distributions. This program will install [JRiver Media Center](https://www.jriver.com/) and associated services on most Linux distributions.
You can find the latest version of installJRMC, changelog, and documentation in [my repository](https://git.bryanroessler.com/bryan/installJRMC). You can find the latest version of installJRMC, changelog, and documentation in [my repository](https://git.bryanroessler.com/bryan/installJRMC).
@@ -8,7 +8,7 @@ You can find the latest version of installJRMC, changelog, and documentation in
`installJRMC [--option [ARGUMENT]]` `installJRMC [--option [ARGUMENT]]`
Running `installJRMC` without any options implies `--install repo` (on SUSE: `--install local`) and will install the latest version of 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. If `--service` or `--container` is passed then the default install method (`--install repo` or `--install local`) must be specified (to allow services and containers to be installed independent of MC). Running `installJRMC` without any options implies `--install repo` (on SUSE/Arch: `--install local`) and will install the latest version of 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. If `--service` or `--container` is passed then the default installation method (`--install repo` or `--install local`) must be specified (allows services and containers to be installed independent of MC).
Recent versions of installJRMC will automatically self-update to the latest installJRMC release. Recent versions of installJRMC will automatically self-update to the latest installJRMC release.

View File

@@ -19,7 +19,7 @@
# * Avoid execute() for stdout # * Avoid execute() for stdout
shopt -s extglob shopt -s extglob
declare -g SCRIPT_VERSION="1.6.5" declare -g SCRIPT_VERSION="1.6.6-dev"
declare -g MC_VERSION="34.0.20" # do find all replace declare -g MC_VERSION="34.0.20" # 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
@@ -241,20 +241,18 @@ init() {
declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
declare -ga SERVICES CONTAINERS declare -ga SERVICES CONTAINERS
parse_input "$@"
# Try to save users from themselves # Try to save users from themselves
if ((EUID == 0)); then if [[ $EUID -eq 0 ]]; then
err "Running as root but attempting to continue" err "Running as root but attempting to continue"
ask_ok "Continue as root user?" || exit 1 ask_ok "Continue as root user?" || exit 1
fi elif [[ -n $SUDO_USER ]]; then
if [[ -n $SUDO_USER ]]; then
err "Sudo detected, installJRMC should not be run with sudo but attempting to continue" err "Sudo detected, installJRMC should not be run with sudo but attempting to continue"
ask_ok "Continue as user $SUDO_USER (unsupported and may result in permission issues)?" || exit 1 ask_ok "Continue as user $SUDO_USER (unsupported and may result in permission issues)?" || exit 1
USER="${SUDO_USER:-$USER}" USER="${SUDO_USER:-$USER}"
fi fi
parse_input "$@"
# Run the self-updater if enabled # Run the self-updater if enabled
((UPDATE_SWITCH)) && update "$@" ((UPDATE_SWITCH)) && update "$@"
@@ -644,7 +642,7 @@ install_mc_repo() {
Signed-By: $keyfile Signed-By: $keyfile
Suites: $MC_REPO trixie bookworm bullseye oracular noble jammy focal Suites: $MC_REPO trixie bookworm bullseye oracular noble jammy focal
Components: main Components: main
Architectures: amd64 i386 armhf arm64 Architectures: amd64 armhf arm64
EOF EOF
else else
if [[ $channel == "beta" ]]; then if [[ $channel == "beta" ]]; then
@@ -653,7 +651,7 @@ install_mc_repo() {
else else
repo_file="/etc/apt/sources.list.d/jriver.list" repo_file="/etc/apt/sources.list.d/jriver.list"
fi fi
repo_text="deb [signed-by=$keyfile arch=amd64,i386,armhf,arm64] https://dist.jriver.com/$channel/mediacenter/ $MC_REPO main" repo_text="deb [signed-by=$keyfile arch=amd64,armhf,arm64] https://dist.jriver.com/$channel/mediacenter/ $MC_REPO main"
fi fi
echo "Installing JRiver Media Center GPG key" echo "Installing JRiver Media Center GPG key"
download "https://dist.jriver.com/mediacenter@jriver.com.gpg.key" "-" | download "https://dist.jriver.com/mediacenter@jriver.com.gpg.key" "-" |