xref: /openbmc/openpower-debug-collector/dump/dist/meson.build (revision ac291d44b3822d6c9359f0397d7d4084b0954bd9)
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
20configure_file(
21    input: 'clear_systemdumps_poweroff.service',
22    output: 'clear_systemdumps_poweroff.service',
23    configuration: dist_conf_data,
24    install: true,
25    install_dir: systemd_system_unit_dir,
26)
27
28configure_file(
29    input: 'clear_resourcedumps_poweroff.service',
30    output: 'clear_resourcedumps_poweroff.service',
31    configuration: dist_conf_data,
32    install: true,
33    install_dir: systemd_system_unit_dir,
34)
35
36# Symlinks for services
37systemd_alias = [
38    [
39        '../openpower-dump-monitor.service',
40        'obmc-host-startmin@0.target.wants/openpower-dump-monitor.service',
41    ],
42]
43
44systemd_alias += [
45    [
46        '../clear_systemdumps_poweroff.service',
47        'obmc-host-stop@0.target.wants/clear_systemdumps_poweroff.service',
48    ],
49]
50
51systemd_alias += [
52    [
53        '../clear_resourcedumps_poweroff.service',
54        'obmc-host-stop@0.target.wants/clear_resourcedumps_poweroff.service',
55    ],
56]
57
58foreach service : systemd_alias
59    meson.add_install_script(
60        'sh',
61        '-c',
62        'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(
63            systemd_system_unit_dir,
64            service[1],
65        ),
66    )
67    meson.add_install_script(
68        'sh',
69        '-c',
70        'ln -s @0@ $DESTDIR/@1@/@2@'.format(
71            service[0],
72            systemd_system_unit_dir,
73            service[1],
74        ),
75    )
76endforeach
77