#!/bin/sh # # $FreeBSD: head/sysutils/ipfs-go/files/ipfs-go.in 491652 2019-01-30 19:22:53Z swills $ # # 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"