diff --git a/src/base/default_policy/default_policy.py b/src/base/default_policy/default_policy.py index 9da2b6c..e1c82fa 100644 --- a/src/base/default_policy/default_policy.py +++ b/src/base/default_policy/default_policy.py @@ -51,7 +51,6 @@ class DefaultPolicy: else: self.logger.info(".config/autostart folder exists.") self.logger.info("Checking if {0}-autostart-for-profile.desktop autorun file exists.".format(exec_command)) - if not Util.is_exist("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command)): self.logger.info("{0}-autostart-for-profile.desktop autorun file does not exists. Creating file.".format(exec_command)) Util.create_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command)) @@ -60,6 +59,10 @@ class DefaultPolicy: "Exec={0}{1} www.liderahenk.org".format(firefox_path, exec_command) Util.write_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command), content) self.logger.info("Autorun config is written to {0}-autostart-for-profile.desktop.".format(exec_command)) + gid = self.util.file_group(homedir) + cmd = "chown -R {0}:{1} {2}/.config/autostart".format(username, gid, homedir) + self.util.execute(cmd) + self.logger.info("Set permissons for {0}/.config/autostart directory".format(homedir)) else: self.logger.info("{0}-autostart-for-profile.desktop exists".format(exec_command)) else: @@ -131,4 +134,4 @@ class DefaultPolicy: new_element.attrib["value"] = app_name_for_blocking tree.write(fileName) else: - self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.") + self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.") \ No newline at end of file diff --git a/src/base/registration/config-files/ahenk.pulseaudio.desktop b/src/base/registration/config-files/ahenk.pulseaudio.desktop new file mode 100644 index 0000000..c369000 --- /dev/null +++ b/src/base/registration/config-files/ahenk.pulseaudio.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Name=PulseAudio Sound System +Name[tr]=PulseAudio Ses Sistemi +Comment=Start the PulseAudio Sound System +Comment[tr]=PulseAudio Ses Sistemini Başlat +Exec=pulseaudio --start +Terminal=false +Type=Application +Categories= +GenericName= +X-GNOME-Autostart-Phase=Initialization +X-KDE-autostart-phase=1 diff --git a/src/base/registration/execute_sssd_ad_authentication.py b/src/base/registration/execute_sssd_ad_authentication.py index 3b43e42..65138b8 100644 --- a/src/base/registration/execute_sssd_ad_authentication.py +++ b/src/base/registration/execute_sssd_ad_authentication.py @@ -4,6 +4,7 @@ from base.scope import Scope from base.util.util import Util +import time class ExecuteSSSDAdAuthentication: def __init__(self): @@ -144,11 +145,20 @@ class ExecuteSSSDAdAuthentication: else: self.logger.error("Realm Discover komutu başarısız : " + str(p_err)) - (result_code, p_out, p_err) = self.util.execute("echo \"{0}\" | realm join --user={1} {2}".format(password, ad_username, domain_name.upper())) - if (result_code == 0): - self.logger.info("Realm Join komutu başarılı") - else: - self.logger.error("Realm Join komutu başarısız : " + str(p_err)) + self.domain_try_counter = 0 + + while (True): + self.domain_try_counter = self.domain_try_counter + 1 + if (self.domain_try_counter == 10): + break + else: + (result_code, p_out, p_err) = self.util.execute("echo \"{0}\" | realm join --user={1} {2}".format(password, ad_username, domain_name.upper())) + if (result_code == 0): + self.logger.info("Realm Join komutu başarılı") + break + else: + self.logger.error("Realm Join komutu başarısız : " + str(p_err)) + time.sleep(2) # Configure sssd template sssd_config_template_path = "/usr/share/ahenk/base/registration/config-files/sssd_ad.conf" diff --git a/src/base/registration/registration.py b/src/base/registration/registration.py index ad6cdb0..0a2cb8a 100644 --- a/src/base/registration/registration.py +++ b/src/base/registration/registration.py @@ -151,6 +151,8 @@ class Registration: self.install_and_config_ad(reg_reply) self.change_permissions_for_local_users() + self.create_ahenk_pulseaudio_desktop_file() + except Exception as e: self.logger.error('Registration error. Error Message: {0}.'.format(str(e))) print(e) @@ -377,6 +379,9 @@ class Registration: writing_file.close() self.logger.info("gdm.conf has been configured.") self.logger.info('GNOME conf file deleted') + + self.delete_ahenk_pulseaudio_desktop_file() + Util.shutdown() except Exception as e: self.logger.error("Error while running purge_and_unregister process.. Error Message " + str(e)) @@ -599,3 +604,23 @@ class Registration: writing_file.close() self.logger.info("gdm.conf has been configured.") + def create_ahenk_pulseaudio_desktop_file(self): + ahenkpulseaudio = "/etc/xdg/autostart/ahenk.pulseaudio.desktop" + ahenkpulseaudio_template = "/usr/share/ahenk/base/registration/config-files/ahenk.pulseaudio.desktop" + if not self.util.is_exist(ahenkpulseaudio): + self.logger.info("ahenk.pulseaudio.desktop autostart file doesn't exist") + self.util.create_file(ahenkpulseaudio) + file_ahenkpulseaudio = open(ahenkpulseaudio, 'a') + self.util.copy_file(ahenkpulseaudio_template, ahenkpulseaudio) + file_ahenkpulseaudio.close() + self.logger.info("ahenk.pulseaudio.desktop has been configured.") + else: + self.logger.info("ahenk.pulseaudio.desktop autostart file exist") + + def delete_ahenk_pulseaudio_desktop_file(self): + ahenkpulseaudio = "/etc/xdg/autostart/ahenk.pulseaudio.desktop" + if self.util.is_exist(ahenkpulseaudio): + self.util.delete_file(ahenkpulseaudio) + self.logger.info("ahenk.pulseaudio.desktop autostart file deleted") + else: + self.logger.info("ahenk.pulseaudio.desktop autostart file doesn't exist")