blob: 49ebf427d8a64295d1a797ab43c62b066a9dc1e2 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
#
# hamachi.sh - load tap driver and start Hamachi's tuncfg daemon
#
# (C) Copyright 2007 by Lapo Luchini
# (loosely based on ports/security/openvpn/files/openvpn.sh.in 1.9 by Matthias Andree)
#
# $FreeBSD$
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
# PROVIDE: hamachi
# REQUIRE: DAEMON
# KEYWORD: shutdown
#TODO: serve la KEYWORD:shutdown? che fa?
# Note that we deliberately refrain from unloading drivers.
. %%RC_SUBR%%
name="hamachi"
rcvar=`set_rcvar`
load_rc_config $name
: ${hamachi_enable="NO"}
command="%%PREFIX%%/sbin/hamachi-tuncfg"
start_precmd="hamachi_precmd"
hamachi_precmd() {
# FreeBSD <= 5.4 does not know kldstat's -m option
# FreeBSD >= 6.0 does not add debug.* sysctl information
# in the default build - we check both to keep things simple
if ! sysctl debug.if_tap_debug >/dev/null 2>&1 \
&& ! kldstat -m if_tap >/dev/null 2>&1 ; then
if ! kldload if_tap ; then
warn "Could not load tap module."
return 1
fi
fi
if ! sysctl compat.linux >/dev/null 2>&1 \
&& ! kldstat -m linuxelf >/dev/null 2>&1 ; then
if ! kldload linux ; then
warn "Could not load linux module."
return 1
fi
fi
return 0
}
run_rc_command "$1"
|