Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellhub-agent: Update version 0.13.6 -> 0.14.1 #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions recipes-core/shellhub/shellhub-agent_0.14.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
SUMMARY = "ShellHub Agent"
HOMEPAGE = "https://shellhub.io"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${S}/src/${GO_IMPORT}/LICENSE.md;md5=fa818a259cbed7ce8bc2a22d35a464fc"
DEPENDS = "libxcrypt"

SRC_URI = " \
git://github.com/shellhub-io/shellhub;protocol=https;nobranch=1 \
file://shellhub-agent.initd \
file://shellhub-agent.profile.d \
file://shellhub-agent.service \
file://shellhub-agent.start \
file://shellhub-agent.wrapper.in \
"

SRCREV="7eba1ab3339b07bb4765e164ee3d81412bf8ce68"

inherit go systemd update-rc.d

# Avoid dynamic linking as it causes segfault
GO_LINKSHARED = ""

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}'"'

GOBUILDFLAGS:append = " -modcacherw"

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

# Handle init system integration
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
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 ${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
fi

# Shell prompt handling
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 ${WORKDIR}/shellhub-agent.wrapper.in ${D}${bindir}/shellhub-agent
sed -e 's,@LIBEXEC@,${libexecdir},g' -i ${D}${bindir}/shellhub-agent
}

RDEPENDS:${PN} += "\
openssh-scp \
shellhub-agent-config \
shadow \
"

RRECOMMENDS:${PN} += "ca-certificates"
RDEPENDS:${PN}-dev += "bash"