diff options
author | William A. Kennington III <wak@google.com> | 2023-10-17 04:26:32 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2023-10-27 00:05:53 +0300 |
commit | f0b88e250356922cbc8e52fd3cdfac1785e89bb1 (patch) | |
tree | 71642f1b0cdbe6e7fbbcec335e49ed16dced2598 /meta-google | |
parent | d8122305894518478479d149af73c20e6af087c6 (diff) | |
download | openbmc-f0b88e250356922cbc8e52fd3cdfac1785e89bb1.tar.xz |
meta-google: gbmc-ncsi-config: Optionally purge stale networkd configs
On many machines it's safe to purge all configurations that do not match
the NCSI interface, to keep a tidy config directory and purge
potentially problematic configs.
Change-Id: I5f714516eb3718544f0787ac38eb69d485086b42
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rw-r--r-- | meta-google/recipes-google/ncsi/files/gbmc-ncsi-purge.service.in | 10 | ||||
-rw-r--r-- | meta-google/recipes-google/ncsi/gbmc-ncsi-config.bb | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-purge.service.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-purge.service.in new file mode 100644 index 0000000000..bbbd9921c8 --- /dev/null +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-purge.service.in @@ -0,0 +1,10 @@ +[Unit] +Before=systemd-network.service +After=gbmc-ncsi-old.service + +[Service] +Type=oneshot +ExecStart=find /etc/systemd/network -mindepth 1 ! -name 00-bmc-@NCSI_IF@.network -exec rm -vrf {} \; -prune + +[Install] +WantedBy=multi-user.target diff --git a/meta-google/recipes-google/ncsi/gbmc-ncsi-config.bb b/meta-google/recipes-google/ncsi/gbmc-ncsi-config.bb index cb547b1be8..607f1b789c 100644 --- a/meta-google/recipes-google/ncsi/gbmc-ncsi-config.bb +++ b/meta-google/recipes-google/ncsi/gbmc-ncsi-config.bb @@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5 inherit systemd GBMC_NCSI_IF_OLD ??= "" +GBMC_NCSI_PURGE_ETC ??= "" SRC_URI += " \ file://-bmc-gbmcbrncsidhcp.netdev \ @@ -26,6 +27,7 @@ SRC_URI += " \ file://gbmc-ncsi-alias.service.in \ file://50-gbmc-ncsi-clear-ip.sh.in \ file://gbmc-ncsi-old.service.in \ + file://gbmc-ncsi-purge.service.in \ " S = "${WORKDIR}" @@ -54,6 +56,7 @@ SYSTEMD_SERVICE:${PN} += " \ gbmc-ncsi-set-nicenabled.service \ gbmc-ncsi-ip-from-ra.service \ ${@'' if d.getVar('GBMC_NCSI_IF_OLD') == '' else 'gbmc-ncsi-old.service'} \ + ${@'' if d.getVar('GBMC_NCSI_PURGE_ETC') == '' else 'gbmc-ncsi-purge.service'} \ " do_install:append() { @@ -137,6 +140,11 @@ do_install:append() { >${D}${systemd_system_unitdir}/gbmc-ncsi-old.service fi + if [ -n "${GBMC_NCSI_PURGE_ETC}" ]; then + sed -e "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-purge.service.in \ + >${D}${systemd_system_unitdir}/gbmc-ncsi-purge.service + fi + sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-ip-from-ra.service.in \ >${WORKDIR}/gbmc-ncsi-ip-from-ra.service install -m0644 ${WORKDIR}/gbmc-ncsi-ip-from-ra.service ${D}${systemd_system_unitdir} |