diff --git a/jans-linux-setup/jans_setup/install.py b/jans-linux-setup/jans_setup/install.py index 505604a6a4b..25dd6c422e2 100755 --- a/jans-linux-setup/jans_setup/install.py +++ b/jans-linux-setup/jans_setup/install.py @@ -315,6 +315,52 @@ def prepare_jans_cli_package(): print("Preparing jans-cli package") extract_subdir(jans_zip_file, 'jans-cli', 'jans-cli', os.path.join(jans_app_dir, 'jans-cli.zip')) + +def uninstall_jans(): + check_installation() + print('\033[31m') + print("This process is irreversible.") + print("You will lose all data related to Janssen Server.") + print('\033[0m') + print() + while True: + print('\033[31m \033[1m') + response = input("Are you sure to uninstall Janssen Server? [yes/N] ") + print('\033[0m') + if response.lower() in ('yes', 'n', 'no'): + if not response.lower() == 'yes': + sys.exit() + else: + break + else: + print("Please type \033[1m yes \033[0m to uninstall") + + print("Uninstalling Jannsen Server...") + for service in jetty_services: + if os.path.exists(os.path.join(jetty_home, service)): + default_fn = os.path.join('/etc/default/', service) + if os.path.exists(default_fn): + print("Removing", default_fn) + os.remove(default_fn) + print("Stopping", service) + os.system('systemctl stop ' + service) + + if argsp.profile == 'jans': + print("Stopping OpenDj Server") + os.system('/opt/opendj/bin/stop-ds') + + remove_list = ['/etc/certs', '/etc/jans', '/opt/jans', '/opt/amazon-corretto*', '/opt/jre', '/opt/node*', '/opt/jetty*', '/opt/jython*'] + if argsp.profile == 'jans': + remove_list.append('/opt/opendj') + if not argsp.keep_downloads: + remove_list.append('/opt/dist') + + for p in remove_list: + cmd = 'rm -r -f ' + p + print("Executing", cmd) + os.system('rm -r -f ' + p) + + def main(): check_install_dependencies() @@ -346,48 +392,8 @@ def main(): os.system('systemctl restart jans-config-api') elif argsp.uninstall: - check_installation() - print('\033[31m') - print("This process is irreversible.") - print("You will lose all data related to Janssen Server.") - print('\033[0m') - print() - while True: - print('\033[31m \033[1m') - response = input("Are you sure to uninstall Janssen Server? [yes/N] ") - print('\033[0m') - if response.lower() in ('yes', 'n', 'no'): - if not response.lower() == 'yes': - sys.exit() - else: - break - else: - print("Please type \033[1m yes \033[0m to uninstall") - print("Uninstalling Jannsen Server...") - for service in jetty_services: - if os.path.exists(os.path.join(jetty_home, service)): - default_fn = os.path.join('/etc/default/', service) - if os.path.exists(default_fn): - print("Removing", default_fn) - os.remove(default_fn) - print("Stopping", service) - os.system('systemctl stop ' + service) - - if argsp.profile == 'jans': - print("Stopping OpenDj Server") - os.system('/opt/opendj/bin/stop-ds') - - remove_list = ['/etc/certs', '/etc/jans', '/opt/jans', '/opt/amazon-corretto*', '/opt/jre', '/opt/node*', '/opt/jetty*', '/opt/jython*'] - if argsp.profile == 'jans': - remove_list.append('/opt/opendj') - if not argsp.keep_downloads: - remove_list.append('/opt/dist') - - for p in remove_list: - cmd = 'rm -r -f ' + p - print("Executing", cmd) - os.system('rm -r -f ' + p) + uninstall_jans() else: diff --git a/jans-linux-setup/jans_setup/jans_setup.py b/jans-linux-setup/jans_setup/jans_setup.py index bcd7a6f320a..53c635571f7 100755 --- a/jans-linux-setup/jans_setup/jans_setup.py +++ b/jans-linux-setup/jans_setup/jans_setup.py @@ -22,13 +22,17 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(dir_path) -if not (os.path.exists('/opt/dist/jans/jans.zip') or os.path.exists('jans-auth.war')): +if not (os.path.exists('/opt/dist/jans/jans.zip') or os.path.exists('jans-auth.war')) or '-uninstall' in sys.argv: import install install.setup_dir = dir_path - print("Downloading Files") - install.download_files() - install.extract_yaml_files() - install.prepare_jans_cli_package() + if '-uninstall' in sys.argv: + install.uninstall_jans() + sys.exit() + else: + print("Downloading Files") + install.download_files() + install.extract_yaml_files() + install.prepare_jans_cli_package() os.environ['LC_ALL'] = 'C' from setup_app.utils.arg_parser import arg_parser diff --git a/jans-linux-setup/requirements.txt b/jans-linux-setup/requirements.txt index 953a2d6c026..ff071b66612 100644 --- a/jans-linux-setup/requirements.txt +++ b/jans-linux-setup/requirements.txt @@ -2,6 +2,8 @@ setuptools>=59.6.0 pyasn1==0.4.8 ruamel.yaml>=0.16.5 sqlalchemy==1.4.31 +sqlalchemy==1.3.23 +cryptography==36.0.1 google-cloud-spanner==3.13.0 ldap3 PyMySQL diff --git a/jans-linux-setup/setup.py b/jans-linux-setup/setup.py index a46c449f6a7..cb24e9b9056 100644 --- a/jans-linux-setup/setup.py +++ b/jans-linux-setup/setup.py @@ -38,7 +38,8 @@ def find_version(*file_paths): "setuptools>=59.6.0", "pyasn1==0.4.8", "ruamel.yaml>=0.16.5", - "sqlalchemy==1.4.31", + "sqlalchemy==1.3.23", + "cryptography==36.0.1", "google-cloud-spanner==3.13.0", "ldap3", "PyMySQL",