Rev 15 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15 | Rev 33 | ||
---|---|---|---|
1 | #!/bin/sh |
1 | #!/bin/sh |
2 | ### BEGIN INIT INFO |
2 | ### BEGIN INIT INFO |
3 | # Provides: oidentd ident-server |
3 | # Provides: oidentd ident-server |
4 | # Required-Start: $remote_fs $syslog |
4 | # Required-Start: $remote_fs $syslog |
5 | # Required-Stop: $remote_fs $syslog |
5 | # Required-Stop: $remote_fs $syslog |
6 | # Should-Start: |
6 | # Should-Start: |
7 | # Should-Stop: |
7 | # Should-Stop: |
8 | # Default-Start: 2 3 4 5 |
8 | # Default-Start: 2 3 4 5 |
9 | # Default-Stop: 0 1 6 |
9 | # Default-Stop: 0 1 6 |
10 | # Short-Description: replacement ident daemon |
10 | # Short-Description: replacement ident daemon |
11 | # Description: oidentd is a replacement ident daemon |
11 | # Description: oidentd is a replacement ident daemon |
12 | ### END INIT INFO |
12 | ### END INIT INFO |
13 | 13 | ||
14 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
14 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
15 | OIDENTD=/usr/sbin/oidentd |
15 | OIDENTD=/usr/sbin/oidentd |
16 | 16 | ||
17 | # See if the daemons are there |
17 | # See if the daemons are there |
18 | test -f ${OIDENTD} || exit 0 |
18 | test -f ${OIDENTD} || exit 0 |
19 | 19 | ||
20 | # oidentd configuration |
20 | # oidentd configuration |
21 | OIDENT_OPTIONS="" |
21 | OIDENT_OPTIONS="" |
22 | OIDENT_USER="nobody" |
22 | OIDENT_USER="nobody" |
23 | OIDENT_GROUP="nogroup" |
23 | OIDENT_GROUP="nogroup" |
24 | test -f /etc/default/oidentd && . /etc/default/oidentd |
24 | test -f /etc/default/oidentd && . /etc/default/oidentd |
25 | 25 | ||
26 | . /lib/lsb/init-functions |
26 | . /lib/lsb/init-functions |
27 | 27 | ||
28 | if [ "${OIDENT_BEHIND_PROXY}" = "yes" ]; then |
28 | if [ "${OIDENT_BEHIND_PROXY}" = "yes" ]; then |
29 | # If we have a default router, then allow it to proxy auth requests to us |
- | |
30 | if [ -x /bin/netstat ] && [ -x /usr/bin/awk ]; then |
- | |
31 | GATEWAY=`netstat -nr | awk '/^0.0.0.0/{print $2;}'` |
- | |
32 | elif [ -x /bin/ip ] && [ -x /usr/bin/awk ]; then |
- | |
33 | GATEWAY=`ip route show 0.0.0.0/0 | awk '/^default via /{print $3}'` |
- | |
34 | fi |
- | |
35 | if [ -n "${GATEWAY}" ]; then |
- | |
36 | OIDENT_OPTIONS="${OIDENT_OPTIONS} -P ${GATEWAY}" |
29 | OIDENT_OPTIONS="${OIDENT_OPTIONS} -P `ip route show to exact 0/0 | awk '{print $3}'`" |
37 | fi |
- | |
38 | fi |
30 | fi |
39 | 31 | ||
40 | 32 | ||
41 | OPTIONS="${OIDENT_OPTIONS} -u ${OIDENT_USER} -g ${OIDENT_GROUP}" |
33 | OPTIONS="${OIDENT_OPTIONS} -u ${OIDENT_USER} -g ${OIDENT_GROUP}" |
42 | 34 | ||
43 | case "$1" in |
35 | case "$1" in |
44 | start) |
36 | start) |
45 | log_daemon_msg "Starting ident daemon" "oidentd" |
37 | log_daemon_msg "Starting ident daemon" "oidentd" |
46 | start-stop-daemon --start --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS} |
38 | start-stop-daemon --start --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS} |
47 | log_end_msg $? |
39 | log_end_msg $? |
48 | ;; |
40 | ;; |
49 | stop) |
41 | stop) |
50 | log_daemon_msg "Stopping ident daemon" "oidentd" |
42 | log_daemon_msg "Stopping ident daemon" "oidentd" |
51 | start-stop-daemon --stop --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS} |
43 | start-stop-daemon --stop --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS} |
52 | log_end_msg $? |
44 | log_end_msg $? |
53 | ;; |
45 | ;; |
54 | reload|restart|force-reload) |
46 | reload|restart|force-reload) |
55 | log_daemon_msg "Restarting ident daemon" "oidentd" |
47 | log_daemon_msg "Restarting ident daemon" "oidentd" |
56 | start-stop-daemon --stop --quiet --exec ${OIDENTD} -- ${OPTIONS} |
48 | start-stop-daemon --stop --quiet --exec ${OIDENTD} -- ${OPTIONS} |
57 | sleep 2 |
49 | sleep 2 |
58 | start-stop-daemon --start --quiet --exec ${OIDENTD} -- ${OPTIONS} |
50 | start-stop-daemon --start --quiet --exec ${OIDENTD} -- ${OPTIONS} |
59 | log_end_msg $? |
51 | log_end_msg $? |
60 | ;; |
52 | ;; |
61 | status) |
53 | status) |
62 | status_of_proc "$OIDENTD" "oidentd" && exit 0 || exit $? |
54 | status_of_proc "$OIDENTD" "oidentd" && exit 0 || exit $? |
63 | ;; |
55 | ;; |
64 | *) |
56 | *) |
65 | log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}" |
57 | log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}" |
66 | exit 1 |
58 | exit 1 |
67 | ;; |
59 | ;; |
68 | esac |
60 | esac |
69 | 61 | ||
70 | exit 0 |
62 | exit 0 |
71 | 63 |