From ff4d525347aa73b52851a78bf3b5933c59f8833f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 20 May 2021 14:14:47 +0300 Subject: Improved some spacing and improved SELinux warning --- systemd-service-create.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'systemd-service-create.py') diff --git a/systemd-service-create.py b/systemd-service-create.py index 4527bd4..bec73e1 100755 --- a/systemd-service-create.py +++ b/systemd-service-create.py @@ -11,9 +11,7 @@ except PermissionError as e: exit("You must run this script as root!") cwd = os.getcwd() - -if "home" in cwd: - print("Warning: you are running this script from the home directory! If you use SELinux, the service won't work (https://serverfault.com/a/957087/592409)!") +print("WARNING: if you use SELinux, you'll need to move the whole repository into /usr/local/share/ or copy reposync.py and update the repository list file location (https://serverfault.com/a/957087/592409)!") service_file = open(r"/etc/systemd/system/reposync.service", "w") service_file.write( @@ -23,8 +21,7 @@ Description=Python script for synchronizing repositories [Service] Type=oneshot WorkingDirectory={cwd} -ExecStart={cwd}/reposync.py -""") +ExecStart={cwd}/reposync.py""") service_file.close() timer_file = open(r"/etc/systemd/system/reposync.timer", "w") @@ -37,12 +34,10 @@ OnBootSec=10min OnUnitActiveSec=10min [Install] -WantedBy=timers.target -""") +WantedBy=timers.target""") timer_file.close() print( """reposync.service and reposync.timer files created successfully! You'll now need to run the following to activate them (as root): systemctl daemon-reload && systemctl start reposync.timer -To remove them, execute (as root) this: rm -f /etc/systemd/system/reposync.* -""") +To remove them, execute (as root) this: rm -f /etc/systemd/system/reposync.*""") -- cgit v1.2.3