1# SPDX-License-Identifier: Apache-2.0
2
3systemd_dep = dependency('systemd', required: true)
4
5systemd_system_unit_dir = systemd_dep.get_variable(
6    pkgconfig: 'systemdsystemunitdir'
7)
8dist_conf_data = configuration_data()
9dist_conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
10
11# Service installation
12configure_file(
13  input: 'openpower-dump-monitor.service',
14  output: 'openpower-dump-monitor.service',
15  configuration: dist_conf_data,
16  install: true,
17  install_dir: systemd_system_unit_dir
18)
19
20# Symlinks for services
21systemd_alias = [
22    ['../openpower-dump-monitor.service',
23     'obmc-host-startmin@0.target.wants/openpower-dump-monitor.service']
24]
25
26foreach service: systemd_alias
27    meson.add_install_script(
28        'sh', '-c',
29        'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(
30            systemd_system_unit_dir, service[1]
31        ),
32    )
33    meson.add_install_script(
34        'sh', '-c',
35        'ln -s @0@ $DESTDIR/@1@/@2@'.format(
36            service[0], systemd_system_unit_dir, service[1]
37        ),
38    )
39endforeach
40