diff --git a/meta-oe/recipes-extended/etcd/etcd/etcd-new.path b/meta-oe/recipes-extended/etcd/etcd/etcd-new.path new file mode 100644 index 00000000000..1a18a401601 --- /dev/null +++ b/meta-oe/recipes-extended/etcd/etcd/etcd-new.path @@ -0,0 +1,9 @@ +[Unit] +Description=Monitor the etcd config file changes + +[Path] +PathChanged=/run/etcd-new.conf +Unit=etcd-new.service + +[Install] +WantedBy=multi-user.target diff --git a/meta-oe/recipes-extended/etcd/etcd/etcd-new.service b/meta-oe/recipes-extended/etcd/etcd/etcd-new.service new file mode 100644 index 00000000000..479678dc670 --- /dev/null +++ b/meta-oe/recipes-extended/etcd/etcd/etcd-new.service @@ -0,0 +1,15 @@ +[Unit] +Description=etcd cluster member start/add service +Documentation=https://etcd.io/docs/v3.5/op-guide/clustering/ +ConditionPathExists=!/var/lib/etcd/member +ConditionPathExists=/run/etcd-new.conf +OnFailure=etcd.service + +[Service] +Type=notify +EnvironmentFile=/run/etcd-new.conf +ExecStart=/usr/bin/etcd +Restart=no + +[Install] +WantedBy=multi-user.target diff --git a/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb b/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb index c01b03e4aff..3e7bb0f68f5 100644 --- a/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb +++ b/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb @@ -10,6 +10,8 @@ SRC_URI = " \ file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \ file://etcd.service \ file://etcd-existing.conf \ + file://etcd-new.service \ + file://etcd-new.path \ " SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f" @@ -53,7 +55,7 @@ go_do_compile:prepend() { REQUIRED_DISTRO_FEATURES = "systemd" SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE:${PN}:append = " etcd.service" +SYSTEMD_SERVICE:${PN}:append = " etcd.service etcd-new.service etcd-new.path" do_install:append() { install -d ${D}${bindir}/ @@ -63,6 +65,8 @@ do_install:append() { install -m 0644 ${WORKDIR}/etcd-existing.conf -D -t ${D}${sysconfdir}/etcd.d install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/etcd.service ${D}${systemd_system_unitdir}/ + install -m 0644 ${WORKDIR}/etcd-new.service ${D}${systemd_system_unitdir}/ + install -m 0644 ${WORKDIR}/etcd-new.path ${D}${systemd_system_unitdir}/ } FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf"