1*8a9ff14aSAndrew Jefferysystemd = dependency('systemd')
2*8a9ff14aSAndrew Jefferysystemd_system_unit_dir = systemd.get_variable(
3*8a9ff14aSAndrew Jeffery    'systemdsystemunitdir',
4*8a9ff14aSAndrew Jeffery    pkgconfig_define: ['prefix', get_option('prefix')],
5*8a9ff14aSAndrew Jeffery)
6*8a9ff14aSAndrew Jeffery
7feb19ef0SBrad Bishopunit_files = [
8feb19ef0SBrad Bishop    ['adc', 'xyz.openbmc_project.adcsensor.service'],
9255da6b4SThu Nguyen    ['intel-cpu', 'xyz.openbmc_project.intelcpusensor.service'],
10feb19ef0SBrad Bishop    ['exit-air', 'xyz.openbmc_project.exitairsensor.service'],
11feb19ef0SBrad Bishop    ['fan', 'xyz.openbmc_project.fansensor.service'],
12feb19ef0SBrad Bishop    ['hwmon-temp', 'xyz.openbmc_project.hwmontempsensor.service'],
13feb19ef0SBrad Bishop    ['ipmb', 'xyz.openbmc_project.ipmbsensor.service'],
14feb19ef0SBrad Bishop    ['intrusion', 'xyz.openbmc_project.intrusionsensor.service'],
1549d12d89SEd Tanous    ['mcu', 'xyz.openbmc_project.mcutempsensor.service'],
16feb19ef0SBrad Bishop    ['nvme', 'xyz.openbmc_project.nvmesensor.service'],
173a18b860SLei YU    ['psu', 'xyz.openbmc_project.psusensor.service'],
18a62c069fSJeff Lin    ['external', 'xyz.openbmc_project.externalsensor.service'],
19feb19ef0SBrad Bishop]
20feb19ef0SBrad Bishop
218eb514a4SAndrew Jefferyfs = import('fs')
22feb19ef0SBrad Bishopforeach tuple : unit_files
235bc307fbSPatrick Williams    if get_option(tuple[0]).allowed()
248eb514a4SAndrew Jeffery        fs.copyfile(
258eb514a4SAndrew Jeffery            tuple[1],
26feb19ef0SBrad Bishop            install: true,
27feb19ef0SBrad Bishop            install_dir: systemd_system_unit_dir,
28feb19ef0SBrad Bishop        )
29feb19ef0SBrad Bishop    endif
30feb19ef0SBrad Bishopendforeach
31