summaryrefslogtreecommitdiff
path: root/net/ushare/files/patch-ushare
blob: 5fb4752713b106ed78616bb1edbb13ce06c8b825 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--- scripts/ushare.orig	Sun Feb 25 16:43:51 2007
+++ scripts/ushare	Sun Feb 25 20:34:06 2007
@@ -1,74 +1,29 @@
-#!/bin/sh -e
-### BEGIN INIT INFO
-# Required-Start: $local_fs $syslog
-# Required-Stop:
-# Default-Start:  2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: start and stop ushare
-# Description: 
-### END INIT INFO
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/bin/ushare
-NAME=ushare
-DESC="uShare UPnP A/V Media Server"
-PIDFILE=/var/run/ushare.pid
-CONFIGFILE=/etc/ushare.conf
-
-# abort if no executable exists
-[ -x $DAEMON ] || exit 0
-
-# Get lsb functions
-. /lib/lsb/init-functions
-. /etc/default/rcS
-
-[ -f /etc/default/ushare ] && . /etc/default/ushare
-
-checkpid() {
-  [ -e $PIDFILE ] || touch $PIDFILE
-}
-
-check_shares() {
-  if [ -r "$CONFIGFILE" ]; then
-    . $CONFIGFILE
-    [ -n "$USHARE_DIR" ] && return 0
-  fi
-  return 1
-}
-
-case "$1" in
-  start)
-    log_daemon_msg "Starting $DESC: $NAME"
-    if ! $(check_shares); then
-      log_warning_msg "No shares avalaible ..."
-      log_end_msg 0
-    else
-      checkpid
-      start-stop-daemon --start --quiet --background --oknodo \
-        --make-pidfile --pidfile $PIDFILE \
-        --exec $DAEMON -- $USHARE_OPTIONS
-      log_end_msg $?
-    fi
-  ;;
-  stop)
-    log_daemon_msg "Stopping $DESC: $NAME"
-    start-stop-daemon --stop --signal 2 --quiet --oknodo --pidfile $PIDFILE
-    log_end_msg $?
-  ;;
-  reload|force-reload)
-    log_daemon_msg "Reloading $DESC: $NAME"
-    start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
-    log_end_msg $?
-  ;;
-  restart)
-    $0 stop
-    $0 start
-  ;;
-  *)
-    N=/etc/init.d/$NAME
-    log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}"
-    exit 1
-  ;;
-esac
+#!/bin/sh
+#
+# ushare.sh for rc.d usage (c) 2007 Volker Theile <votdev@gmx.de>.
+#
+
+# PROVIDE: ushare
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `ushare':
+#
+#ushare_enable="YES"
+
+. "/etc/rc.subr"
+
+name=ushare
+rcvar=`set_rcvar`
+
+command="/usr/local/bin/$name"
+command_args="--daemon"
+required_files="/usr/local/etc/$name.conf"
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${ushare_enable="NO"}
+: ${ushare_flags=""}
 
-exit 0
+run_rc_command "$1"