Artem Senichev | fb69513 | 2018-11-02 16:46:13 +0300 | [diff] [blame] | 1 | SUMMARY = "Phosphor Host logger" |
| 2 | DESCRIPTION = "Save log messages from host's console to the persistent storage." |
| 3 | HOMEPAGE = "https://github.com/openbmc/phosphor-hostlogger" |
| 4 | PR = "r1" |
| 5 | PV = "1.0+git${SRCPV}" |
| 6 | |
Andrew Geissler | ec34cc6 | 2021-11-03 09:57:52 -0500 | [diff] [blame] | 7 | inherit pkgconfig meson |
Artem Senichev | fb69513 | 2018-11-02 16:46:13 +0300 | [diff] [blame] | 8 | inherit systemd |
| 9 | |
| 10 | # License info |
| 11 | LICENSE = "Apache-2.0" |
| 12 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" |
| 13 | |
| 14 | # Dependencies |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 15 | DEPENDS += " \ |
| 16 | phosphor-logging \ |
| 17 | zlib \ |
Alexander Filippov | 874d23e | 2019-01-10 12:38:09 +0300 | [diff] [blame] | 18 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 19 | RDEPENDS:${PN} += "obmc-console" |
| 20 | RRECOMMENDS:${PN} += "phosphor-debug-collector" |
Artem Senichev | fb69513 | 2018-11-02 16:46:13 +0300 | [diff] [blame] | 21 | |
Artem Senichev | fb69513 | 2018-11-02 16:46:13 +0300 | [diff] [blame] | 22 | # Source code repository |
| 23 | S = "${WORKDIR}/git" |
Patrick Williams | bb99d22 | 2022-01-24 15:55:09 -0600 | [diff] [blame] | 24 | SRC_URI = "git://github.com/openbmc/phosphor-hostlogger;branch=master;protocol=https" |
Andrew Geissler | 7a2b4fc | 2021-10-26 06:41:41 +0000 | [diff] [blame] | 25 | SRCREV = "1ecbb996d9c88871db20c455db02ee055bff10f2" |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 26 | |
Brandon Kim | bea44e8 | 2021-07-30 00:06:27 -0700 | [diff] [blame] | 27 | # Disable unit tests |
Patrick Williams | ed104d4 | 2021-08-31 13:19:27 -0500 | [diff] [blame] | 28 | EXTRA_OEMESON:append = " -Dtests=disabled" |
Brandon Kim | bea44e8 | 2021-07-30 00:06:27 -0700 | [diff] [blame] | 29 | |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 30 | # Systemd service template |
| 31 | SYSTEMD_PACKAGES = "${PN}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 32 | SYSTEMD_SERVICE:${PN} = "hostlogger@.service" |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 33 | |
| 34 | # Default service instance to install (single-host mode) |
| 35 | DEFAULT_INSTANCE = "ttyVUART0" |
| 36 | DEFAULT_SERVICE = "hostlogger@${DEFAULT_INSTANCE}.service" |
| 37 | |
| 38 | # Multi-host mode setup - list of configuration files to install, can be added |
| 39 | # via SRC_URI in a bbappend. The file name is the name of the service instance, |
| 40 | # which should match the corresponding instance of the obmc-console service. |
| 41 | CUSTOM_CONFIGS = "${@custom_configs('${WORKDIR}')}" |
| 42 | CUSTOM_SERVICES = "${@custom_services('${CUSTOM_CONFIGS}')}" |
| 43 | |
| 44 | # Preset systemd units |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 45 | SYSTEMD_SERVICE:${PN} += "${@'${CUSTOM_SERVICES}' if len('${CUSTOM_SERVICES}') \ |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 46 | else '${DEFAULT_SERVICE}'}" |
| 47 | |
| 48 | # Gets list of custom config files in a directory |
| 49 | def custom_configs(workdir): |
| 50 | if os.path.exists(workdir): |
| 51 | return ' '.join([f for f in os.listdir(workdir) if f.endswith('.conf')]) |
| 52 | |
| 53 | # Get list of custom service instances |
| 54 | def custom_services(configs): |
| 55 | return ' '.join(['hostlogger@' + i.replace('.conf', '.service') \ |
| 56 | for i in configs.split()]) |
| 57 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 58 | do_install:append() { |
Artem Senichev | 6be7f86 | 2020-06-16 09:49:50 +0300 | [diff] [blame] | 59 | # Install config files |
| 60 | if [ -n "${CUSTOM_CONFIGS}" ]; then |
| 61 | for CONFIG_FILE in ${CUSTOM_CONFIGS}; do |
| 62 | install -Dm 0644 ${WORKDIR}/${CONFIG_FILE} \ |
| 63 | ${D}${sysconfdir}/hostlogger/${CONFIG_FILE} |
| 64 | done |
| 65 | else |
| 66 | install -Dm 0644 ${S}/default.conf \ |
| 67 | ${D}${sysconfdir}/hostlogger/${DEFAULT_INSTANCE}.conf |
| 68 | fi |
| 69 | } |