blob: 1e88be08e2f6da65a0b9c17fc1c65d853c82407f [file] [log] [blame]
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -05001# SPDX-License-Identifier: Apache-2.0
2
3systemd_dep = dependency('systemd', required: true)
4
5systemd_system_unit_dir = systemd_dep.get_variable(
Patrick Williamsb37d8262025-02-01 08:36:31 -05006 pkgconfig: 'systemdsystemunitdir',
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -05007)
8dist_conf_data = configuration_data()
9dist_conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
10
11# Service installation
12configure_file(
Patrick Williamsb37d8262025-02-01 08:36:31 -050013 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,
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050018)
19
Dhruvaraj Subhashchandrand1589522024-06-04 00:38:48 -050020configure_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
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050036# Symlinks for services
37systemd_alias = [
Patrick Williamsb37d8262025-02-01 08:36:31 -050038 [
39 '../openpower-dump-monitor.service',
40 'obmc-host-startmin@0.target.wants/openpower-dump-monitor.service',
41 ],
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050042]
43
Dhruvaraj Subhashchandrand1589522024-06-04 00:38:48 -050044systemd_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
Patrick Williamsb37d8262025-02-01 08:36:31 -050058foreach service : systemd_alias
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050059 meson.add_install_script(
Patrick Williamsb37d8262025-02-01 08:36:31 -050060 'sh',
61 '-c',
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050062 'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(
Patrick Williamsb37d8262025-02-01 08:36:31 -050063 systemd_system_unit_dir,
64 service[1],
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050065 ),
66 )
67 meson.add_install_script(
Patrick Williamsb37d8262025-02-01 08:36:31 -050068 'sh',
69 '-c',
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050070 'ln -s @0@ $DESTDIR/@1@/@2@'.format(
Patrick Williamsb37d8262025-02-01 08:36:31 -050071 service[0],
72 systemd_system_unit_dir,
73 service[1],
Dhruvaraj Subhashchandran888472d2024-05-17 12:56:30 -050074 ),
75 )
76endforeach