Skip to content
Snippets Groups Projects
Commit fdf82f6e authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Merge branch 't33815-rename-tester-systemd-files' into 'master'

See merge request mediaserver/envsetup!51
parents e34c268a db57bc01
No related branches found
No related tags found
No related merge requests found
......@@ -17,20 +17,27 @@ def check_systemd_setup():
'''
# Remove old files
deprecated_files = (
'/lib/systemd/system/envsetup-tests.service',
'/lib/systemd/system/envsetup-tests.timer',
'/etc/systemd/system/envsetup-tests.service',
'/etc/systemd/system/envsetup-tests.timer',
'/etc/systemd/system/ubicast-config.service'
)
for path in deprecated_files:
if os.path.exists(path):
# Disable service/timer
name = path.rsplit('/', 1)[-1]
subprocess.run(['systemctl', 'disable', name])
subprocess.run(['systemctl', 'stop', name])
# Remove service/timer
os.remove(path)
print('Removed deprecated file: "%s".' % path)
# Write systemd files if needed
template_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'systemd')
files_to_write = (
('/lib/systemd/system/envsetup-tests.service', os.path.join(template_dir, 'envsetup-tests.service')),
('/lib/systemd/system/envsetup-tests.timer', os.path.join(template_dir, 'envsetup-tests.timer')),
('/lib/systemd/system/envsetup-tester.service', os.path.join(template_dir, 'envsetup-tester.service')),
('/lib/systemd/system/envsetup-tester.timer', os.path.join(template_dir, 'envsetup-tester.timer')),
)
for path, template in files_to_write:
content = ''
......@@ -50,8 +57,8 @@ def check_systemd_setup():
# Enable systemd timer if needed
if get_conf('TESTER_ENABLE_SYSTEMD_TIMER') == '1':
print('Checking status of envsetup systemd timer...')
p = subprocess.run(['systemctl', 'is-enabled', 'envsetup-tests.timer'])
p = subprocess.run(['systemctl', 'is-enabled', 'envsetup-tester.timer'])
if p.returncode != 0:
subprocess.run(['systemctl', 'enable', 'envsetup-tests.timer'])
subprocess.run(['systemctl', 'restart', 'envsetup-tests.timer'])
print('Enabled "envsetup-tests.timer" in systemd.')
subprocess.run(['systemctl', 'enable', 'envsetup-tester.timer'])
subprocess.run(['systemctl', 'restart', 'envsetup-tester.timer'])
print('Enabled "envsetup-tester.timer" in systemd.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment