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)
This commit is contained in:
parent
518051111c
commit
d06b7d37b9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=491652
@ -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>
|
||||
|
@ -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"
|
||||
|
||||
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"
|
||||
|
10
sysutils/ipfs-go/files/patch-version.go
Normal file
10
sysutils/ipfs-go/files/patch-version.go
Normal file
@ -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 + "/"
|
@ -2,4 +2,3 @@ bin/ipfs-go
|
||||
@owner %%IPFS_USER%%
|
||||
@group %%IPFS_GROUP%%
|
||||
@dir %%IPFS_HOME%%
|
||||
@dir %%IPFS_LOGDIR%%
|
||||
|
Loading…
Reference in New Issue
Block a user