Added
Link Here
|
1 |
#!/bin/sh |
2 |
|
3 |
# $FreeBSD$ |
4 |
# |
5 |
# PROVIDE: kineto |
6 |
# REQUIRE: LOGIN |
7 |
# KEYWORD: shutdown |
8 |
# |
9 |
# Add these lines to /etc/rc.conf.local or /etc/rc.conf |
10 |
# to enable this service: |
11 |
# |
12 |
# kineto_enable (bool): Set to "NO" by default. |
13 |
# Set it to "YES" to enable kineto. |
14 |
# kineto_root (str): Default is gemini://localhost |
15 |
# The gemini root proxy URL |
16 |
# kineto_bind (str): The bind address |
17 |
# unset by default - will bind to :8080 |
18 |
# kineto_css_path (str): File system path of CSS stylesheet |
19 |
# Unset by default |
20 |
# kineto_css_url (str): URL of CSS stylesheet |
21 |
# Unset by default |
22 |
# kineta_user (str): Default "nobody" |
23 |
# The kineto process user |
24 |
|
25 |
. /etc/rc.subr |
26 |
|
27 |
name=kineto |
28 |
desc="HTTP to Gemini proxy" |
29 |
rcvar=kineto_enable |
30 |
|
31 |
load_rc_config $name |
32 |
|
33 |
: ${kineto_enable:=NO} |
34 |
: ${kineto_root=gemini://localhost} |
35 |
: ${kineto_user=nobody} |
36 |
|
37 |
command="%%PREFIX%%/bin/${name}" |
38 |
command_args="${kineto_root}" |
39 |
pidfile="/var/run/${name}.pid" |
40 |
|
41 |
start_precmd="${name}_setflags" |
42 |
start_cmd="${name}_start" |
43 |
|
44 |
kineto_setflags() |
45 |
{ |
46 |
rc_flags="${kineto_bind:+-b $kineto_bind }${kineto_css_path:+-s $kineto_css_path }${kineto_css_url:+-e $kineto_css_url }${rc_flags}" |
47 |
} |
48 |
|
49 |
kineto_start() |
50 |
{ |
51 |
check_startmsgs && echo "Starting ${name}." |
52 |
/usr/sbin/daemon -S -s info -l daemon -T $name -u "${kineto_user}" -p "${pidfile}" $command $rc_flags $command_args |
53 |
} |
54 |
|
55 |
run_rc_command "$1" |