diff options
author | Robert Schweikert <rjschwei@suse.com> | 2019-01-28 17:51:57 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-01-28 17:51:57 +0000 |
commit | 09dcecf37628c5809ae21d7785693cb7358ca94c (patch) | |
tree | ee63eb7fad8ceba60af3ed2e940b37c8919a5355 /setup.py | |
parent | 3f12012eba2aabb6ca7b3ef70bc33a4aa1edada4 (diff) | |
download | vyos-cloud-init-09dcecf37628c5809ae21d7785693cb7358ca94c.tar.gz vyos-cloud-init-09dcecf37628c5809ae21d7785693cb7358ca94c.zip |
systemd: Render generator from template to account for system differences.
The systemd generator used had a hard coded path for the location target
file to create. This path does not apply to all distributions.
Make the generator and template to have the path set during build time.
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -30,6 +30,8 @@ VARIANT = None def is_f(p): return os.path.isfile(p) +def is_generator(p): + return '-generator' in p def tiny_p(cmd, capture=True): # Darn python 2.6 doesn't have check_output (argggg) @@ -90,7 +92,7 @@ def read_requires(): return str(deps).splitlines() -def render_tmpl(template): +def render_tmpl(template, mode=None): """render template into a tmpdir under same dir as setup.py This is rendered to a temporary directory under the top level @@ -119,6 +121,8 @@ def render_tmpl(template): VARIANT, template, fpath]) else: tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath]) + if mode: + os.chmod(fpath, mode) # return path relative to setup.py return os.path.join(os.path.basename(tmpd), bname) @@ -138,8 +142,11 @@ INITSYS_FILES = { 'systemd': [render_tmpl(f) for f in (glob('systemd/*.tmpl') + glob('systemd/*.service') + - glob('systemd/*.target')) if is_f(f)], - 'systemd.generators': [f for f in glob('systemd/*-generator') if is_f(f)], + glob('systemd/*.target')) + if (is_f(f) and not is_generator(f))], + 'systemd.generators': [ + render_tmpl(f, mode=0o755) + for f in glob('systemd/*') if is_f(f) and is_generator(f)], 'upstart': [f for f in glob('upstart/*') if is_f(f)], } INITSYS_ROOTS = { |