aboutsummaryrefslogtreecommitdiff
path: root/sysutils/ipfs-go
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2019-01-30 19:22:53 +0000
committerSteve Wills <swills@FreeBSD.org>2019-01-30 19:22:53 +0000
commitd06b7d37b905ca5848afab4d929a3b7d876451b9 (patch)
treeee6c06bd8e48604962732d72475ea955121a960e /sysutils/ipfs-go
parent518051111c7da1b84f91c0240f7a637addef14a3 (diff)
downloadports-d06b7d37b905ca5848afab4d929a3b7d876451b9.tar.gz
ports-d06b7d37b905ca5848afab4d929a3b7d876451b9.zip
sysutils/ipfs-go: fix rc script
* Fix the rc script when default ipfs_go_path is used * Fix the logging by switching to uses the syslog logging in daemon * Switch the init to using the --init flag to the ipfs daemon command * Fixes the version string since the tarball provided by upstream doesn't match the tag for this release (has version string wrong) * Allow overriding IPFS_USER/GROUP/HOME at build time * Remove unnecessary BEFORE: LOGIN from rc script PR: 235222 Approved by: jhixson (maintainer)
Notes
Notes: svn path=/head/; revision=491652
Diffstat (limited to 'sysutils/ipfs-go')
-rw-r--r--sysutils/ipfs-go/Makefile15
-rw-r--r--sysutils/ipfs-go/files/ipfs-go.in55
-rw-r--r--sysutils/ipfs-go/files/patch-version.go10
-rw-r--r--sysutils/ipfs-go/pkg-plist1
4 files changed, 43 insertions, 38 deletions
diff --git a/sysutils/ipfs-go/Makefile b/sysutils/ipfs-go/Makefile
index 509a5bbde46d..eae8d63cfce6 100644
--- a/sysutils/ipfs-go/Makefile
+++ b/sysutils/ipfs-go/Makefile
@@ -3,7 +3,7 @@
PORTNAME= ipfs
DISTVERSIONPREFIX= v
DISTVERSION= 0.4.18
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= https://github.com/ipfs/go-ipfs/releases/download/v${DISTVERSION}/
PKGNAMESUFFIX= -go
@@ -29,16 +29,14 @@ USE_RC_SUBR= ${PORTNAME}${PKGNAMESUFFIX}
SUB_FILES= ${FULLNAME}
SUB_LIST= IPFS_USER=${IPFS_USER} \
IPFS_GROUP=${IPFS_GROUP} \
- IPFS_LOGDIR=${IPFS_LOGDIR}
+ IPFS_HOME=${IPFS_HOME}
PLIST_SUB= IPFS_USER=${IPFS_USER} \
IPFS_GROUP=${IPFS_GROUP} \
- IPFS_HOME=${IPFS_HOME} \
- IPFS_LOGDIR=${IPFS_LOGDIR}
+ IPFS_HOME=${IPFS_HOME}
-IPFS_USER= ${FULLNAME}
-IPFS_GROUP= ${FULLNAME}
-IPFS_HOME= /var/db/${PORTNAME}${PKGNAMESUFFIX}
-IPFS_LOGDIR= /var/log/${PORTNAME}${PKGNAMESUFFIX}
+IPFS_USER?= ${FULLNAME}
+IPFS_GROUP?= ${FULLNAME}
+IPFS_HOME?= /var/db/${FULLNAME}
USERS= ${IPFS_USER}
GROUPS= ${IPFS_GROUP}
@@ -47,7 +45,6 @@ FULLNAME= ${PORTNAME}${PKGNAMESUFFIX}
do-install:
@${MKDIR} ${STAGEDIR}${IPFS_HOME}
- @${MKDIR} ${STAGEDIR}${IPFS_LOGDIR}
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/ipfs ${STAGEDIR}${PREFIX}/bin/${PORTNAME}${PKGNAMESUFFIX}
.include <bsd.port.mk>
diff --git a/sysutils/ipfs-go/files/ipfs-go.in b/sysutils/ipfs-go/files/ipfs-go.in
index 0d6093303c80..be2e44671396 100644
--- a/sysutils/ipfs-go/files/ipfs-go.in
+++ b/sysutils/ipfs-go/files/ipfs-go.in
@@ -5,21 +5,22 @@
# PROVIDE: ipfs_go
# REQUIRE: DAEMON NETWORKING
-# BEFORE: LOGIN
# KEYWORD: shutdown
-# Add the following lines to /etc/rc.conf to enable ipfs_go:
-# ipfs_go_enable="YES"
-#
-# ipfs_go_enable (bool): Set to YES to enable ipfs_go
-# Default: NO
-# ipfs_go_user (str): ipfs_go daemon user
-# Default: %%IPFS_USER%%
-# ipfs_go_group (str): ipfs_go daemon group
-# Default: %%IPFS_GROUP%%
-# ipfs_go_path (str): ipfs_go ipfs repo path
-# Default: %%IPFS_HOME%%
-
+# ipfs_go_enable (bool): Set to NO by default
+# Set to YES to enable ipfs_go
+# ipfs_go_user (str): Set to %%IPFS_USER%% by default
+# Set it to ipfs_go daemon user
+# ipfs_go_group (str): Set to %%IPFS_GROUP%% by default
+# Set it to ipfs_go daemon group
+# ipfs_go_path (str): Set to %%IPFS_HOME%%/.ipfs by default
+# Set it to ipfs repo path
+# ipfs_go_syslog_priority (str): Set to "info" by default.
+# Set it to priority to be used by syslog
+# ipfs_go_syslog_facility (str): Set to "daemon" by default.
+# Set it to facility to be used by syslog
+# ipfs_go_syslog_tag (str): Set to "ipfs-go" by default.
+# Set it to tag to be used by syslog
. /etc/rc.subr
@@ -30,25 +31,23 @@ load_rc_config $name
: ${ipfs_go_enable:="NO"}
: ${ipfs_go_user:="%%IPFS_USER%%"}
: ${ipfs_go_group:="%%IPFS_GROUP%%"}
-: ${ipfs_go_path:="%%IPFS_HOME%%"}
+: ${ipfs_go_path:="%%IPFS_HOME%%/.ipfs"}
+: ${ipfs_go_syslog_priority:="info"}
+: ${ipfs_go_syslog_facility:="daemon"}
+: ${ipfs_go_syslog_tag:="ipfs-go"}
-logfile="%%IPFS_LOGDIR%%/${name}.log"
pidfile="/var/run/${name}.pid"
-command="%%PREFIX%%/bin/ipfs-go"
-start_precmd="ipfs_go_prestart"
-start_cmd="ipfs_go_start"
-ipfs_go_prestart() {
- install -d -o ${ipfs_go_user} -g ${ipfs_go_group} -m750 %%IPFS_LOGDIR%%
- [ -d ${ipfs_go_path} ] || /usr/bin/su - ${ipfs_go_user} -c "env IPFS_PATH=${ipfs_go_path} ${command} init"
-}
+command="/usr/sbin/daemon"
+command_args="-S -m 3 -s ${ipfs_go_syslog_priority} -l ${ipfs_go_syslog_facility} -T ${ipfs_go_syslog_tag} -p ${pidfile} /usr/bin/env IPFS_PATH=${ipfs_go_path} ${ipfs_go_env} %%PREFIX%%/bin/ipfs-go daemon --init --init-profile=server --migrate=true ${ipfs_go_args}"
+procname="%%PREFIX%%/bin/ipfs-go"
+
+start_precmd="ipfs_go_startprecmd"
-ipfs_go_start() {
- echo running ${command} daemon
- export USER=${ipfs_go_user}
- export HOME=$(echo ~%%IPFS_USER%%)
- export IPFS_PATH=${ipfs_go_path}
- /usr/sbin/daemon -p ${pidfile} -u ${ipfs_go_user} ${command} daemon >> ${logfile} 2>&1
+ipfs_go_startprecmd() {
+ if [ ! -e "${pidfile}" ]; then
+ install -g ${ipfs_go_group} -o ${ipfs_go_user} -- /dev/null "${pidfile}"
+ fi
}
run_rc_command "$1"
diff --git a/sysutils/ipfs-go/files/patch-version.go b/sysutils/ipfs-go/files/patch-version.go
new file mode 100644
index 000000000000..4f8e8b8b51e1
--- /dev/null
+++ b/sysutils/ipfs-go/files/patch-version.go
@@ -0,0 +1,10 @@
+--- version.go.orig 2019-01-26 18:22:10 UTC
++++ version.go
+@@ -4,6 +4,6 @@ package ipfs
+ var CurrentCommit string
+
+ // CurrentVersionNumber is the current application's version literal
+-const CurrentVersionNumber = "0.4.19-dev"
++const CurrentVersionNumber = "0.4.18"
+
+ const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
diff --git a/sysutils/ipfs-go/pkg-plist b/sysutils/ipfs-go/pkg-plist
index e2eb333c3a0b..c23ec5c6c712 100644
--- a/sysutils/ipfs-go/pkg-plist
+++ b/sysutils/ipfs-go/pkg-plist
@@ -2,4 +2,3 @@ bin/ipfs-go
@owner %%IPFS_USER%%
@group %%IPFS_GROUP%%
@dir %%IPFS_HOME%%
-@dir %%IPFS_LOGDIR%%