Browse Source

Allow --uninstall to be used seamlessly before other operations

bryan 4 ngày trước cách đây
mục cha
commit
c729f1fb9b
1 tập tin đã thay đổi với 8 bổ sung5 xóa
  1. 8 5
      installJRMC

+ 8 - 5
installJRMC

@@ -208,7 +208,7 @@ parse_input() {
     err "Incorrect option provided, see installJRMC --help"; exit 1
   fi
 
-  # Fallback to default install method in some scenarios
+  # Set some default conditions
   if ! ((UNINSTALL_SWITCH || BUILD_SWITCH || CREATEREPO_SWITCH || LOCAL_INSTALL_SWITCH
   || CONTAINER_INSTALL_SWITCH || SNAP_INSTALL_SWITCH || APPIMAGE_INSTALL_SWITCH)) &&
   [[ ${#SERVICES[@]} -eq 0 && ${#CONTAINERS[@]} -eq 0 ]]; then
@@ -220,10 +220,6 @@ parse_input() {
     echo "Warning: not all repositories have beta channels"
     echo "If the MC package is unavailable, try using --mcrepo to select another repository"
   fi
-
-  # if [[ -n $CONTAINER_INSTALL_SWITCH ]] && ((LOCAL_INSTALL_SWITCH || REPO_INSTALL_SWITCH)); then
-  #   err "Some --install methods are incompatible"
-  # fi
 }
 
 # @description Perform OS detection and generate OS-specific functions
@@ -1751,6 +1747,13 @@ main() {
 
   ((UNINSTALL_SWITCH)) && uninstall
 
+  # Exit now if only --uninstall is passed
+  if ! (( BUILD_SWITCH || CREATEREPO_SWITCH || REPO_INSTALL_SWITCH || LOCAL_INSTALL_SWITCH ||
+  CONTAINER_INSTALL_SWITCH || SNAP_INSTALL_SWITCH || APPIMAGE_INSTALL_SWITCH )) &&
+  [[ ${#SERVICES[@]} -eq 0 && ${#CONTAINERS[@]} -eq 0 ]]; then
+    exit 0
+  fi
+
   install_external_repos
 
   if ((REPO_INSTALL_SWITCH)); then