Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | |
| 3 | systemd_dep = dependency('systemd', required: true) |
| 4 | |
| 5 | systemd_system_unit_dir = systemd_dep.get_variable( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 6 | pkgconfig: 'systemdsystemunitdir', |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 7 | ) |
| 8 | dist_conf_data = configuration_data() |
| 9 | dist_conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
| 10 | |
| 11 | # Service installation |
| 12 | configure_file( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 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, |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 18 | ) |
| 19 | |
Dhruvaraj Subhashchandran | d158952 | 2024-06-04 00:38:48 -0500 | [diff] [blame] | 20 | configure_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 | |
| 28 | configure_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 Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 36 | # Symlinks for services |
| 37 | systemd_alias = [ |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 38 | [ |
| 39 | '../openpower-dump-monitor.service', |
| 40 | 'obmc-host-startmin@0.target.wants/openpower-dump-monitor.service', |
| 41 | ], |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 42 | ] |
| 43 | |
Dhruvaraj Subhashchandran | d158952 | 2024-06-04 00:38:48 -0500 | [diff] [blame] | 44 | systemd_alias += [ |
| 45 | [ |
| 46 | '../clear_systemdumps_poweroff.service', |
| 47 | 'obmc-host-stop@0.target.wants/clear_systemdumps_poweroff.service', |
| 48 | ], |
| 49 | ] |
| 50 | |
| 51 | systemd_alias += [ |
| 52 | [ |
| 53 | '../clear_resourcedumps_poweroff.service', |
| 54 | 'obmc-host-stop@0.target.wants/clear_resourcedumps_poweroff.service', |
| 55 | ], |
| 56 | ] |
| 57 | |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 58 | foreach service : systemd_alias |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 59 | meson.add_install_script( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 60 | 'sh', |
| 61 | '-c', |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 62 | 'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 63 | systemd_system_unit_dir, |
| 64 | service[1], |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 65 | ), |
| 66 | ) |
| 67 | meson.add_install_script( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 68 | 'sh', |
| 69 | '-c', |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 70 | 'ln -s @0@ $DESTDIR/@1@/@2@'.format( |
Patrick Williams | b37d826 | 2025-02-01 08:36:31 -0500 | [diff] [blame] | 71 | service[0], |
| 72 | systemd_system_unit_dir, |
| 73 | service[1], |
Dhruvaraj Subhashchandran | 888472d | 2024-05-17 12:56:30 -0500 | [diff] [blame] | 74 | ), |
| 75 | ) |
| 76 | endforeach |