aboutsummaryrefslogtreecommitdiff
path: root/sysutils/ipfs-go/files/ipfs-go.in
blob: f7a16f796113901016c23322dbc510a8019ae01d (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
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# PROVIDE: ipfs_go
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown

# 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
rcvar=ipfs_go_enable
load_rc_config $name

: ${ipfs_go_enable:="NO"}
: ${ipfs_go_user:="%%IPFS_USER%%"}
: ${ipfs_go_group:="%%IPFS_GROUP%%"}
: ${ipfs_go_path:="%%IPFS_HOME%%/.ipfs"}
: ${ipfs_go_syslog_priority:="info"}
: ${ipfs_go_syslog_facility:="daemon"}
: ${ipfs_go_syslog_tag:="ipfs-go"}

pidfile="/var/run/${name}.pid"

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_startprecmd() {
  if [ ! -e "${pidfile}" ]; then
    install -g ${ipfs_go_group} -o ${ipfs_go_user} -- /dev/null "${pidfile}"
  fi
}

run_rc_command "$1"