William A. Kennington III | 3b3c40f | 2021-03-04 22:56:26 -0800 | [diff] [blame] | 1 | SUMMARY = "Configures MAC addresses on 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 | SRC_URI += " \ |
| 9 | file://gbmc-mac-config.service \ |
| 10 | file://gbmc-mac-config.sh.in \ |
| 11 | " |
| 12 | |
| 13 | S = "${WORKDIR}" |
| 14 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame^] | 15 | RDEPENDS:${PN} += " \ |
William A. Kennington III | 3b3c40f | 2021-03-04 22:56:26 -0800 | [diff] [blame] | 16 | bash \ |
| 17 | ipmi-fru-sh \ |
| 18 | " |
| 19 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame^] | 20 | FILES:${PN} += "${systemd_unitdir}" |
William A. Kennington III | 3b3c40f | 2021-03-04 22:56:26 -0800 | [diff] [blame] | 21 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame^] | 22 | SYSTEMD_SERVICE:${PN} += "gbmc-mac-config.service" |
William A. Kennington III | 3b3c40f | 2021-03-04 22:56:26 -0800 | [diff] [blame] | 23 | |
| 24 | GBMC_MAC_EEPROM_OF_NAME ?= "" |
| 25 | |
| 26 | # Maps the MAC address offset from the base address to an interface name |
| 27 | # in bash associative array syntax. |
| 28 | # Ex. "[0]=eth0 [2]=eth2" |
| 29 | GBMC_MAC_IF_MAP ?= "" |
| 30 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame^] | 31 | do_install:append() { |
William A. Kennington III | 3b3c40f | 2021-03-04 22:56:26 -0800 | [diff] [blame] | 32 | if [ -z '${GBMC_MAC_EEPROM_OF_NAME}' ]; then |
| 33 | echo 'Missing GBMC_MAC_EEPROM_OF_NAME' >&2 |
| 34 | exit 1 |
| 35 | fi |
| 36 | |
| 37 | # Build time dictionary sanity check |
| 38 | bash -c 'declare -A dict=(${GBMC_MAC_IF_MAP})' |
| 39 | |
| 40 | sed gbmc-mac-config.sh.in \ |
| 41 | -e 's#@EEPROM@#${GBMC_MAC_EEPROM_OF_NAME}#' \ |
| 42 | -e 's#@NUM_TO_IF@#${GBMC_MAC_IF_MAP}#' \ |
| 43 | >gbmc-mac-config.sh |
| 44 | |
| 45 | install -d -m0755 ${D}${libexecdir} |
| 46 | install -m0755 gbmc-mac-config.sh ${D}${libexecdir}/ |
| 47 | |
| 48 | install -d -m0755 ${D}${systemd_system_unitdir} |
| 49 | install -m0644 gbmc-mac-config.service ${D}${systemd_system_unitdir}/ |
| 50 | } |