From 6142b4257fbd732673d0a6fb9fd6cc178903c2e4 Mon Sep 17 00:00:00 2001 From: adator <85586985+adator85@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:36:12 +0200 Subject: [PATCH] fix Installation --- core/installation.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/core/installation.py b/core/installation.py index 7f0831f..2780b52 100644 --- a/core/installation.py +++ b/core/installation.py @@ -182,11 +182,7 @@ class Install: print(f'/!\\ Service file already exist /!\\') return None - # Check if user systemd is available (.config/systemd/user/) - if not os.path.exists(self.config.unix_systemd_folder): - self.run_subprocess(['mkdir', '-p', self.config.unix_systemd_folder]) - - contain = f'''[Unit] + contain = f'''[Unit] Description=Defender IRC Service [Service] @@ -197,7 +193,19 @@ Restart=on-failure [Install] WantedBy=multi-user.target - ''' +''' + # Check if user systemd is available (.config/systemd/user/) + if not os.path.exists(self.config.unix_systemd_folder): + self.run_subprocess(['mkdir', '-p', self.config.unix_systemd_folder]) + + with open(full_service_file_path, 'w+') as servicefile: + servicefile.write(contain) + servicefile.close() + print(f'Service file generated with current configuration') + print(f'Running Defender IRC Service ...') + self.run_subprocess(self.config.service_cmd_executable) + + else: with open(full_service_file_path, 'w+') as servicefile: servicefile.write(contain) servicefile.close()