blob: cff5086b6bcd7aa9955b38c7255599709d81f535 [file] [log] [blame]
Yuxiao Zhanged7346e2023-04-05 15:01:46 -07001SUMMARY = "Rename the network device name"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6GBMC_ETHER_MAP ?= ""
7
8inherit systemd
9
10S = "${WORKDIR}"
11
12FILES:${PN} += "${systemd_unitdir}"
13
14do_install() {
15 netdir=${D}${systemd_unitdir}/network
16 install -d -m0755 $netdir
17
18 # install dev renaming files if any
19 if [ -z "${GBMC_ETHER_MAP}"]; then
20 return
21 fi
22 devmap="${GBMC_ETHER_MAP}"
23 for str in $devmap
24 do
25 devaddr="$(echo "${str}" | cut -d'|' -f1)"
26 devname="$(echo "${str}" | cut -d'|' -f2)"
27 echo "[Match]" > ${WORKDIR}/30-netdev-${devname}.link
28 echo "Path=*-${devaddr}" >> ${WORKDIR}/30-netdev-${devname}.link
29 echo "[Link]" >> ${WORKDIR}/30-netdev-${devname}.link
30 echo "Name=${devname}" >> ${WORKDIR}/30-netdev-${devname}.link
31 install -m0644 ${WORKDIR}/30-netdev-${devname}.link ${netdir}
32 done
33}
34