diff --git a/recipes-core/go-bob-firewall/files/go-bob-firewall-init b/recipes-core/go-bob-firewall/files/go-bob-firewall-init new file mode 100644 index 0000000..9f68236 --- /dev/null +++ b/recipes-core/go-bob-firewall/files/go-bob-firewall-init @@ -0,0 +1,57 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: go-bob-firewall +# Required-Start: $network $remote_fs $syslog +# Required-Stop: $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start Bob Firewall at boot time +# Description: Enable Bob Firewall service. +### END INIT INFO + +DAEMON=/usr/bin/go-bob-firewall +NAME=go-bob-firewall +DESC="Bob Firewall" +PIDFILE=/var/run/$NAME.pid +LOGFILE=/var/log/$NAME.log + +start() { + echo -n "Starting $DESC: " + echo "Starting $DESC" > /var/volatile/system-api.fifo + start-stop-daemon -S --make-pidfile -p $PIDFILE -m -b -a $DAEMON -- $DAEMON_ARGS > $LOGFILE 2>&1 + echo "$NAME." +} + +stop() { + echo -n "Stopping $DESC: " + echo "Stopping $DESC" > /var/volatile/system-api.fifo + start-stop-daemon --stop --quiet --pidfile $PIDFILE + rm -f $PIDFILE + echo "$NAME." +} + +restart() { + echo "Restarting $DESC: " + echo "Restarting $DESC" > /var/volatile/system-api.fifo + stop + sleep 1 + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-core/go-bob-firewall/go-bob-firewall_dev.bb b/recipes-core/go-bob-firewall/go-bob-firewall_dev.bb new file mode 100644 index 0000000..af742ea --- /dev/null +++ b/recipes-core/go-bob-firewall/go-bob-firewall_dev.bb @@ -0,0 +1,33 @@ +SUMMARY = "Bob Firewall Implementation in Go" +HOMEPAGE = "https://github.com/flashbots/go-bob-firewall" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://src/${GO_WORKDIR}/LICENSE;md5=c7bc88e866836b5160340e6c3b1aaa10" + +inherit go-mod update-rc.d + +INITSCRIPT_NAME = "go-bob-firewall-init" +INITSCRIPT_PARAMS = "defaults 86" + +GO_IMPORT = "github.com/flashbots/go-bob-firewall" +SRC_URI = "git://${GO_IMPORT};protocol=https;branch=main \ + file://go-bob-firewall-init" +SRCREV = "${AUTOREV}" + +GO_INSTALL = "${GO_IMPORT}/cmd/httpserver" +GO_LINKSHARED = "" + +INHIBIT_PACKAGE_DEBUG_SPLIT = '1' +INHIBIT_PACKAGE_STRIP = '1' +GO_EXTRA_LDFLAGS:append = " -s -w -buildid= -X ${GO_IMPORT}/common.Version=${PV}" + +do_compile[network] = "1" + +do_install:append() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + + # Rename the binary + mv ${D}${bindir}/httpserver ${D}${bindir}/go-bob-firewall +} + +FILES:${PN} = "${sysconfdir}/init.d/${INITSCRIPT_NAME} ${bindir}/go-bob-firewall"