ports/sysutils/ipfs-go/files/ipfs-go.in
Kris Moore 3d1e4c998c - Update to 0.3.9
- Fix rc.d script starting at boot
- Update default datastore location to match commands default

Approved by: Maintainer
2015-12-01 21:46:03 +00:00

38 lines
689 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ipfs_go
# REQUIRE: NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# Define these ipfs_go_* variables in /etc/rc.conf[.local]:
#
# ipfs_go_enable="YES"
# ipfs_go_path="/tank/ipfs"
. /etc/rc.subr
: ${ipfs_go_enable:="NO"}
: ${ipfs_go_path:="/root/.ipfs"}
name=ipfs_go
rcvar=ipfs_go_enable
command="%%PREFIX%%/bin/ipfs-go"
start_precmd="ipfs_go_prestart"
start_cmd="ipfs_go_start"
ipfs_go_prestart() {
[ -d ${ipfs_go_path}/datastore ] || env IPFS_PATH=${ipfs_go_path} ${command} init
}
ipfs_go_start() {
echo running ${command} daemon
env IPFS_PATH=${ipfs_go_path} daemon -f ${command} daemon
}
load_rc_config $name
run_rc_command "$1"