2005-10-10 08:59:09 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org>
|
|
|
|
|
|
|
|
# PROVIDE: i2p
|
2005-10-10 13:05:04 +02:00
|
|
|
# REQUIRE: LOGIN
|
2006-02-20 21:47:50 +01:00
|
|
|
# KEYWORD: shutdown
|
2005-10-10 08:59:09 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Add the following lines to /etc/rc.conf to enable i2p:
|
|
|
|
#
|
2011-05-15 04:49:17 +02:00
|
|
|
# i2p_enable="YES"
|
|
|
|
# i2p_user
|
2005-10-10 08:59:09 +02:00
|
|
|
|
2010-03-27 01:15:24 +01:00
|
|
|
. /etc/rc.subr
|
2005-10-10 08:59:09 +02:00
|
|
|
|
|
|
|
name="i2p"
|
2012-01-14 09:57:23 +01:00
|
|
|
rcvar=i2p_enable
|
2005-10-10 08:59:09 +02:00
|
|
|
command="%%PREFIX%%/sbin/i2prouter"
|
|
|
|
extra_commands="install uninstall update"
|
|
|
|
|
|
|
|
i2p_check_vars()
|
|
|
|
{
|
|
|
|
if [ -z "${i2p_user}" ]; then
|
|
|
|
i2p_user=$(whoami)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x${i2p_user}" = "xroot" ]; then
|
|
|
|
err 1 "You have to set i2p_user to a non-root user for security reasons"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
start_cmd="start_cmd"
|
|
|
|
stop_cmd="stop_cmd"
|
|
|
|
status_cmd="status_cmd"
|
|
|
|
restart_cmd="restart_cmd"
|
|
|
|
install_cmd="install_cmd"
|
|
|
|
uninstall_cmd="uninstall_cmd"
|
|
|
|
update_cmd="update_cmd"
|
|
|
|
|
|
|
|
generic_cmd()
|
|
|
|
{
|
|
|
|
i2p_check_vars
|
|
|
|
su -l ${i2p_user} -c "${command} ${1}"
|
|
|
|
}
|
|
|
|
|
|
|
|
start_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd start
|
|
|
|
}
|
|
|
|
|
|
|
|
stop_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd stop
|
|
|
|
}
|
|
|
|
|
|
|
|
status_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd status
|
|
|
|
}
|
|
|
|
|
|
|
|
restart_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd restart
|
|
|
|
}
|
|
|
|
|
|
|
|
install_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd install
|
|
|
|
}
|
|
|
|
|
|
|
|
uninstall_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd uninstall
|
|
|
|
}
|
|
|
|
|
|
|
|
update_cmd()
|
|
|
|
{
|
|
|
|
generic_cmd update
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config "${name}"
|
|
|
|
: ${i2p_enable="NO"}
|
|
|
|
: ${i2p_user=""}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|