William A. Kennington III | f93003d | 2021-03-23 22:59:39 -0700 | [diff] [blame^] | 1 | SUMMARY = "Configures KCS for a gBMC system" |
| 2 | PR = "r1" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 5 | |
| 6 | inherit systemd |
| 7 | |
| 8 | S = "${WORKDIR}" |
| 9 | |
| 10 | PROVIDES += "virtual-obmc-host-ipmi-hw" |
| 11 | RPROVIDES_${PN} += "virtual-obmc-host-ipmi-hw" |
| 12 | |
| 13 | FILES_${PN} += "${systemd_system_unitdir}" |
| 14 | RDEPENDS_${PN} += "google-kcsbridge" |
| 15 | |
| 16 | GBMC_KCS_DEV ?= "" |
| 17 | |
| 18 | def systemd_escape_char(c): |
| 19 | return '\\x{:x}'.format(ord(c)) |
| 20 | |
| 21 | def systemd_escape(unit): |
| 22 | import string |
| 23 | ret = '' |
| 24 | if len(unit) > 0 and unit[0] == '.': |
| 25 | ret += systemd_escape_char(unit[0]) |
| 26 | unit = unit[1:] |
| 27 | for c in unit: |
| 28 | if c == '/': |
| 29 | ret += '-' |
| 30 | elif c not in {*string.ascii_letters, *string.digits, ':', '_', '.'}: |
| 31 | ret += systemd_escape_char(c) |
| 32 | else: |
| 33 | ret += c |
| 34 | return ret |
| 35 | |
| 36 | do_install_append() { |
| 37 | if [ -z '${GBMC_KCS_DEV}' ]; then |
| 38 | echo "Missing GBMC_KCS_DEV" >&2 |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants |
| 43 | install -d -m0755 $wantdir |
| 44 | inst="${@systemd_escape(GBMC_KCS_DEV)}" |
| 45 | ln -sv ../kcsbridge@.service $wantdir/kcsbridge@$inst.service |
| 46 | } |