summaryrefslogtreecommitdiff
path: root/sysutils/ipfs-go/files/ipfs-go.in
blob: e867bffd29b27fbedbbf5eb1a50fdd250d5e9575 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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"