blob: ca711066058f65acdd0710b34f6b2048462a2369 [file] [log] [blame]
William A. Kennington IIIf93003d2021-03-23 22:59:39 -07001SUMMARY = "Configures KCS for a gBMC system"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit systemd
7
8S = "${WORKDIR}"
9
10PROVIDES += "virtual-obmc-host-ipmi-hw"
11RPROVIDES_${PN} += "virtual-obmc-host-ipmi-hw"
12
13FILES_${PN} += "${systemd_system_unitdir}"
14RDEPENDS_${PN} += "google-kcsbridge"
15
16GBMC_KCS_DEV ?= ""
17
18def systemd_escape_char(c):
19 return '\\x{:x}'.format(ord(c))
20
21def 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
36do_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}