diff --git a/.github/workflows/oxen-node-openrc.yml b/.github/workflows/oxen-node-openrc.yml new file mode 100644 index 0000000000..52db9414b4 --- /dev/null +++ b/.github/workflows/oxen-node-openrc.yml @@ -0,0 +1,47 @@ + +name: Test for OpenRC script 'oxen-node' +on: + pull_request: + types: [synchronize, opened, reopened, ready_for_review] + paths: + - 'debian/oxen-node.openrc' +env: + CLICOLOR_FORCE: 1 +jobs: + ci: + runs-on: ubuntu-latest + container: debian:unstable + steps: + - name: Installing dependencies.. + run: | + apt-get update + apt-get install curl lsb-release --yes + curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg + echo "deb https://deb.oxen.io $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/oxen.list + # Required to pre-seed as the oxend requires set IP + echo "oxen-service-node oxen-service-node/ip-address string $(curl ifconfig.me)" | debconf-set-selections + apt-get update + apt-get install openrc oxen-service-node --yes + - name: Pulling git dir.. + uses: actions/checkout@v2 + - name: Testing the service file.. + run: | + cp "$GITHUB_WORKSPACE/debian/oxen-node.openrc" /etc/init.d/oxen-node + service oxen-node status || true + service oxen-node start + service oxen-node status + service oxen-node stop + service oxen-node status || true + shellcheck: + runs-on: ubuntu-latest + container: debian:unstable + steps: + - name: Installing dependencies.. + run: | + apt-get update + apt-get install shellcheck --yes + - name: Pulling git dir.. + uses: actions/checkout@v2 + - name: Lint the service file.. + run: | + shellcheck --external-sources --shell=sh "$GITHUB_WORKSPACE/debian/oxen-node.openrc" diff --git a/debian/oxend.oxen-node.init b/debian/oxend.oxen-node.init new file mode 100644 index 0000000000..7f09265215 --- /dev/null +++ b/debian/oxend.oxen-node.init @@ -0,0 +1,31 @@ +#!/bin/sh +# shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017 +# shellcheck disable=SC2034 # Krey: OpenRC is using variables that are not expected to be set +# Generated by sysd2v v0.3 -- http://www.trek.eu.org/devel/sysd2v +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script +fi +### BEGIN INIT INFO +# Provides: oxen-node +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $network +# Should-Stop: $network +# X-Start-Before: loki-storage +# X-Stop-After: loki-storage +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: Oxen network node +### END INIT INFO +set -a +TERM=xterm +set +a + +DESC="oxen-node" +DAEMON="/usr/bin/oxend" +DAEMON_ARGS="--non-interactive --config-file /etc/oxen/oxen.conf" +PIDFILE="/var/run/oxen-node.pid" +START_ARGS="--user _loki --chuid _loki --chdir /var/lib/oxen --background --make-pidfile --notify-await" # --notify-timeout infinity +STOP_ARGS="--user _loki" + diff --git a/debian/rules b/debian/rules index cff67c4343..4fbf5d3e95 100755 --- a/debian/rules +++ b/debian/rules @@ -39,3 +39,6 @@ override_dh_strip: override_dh_installsystemd: dh_installsystemd --name=oxen-testnet-node --no-enable --no-start dh_installsystemd --name=oxen-node + +override_dh_installinit: + dh_installinit --name=oxen-node