From ccee29841e3b80efbef680987914493a4ec2fb06 Mon Sep 17 00:00:00 2001 From: Prashant Divate Date: Thu, 21 May 2026 09:51:40 -0400 Subject: [PATCH 1/2] Add the shellhub-agent recipe compatible with kirkstone LTS release of yocto project --- ...ent_0.22.0.bb => shellhub-agent_0.11.0.bb} | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) rename recipes-core/shellhub/{shellhub-agent_0.22.0.bb => shellhub-agent_0.11.0.bb} (55%) diff --git a/recipes-core/shellhub/shellhub-agent_0.22.0.bb b/recipes-core/shellhub/shellhub-agent_0.11.0.bb similarity index 55% rename from recipes-core/shellhub/shellhub-agent_0.22.0.bb rename to recipes-core/shellhub/shellhub-agent_0.11.0.bb index 9ec0c05..c461437 100644 --- a/recipes-core/shellhub/shellhub-agent_0.22.0.bb +++ b/recipes-core/shellhub/shellhub-agent_0.11.0.bb @@ -1,11 +1,16 @@ SUMMARY = "ShellHub Agent" HOMEPAGE = "https://shellhub.io" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${S}/src/${GO_IMPORT}/LICENSE.md;md5=fa818a259cbed7ce8bc2a22d35a464fc" + +GO_IMPORT = "github.com/shellhub-io/shellhub" +GO_INSTALL = "github.com/shellhub-io/shellhub/agent" + +LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE.md;md5=fa818a259cbed7ce8bc2a22d35a464fc" + DEPENDS = "libxcrypt" SRC_URI = " \ - git://github.com/shellhub-io/shellhub;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX} \ + git://github.com/shellhub-io/shellhub;protocol=https;nobranch=1;destsuffix=git/src/${GO_IMPORT} \ file://shellhub-agent.initd \ file://shellhub-agent.profile.d \ file://shellhub-agent.service \ @@ -13,11 +18,13 @@ SRC_URI = " \ file://shellhub-agent.wrapper.in \ " -SRCREV = "eb710a0eaa04469b782b2f2534071d07fbdff3d3" +# v0.11.0: latest practical ShellHub Agent target for stock Yocto kirkstone / Go 1.17 +SRCREV = "0189c253e45ab63026c3c18b786db22949e4ba86" + +S = "${WORKDIR}/git" inherit go systemd update-rc.d -# Avoid dynamic linking as it causes segfault GO_LINKSHARED = "" SYSTEMD_SERVICE:${PN} = "${PN}.service" @@ -25,11 +32,7 @@ SYSTEMD_SERVICE:${PN} = "${PN}.service" INITSCRIPT_NAME = "${PN}" INITSCRIPT_PARAMS = "defaults 99" -GO_IMPORT = "github.com/shellhub-io/shellhub" - -GO_INSTALL = "github.com/shellhub-io/shellhub/agent" - -GO_LDFLAGS = '-ldflags="${GO_RPATH} ${GO_LINKMODE} -X main.AgentVersion=v${PV} -extldflags '${GO_EXTLDFLAGS}'"' +GO_LDFLAGS = '-ldflags="${GO_RPATH} ${GO_LINKMODE} -X main.AgentVersion=v0.11.0 -extldflags '${GO_EXTLDFLAGS}'"' GOBUILDFLAGS:append = " -modcacherw" @@ -37,34 +40,36 @@ do_compile[dirs] += "${B}/src/${GO_IMPORT}/agent" do_compile[network] = "1" do_install:append() { - # We name the binary as shellhub-agent - mkdir -p ${D}${libexecdir}/shellhub/bin/ - mv ${D}${bindir}/agent ${D}${libexecdir}/shellhub/bin/shellhub-agent + install -d ${D}${libexecdir}/shellhub/bin/ + + if [ -f ${D}${bindir}/agent ]; then + mv ${D}${bindir}/agent ${D}${libexecdir}/shellhub/bin/shellhub-agent + else + bbfatal "shellhub agent binary not found at ${D}${bindir}/agent" + fi - # Handle init system integration if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -Dm 0644 ${UNPACKDIR}/shellhub-agent.service ${D}${systemd_unitdir}/system/shellhub-agent.service + install -Dm 0644 ${WORKDIR}/shellhub-agent.service ${D}${systemd_unitdir}/system/shellhub-agent.service sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/shellhub-agent.service fi + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then - install -Dm 0755 ${UNPACKDIR}/shellhub-agent.initd ${D}/${sysconfdir}/init.d/shellhub-agent - install -Dm 0755 ${UNPACKDIR}/shellhub-agent.start ${D}${libdir}/shellhub-agent/shellhub-agent.start + install -Dm 0755 ${WORKDIR}/shellhub-agent.initd ${D}${sysconfdir}/init.d/shellhub-agent + install -Dm 0755 ${WORKDIR}/shellhub-agent.start ${D}${libdir}/shellhub-agent/shellhub-agent.start sed -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBDIR@,${libdir},g' \ -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ -e 's,@SYSCONFDIR@,${sysconfdir},g' \ - -i ${D}/${sysconfdir}/init.d/shellhub-agent + -i ${D}${sysconfdir}/init.d/shellhub-agent fi - # Shell prompt handling - install -Dm 0755 ${UNPACKDIR}/shellhub-agent.profile.d ${D}/${sysconfdir}/profile.d/shellhub-agent.sh + install -Dm 0755 ${WORKDIR}/shellhub-agent.profile.d ${D}${sysconfdir}/profile.d/shellhub-agent.sh - # Script that allow to run sh files before shellhub-agent binary start - install -Dm 0755 ${UNPACKDIR}/shellhub-agent.wrapper.in ${D}${bindir}/shellhub-agent + install -Dm 0755 ${WORKDIR}/shellhub-agent.wrapper.in ${D}${bindir}/shellhub-agent sed -e 's,@LIBEXEC@,${libexecdir},g' -i ${D}${bindir}/shellhub-agent } -RDEPENDS:${PN} += "\ +RDEPENDS:${PN} += " \ openssh-scp \ shellhub-agent-config \ shadow \ @@ -72,3 +77,4 @@ RDEPENDS:${PN} += "\ RRECOMMENDS:${PN} += "ca-certificates" RDEPENDS:${PN}-dev += "bash" + From 772c00233d3961032392a8d9a9c6ba6dd0d83d2f Mon Sep 17 00:00:00 2001 From: Prashant Divate Date: Thu, 21 May 2026 10:01:29 -0400 Subject: [PATCH 2/2] Update the layer compatibility flag to add kirkstone --- conf/layer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/layer.conf b/conf/layer.conf index d8f15a5..f0d1bbb 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -12,4 +12,4 @@ BBFILE_PRIORITY_shellhub = "6" SIGGEN_EXCLUDERECIPES_ABISAFE += "shellhub-agent-config" LAYERDEPENDS_shellhub = "core" -LAYERSERIES_COMPAT_shellhub = "styhead whinlatter wrynose" +LAYERSERIES_COMPAT_shellhub = "kirkstone styhead whinlatter wrynose"