Parcourir la source

Move UID check after parse

bryan il y a 1 semaine
Parent
commit
190a6e7b10
2 fichiers modifiés avec 9 ajouts et 11 suppressions
  1. 2 2
      README.md
  2. 7 9
      installJRMC

+ 2 - 2
README.md

@@ -1,6 +1,6 @@
 # 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).
 
@@ -8,7 +8,7 @@ You can find the latest version of installJRMC, changelog, and documentation in
 
 `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.
 

+ 7 - 9
installJRMC

@@ -19,7 +19,7 @@
 # * Avoid execute() for stdout
 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_REPO="bookworm" # should match the MC_VERSION
 declare -g BOARD_ID="89.0" # MC34
@@ -241,20 +241,18 @@ init() {
   declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
   declare -ga SERVICES CONTAINERS
 
+  parse_input "$@"
+
   # Try to save users from themselves
-  if ((EUID == 0)); then
+  if [[ $EUID -eq 0 ]]; then
     err "Running as root but attempting to continue"
     ask_ok "Continue as root user?" || exit 1
-  fi
-
-  if [[ -n $SUDO_USER ]]; then
+  elif [[ -n $SUDO_USER ]]; then
     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
     USER="${SUDO_USER:-$USER}"
   fi
 
-  parse_input "$@"
-
   # Run the self-updater if enabled
   ((UPDATE_SWITCH)) && update "$@"
 
@@ -644,7 +642,7 @@ install_mc_repo() {
 					Signed-By: $keyfile
 					Suites: $MC_REPO trixie bookworm bullseye oracular noble jammy focal
 					Components: main
-					Architectures: amd64 i386 armhf arm64
+					Architectures: amd64 armhf arm64
 				EOF
       else
         if [[ $channel == "beta" ]]; then
@@ -653,7 +651,7 @@ install_mc_repo() {
         else
           repo_file="/etc/apt/sources.list.d/jriver.list"
         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
       echo "Installing JRiver Media Center GPG key"
       download "https://dist.jriver.com/mediacenter@jriver.com.gpg.key" "-" |