blob: dd544f00a752d6c10a7c2b9474b92112da42a229 (
plain)
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
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop status init"
depend() {
need net tuncfg
}
start() {
check_config
ebegin "Starting hamachi"
start-stop-daemon --quiet --start -c ${USER} \
--exec /usr/bin/hamachi -- \
-c $CONFDIR start &>${LOG} &
result=$?
if [ $result == 0 ]; then
sleep 1
chown -R $USER:$GROUP $CONFDIR/ipc_sock
chmod g+rwx $CONFDIR/ipc_sock
/usr/bin/hamachi -c $CONFDIR login
if [ -z "$(/usr/bin/hamachi -c $CONFDIR | grep 'logged in')" ]; then
result=1
/usr/bin/hamachi -c $CONFDIR stop &>${LOG}
fi
fi;
eend $result
}
stop() {
ebegin "Stopping hamachi"
/usr/bin/hamachi -c $CONFDIR logout &>${LOG}
/usr/bin/hamachi -c $CONFDIR stop &>${LOG}
eend $?
}
init() {
ebegin "Making initial configuration"
/usr/bin/hamachi-init -c $CONFDIR 2>&1 >/dev/null
chown -R $USER:$GROUP $CONFDIR
chmod g+rx $CONFDIR
eend $?
}
check_config() {
if [ ! -d $CONFDIR ] ; then
einfo "It seems you don't have configured hamachi yet. Running init now"
init
fi
}
status() {
service_started "${myservice}" || return 0
/usr/bin/hamachi -c $CONFDIR
/usr/bin/hamachi -c $CONFDIR list
}
|