From 95b77b6d4d33244dbbf480a648bafffc133c5b42 Mon Sep 17 00:00:00 2001 From: Julien Cassette Date: Sat, 28 Jan 2023 20:07:09 +0100 Subject: [PATCH] net/storj: add an rc script for storagenode This creates a user, folder and rc script to run storagenode as a service. --- GIDs | 2 +- UIDs | 2 +- net/storj/Makefile | 8 +++++++- net/storj/files/storagenode.in | 31 +++++++++++++++++++++++++++++++ net/storj/pkg-plist | 5 +++++ 5 files changed, 45 insertions(+), 3 deletions(-) create mode 100755 net/storj/files/storagenode.in diff --git a/GIDs b/GIDs index 23d9c2564c1b..c4e72545a068 100644 --- a/GIDs +++ b/GIDs @@ -809,7 +809,7 @@ opensearch:*:855: # free: 865 # free: 866 # free: 867 -# free: 868 +storj:*:868: keyd:*:869: buildbot:*:870: # free: 871 diff --git a/UIDs b/UIDs index b41b0f6ccb9c..4ab3c2852bfa 100644 --- a/UIDs +++ b/UIDs @@ -814,7 +814,7 @@ opensearch:*:855:855::0:0:opensearch user:/nonexistent:/usr/sbin/nologin # free: 865 # free: 866 # free: 867 -# free: 868 +storj:*:868:868::0:0:Storj Daemon User:/var/db/storj:/usr/sbin/nologin keyd:*:869:869::0:0:Key remapping daemon for evdev:/nonexistent:/usr/sbin/nologin buildbot:*:870:870::0:0:Buildbot user:/var/db/buildbot:/usr/sbin/nologin archiva:*:871:871::0:0:Apache Archiva Daemon:/nonexistent:/usr/sbin/nologin diff --git a/net/storj/Makefile b/net/storj/Makefile index e89e24af68b2..22b1003f4b2e 100644 --- a/net/storj/Makefile +++ b/net/storj/Makefile @@ -1,6 +1,6 @@ PORTNAME= storj PORTVERSION= 1.68.2 -PORTREVISION= 1 +PORTREVISION= 2 DISTVERSIONPREFIX= v CATEGORIES= net @@ -21,6 +21,12 @@ STORJ_CMDS= certificates crashcollect identity inspector metric-receiver \ GO_TARGET= ${STORJ_CMDS:S,^,./cmd/,} +USERS= storj +GROUPS= storj +USE_RC_SUBR= storagenode +SUB_LIST= USER=${USERS} GROUP=${GROUPS} +PLIST_SUB= USER=${USERS} GROUP=${GROUPS} + post-stage: # Avoid conflict with `graphics/mesa-demos' @${MV} ${STAGEDIR}${PREFIX}/bin/identity \ diff --git a/net/storj/files/storagenode.in b/net/storj/files/storagenode.in new file mode 100755 index 000000000000..b59435178716 --- /dev/null +++ b/net/storj/files/storagenode.in @@ -0,0 +1,31 @@ +#!/bin/sh + +# PROVIDE: storagenode +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +: ${storagenode_enable:=NO} +: ${storagenode_config_dir:=/var/db/storj/storagenode} +: ${storagenode_identity_dir:=/var/db/storj/identity/storagenode} +: ${storagenode_user:=%%USER%%} +: ${storagenode_group:=%%GROUP%%} + +name="storagenode" +rcvar=storagenode_enable +pidfile="/var/run/storagenode.pid" +command="/usr/sbin/daemon" +command_args="-r -f -P ${pidfile} \ + %%PREFIX%%/bin/storagenode run \ + --confir-dir ${storagenode_config_dir} \ + --identity-dir ${storagenode_identity_dir}" + +start_precmd=storagenode_prestart +storagenode_prestart() +{ + install -g ${storagenode_group} -o ${storagenode_user} -- /dev/null ${pidfile} +} + +load_rc_config $name +run_rc_command "$1" diff --git a/net/storj/pkg-plist b/net/storj/pkg-plist index 01a5dc51cd1a..74906cc1f381 100644 --- a/net/storj/pkg-plist +++ b/net/storj/pkg-plist @@ -11,3 +11,8 @@ bin/storj-identity bin/storj-sim bin/uplink bin/versioncontrol +@owner %%USER%% +@group %%GROUP%% +@dir /var/db/storj/identity +@dir /var/db/storj/storagenode +@dir /var/db/storj