From 641dc04f8694ecb329c5fed467d40ad864fac674 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=AC=A2=E4=B9=90=E9=A9=AC?=
 <38058090+SkywalkerSpace@users.noreply.github.com>
Date: Fri, 24 Mar 2023 16:12:59 +0800
Subject: [PATCH] rm check java in scripts (#5414)

---
 scripts/pro.py                 | 13 +------------
 scripts/seafile.sh             |  8 --------
 scripts/setup-seafile-mysql.sh | 15 ---------------
 scripts/setup-seafile.sh       | 15 ---------------
 4 files changed, 1 insertion(+), 50 deletions(-)

diff --git a/scripts/pro.py b/scripts/pro.py
index a54a87e811..e6c6325873 100755
--- a/scripts/pro.py
+++ b/scripts/pro.py
@@ -550,7 +550,7 @@ class MigratingProfessionalConfigurator(ProfessionalConfigurator):
         ProfessionalConfigurator.__init__(self, args, migrate=True)
 
     def check_pre_condition(self):
-        self.check_java()
+        pass
 
     def config(self):
         self.detect_db_type()
@@ -599,17 +599,6 @@ class MigratingProfessionalConfigurator(ProfessionalConfigurator):
         if Utils.run_argv(argv) != 0:
             Utils.error('failed to update avatars folder')
 
-    def check_java(self):
-        Utils.info('\nChecking java ... ', newline=False)
-        if not Utils.find_in_path('java'):
-            msg = '''\nJava is not found. instal it first.\n
-    On Debian/Ubuntu:     apt-get install default-jre
-    On CentOS/RHEL:       yum install jre
-    '''
-            Utils.error(msg)
-
-        Utils.info('Done')
-
 
 class SetupProfessionalConfigurator(ProfessionalConfigurator):
     '''This script is invokded by setup-seafile.sh/setup-seafile-mysql.sh to
diff --git a/scripts/seafile.sh b/scripts/seafile.sh
index bdcf834746..962e63dd1b 100755
--- a/scripts/seafile.sh
+++ b/scripts/seafile.sh
@@ -107,13 +107,6 @@ function validate_already_running () {
     check_component_running "seafevents" "seafevents.main --config-file ${central_config_dir}"
 }
 
-function test_java {
-    if ! which java 2>/dev/null 1>&2; then
-        echo "java is not found on your machine. Please install it first."
-        exit 1;
-    fi
-}
-
 function start_seafile_server () {
     validate_already_running;
     validate_central_conf_dir;
@@ -122,7 +115,6 @@ function start_seafile_server () {
 
     if [[ -d ${INSTALLPATH}/pro ]]; then
         test_config;
-        test_java;
     fi
 
     echo "Starting seafile server, please wait ..."
diff --git a/scripts/setup-seafile-mysql.sh b/scripts/setup-seafile-mysql.sh
index 664351831a..b086d92587 100755
--- a/scripts/setup-seafile-mysql.sh
+++ b/scripts/setup-seafile-mysql.sh
@@ -49,23 +49,8 @@ function check_python () {
     echo
 }
 
-function check_java () {
-    echo -n "Checking for java ..."
-    if ! which java 2>/dev/null 1>&2; then
-        echo -e "\nJava is not found. install it first.\n"
-        echo "On Debian/Ubuntu:     apt-get install default-jre"
-        echo "On CentOS/RHEL:       yum install jre"
-        err_and_quit;
-    fi
-    printf "Done.\n\n"
-}
-
 check_python;
 
-if [[ -d ${INSTALLPATH}/pro ]]; then
-    check_java;
-fi
-
 export PYTHON=$PYTHON
 
 export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3/site-packages:${INSTALLPATH}/seafile/lib64/python3/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
diff --git a/scripts/setup-seafile.sh b/scripts/setup-seafile.sh
index c28f68bdcb..2dc0f8f71d 100755
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -152,26 +152,11 @@ function check_sqlite3 () {
     printf "Done.\n\n"
 }
 
-function check_java () {
-    echo -n "Checking for java ..."
-    if ! which java 2>/dev/null 1>&2; then
-        echo -e "\nJava is not found. install it first.\n"
-        echo "On Debian/Ubuntu:     apt-get install default-jre"
-        echo "On CentOS/RHEL:       yum install jre"
-        err_and_quit;
-    fi
-    printf "Done.\n\n"
-}
-
 function check_system_dependency () {
     printf "Checking packages needed by seafile ...\n\n"
     check_python;
     check_sqlite3;
 
-    if [[ -d ${INSTALLPATH}/pro ]]; then
-        check_java;
-    fi
-
     printf "Checking Done.\n\n"
 }