Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2019 19:22:53 +0000 (UTC)
From:      Steve Wills <swills@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r491652 - in head/sysutils/ipfs-go: . files
Message-ID:  <201901301922.x0UJMr0l021499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: swills
Date: Wed Jan 30 19:22:53 2019
New Revision: 491652
URL: https://svnweb.freebsd.org/changeset/ports/491652

Log:
  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)

Added:
  head/sysutils/ipfs-go/files/patch-version.go   (contents, props changed)
Modified:
  head/sysutils/ipfs-go/Makefile   (contents, props changed)
  head/sysutils/ipfs-go/files/ipfs-go.in
  head/sysutils/ipfs-go/pkg-plist   (contents, props changed)

Modified: head/sysutils/ipfs-go/Makefile
==============================================================================
--- head/sysutils/ipfs-go/Makefile	Wed Jan 30 19:22:34 2019	(r491651)
+++ head/sysutils/ipfs-go/Makefile	Wed Jan 30 19:22:53 2019	(r491652)
@@ -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>

Modified: head/sysutils/ipfs-go/files/ipfs-go.in
==============================================================================
--- head/sysutils/ipfs-go/files/ipfs-go.in	Wed Jan 30 19:22:34 2019	(r491651)
+++ head/sysutils/ipfs-go/files/ipfs-go.in	Wed Jan 30 19:22:53 2019	(r491652)
@@ -5,22 +5,23 @@
 
 # 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
 
 name=ipfs_go
@@ -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"
 
-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
+start_precmd="ipfs_go_startprecmd"
+
+ipfs_go_startprecmd() {
+  if [ ! -e "${pidfile}" ]; then
+    install -g ${ipfs_go_group} -o ${ipfs_go_user} -- /dev/null "${pidfile}"
+  fi
 }
 
 run_rc_command "$1"

Added: head/sysutils/ipfs-go/files/patch-version.go
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/ipfs-go/files/patch-version.go	Wed Jan 30 19:22:53 2019	(r491652)
@@ -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 + "/"

Modified: head/sysutils/ipfs-go/pkg-plist
==============================================================================
--- head/sysutils/ipfs-go/pkg-plist	Wed Jan 30 19:22:34 2019	(r491651)
+++ head/sysutils/ipfs-go/pkg-plist	Wed Jan 30 19:22:53 2019	(r491652)
@@ -2,4 +2,3 @@ bin/ipfs-go
 @owner %%IPFS_USER%%
 @group %%IPFS_GROUP%%
 @dir %%IPFS_HOME%%
-@dir %%IPFS_LOGDIR%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901301922.x0UJMr0l021499>