Rearrange debian/ directory
Emmanuel Bouthenot
5 years ago
0 | # Defaults for ffproxy initscript | |
1 | # sourced by /etc/init.d/ffproxy | |
2 | ||
3 | # yes = start on boot; no = don't start on boot | |
4 | FFPROXY_START=yes | |
5 | ||
6 | # yes = chroot daemon; no = no chroot | |
7 | FFPROXY_USECHROOT=yes | |
8 | ||
9 | # daemon will drop its privileges? | |
10 | FFPROXY_USER=nobody | |
11 | FFPROXY_GROUP=nogroup | |
12 | ||
13 | # Additional options that are passed to the Daemon | |
14 | FFPROXY_OPTS= |
0 | # Defaults for ffproxy initscript | |
1 | # sourced by /etc/init.d/ffproxy | |
2 | ||
3 | # yes = start on boot; no = don't start on boot | |
4 | FFPROXY_START=yes | |
5 | ||
6 | # yes = chroot daemon; no = no chroot | |
7 | FFPROXY_USECHROOT=yes | |
8 | ||
9 | # daemon will drop its privileges? | |
10 | FFPROXY_USER=nobody | |
11 | FFPROXY_GROUP=nogroup | |
12 | ||
13 | # Additional options that are passed to the Daemon | |
14 | FFPROXY_OPTS= |
0 | #!/bin/sh | |
1 | # | |
2 | # ffproxy This init.d script is used to start ffproxy | |
3 | # | |
4 | ||
5 | ### BEGIN INIT INFO | |
6 | # Provides: ffproxy | |
7 | # Required-Start: $remote_fs $network $syslog | |
8 | # Required-Stop: $remote_fs $network $syslog | |
9 | # Should-Start: $named | |
10 | # Should-Stop: $named | |
11 | # Default-Start: 2 3 4 5 | |
12 | # Default-Stop: 0 1 6 | |
13 | # Short-Description: Start, stop or reload ffproxy | |
14 | # Description: ffproxy is a light and customizable http(s) proxy server | |
15 | ### END INIT INFO | |
16 | ||
17 | # Edit /etc/default/ffproxy to change this. | |
18 | FFPROXY_START=yes | |
19 | FFPROXY_USECHROOT=yes | |
20 | FFPROXY_USER=nobody | |
21 | FFPROXY_GROUP=nogroup | |
22 | FFPROXY_OPTS= | |
23 | ||
24 | # Do not edit vars below | |
25 | FFPROXY_CHROOT=/var/lib/ffproxy | |
26 | FFPROXY_CONFDIR=/etc/ffproxy | |
27 | FFPROXY_PID=/var/run/ffproxy.pid | |
28 | ||
29 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
30 | FFPROXY=/usr/bin/ffproxy | |
31 | NAME=ffproxy | |
32 | DESC="http(s) proxy server" | |
33 | VERBOSE=no | |
34 | ||
35 | if [ ! -x "$FFPROXY" ]; then | |
36 | exit 0 | |
37 | fi | |
38 | ||
39 | # loading lsb functions | |
40 | . /lib/lsb/init-functions | |
41 | ||
42 | # Override root's umask while invoking this script | |
43 | umask 0022 | |
44 | ||
45 | # Include ffproxy defaults if available | |
46 | if [ -f /etc/default/ffproxy ]; then | |
47 | . /etc/default/ffproxy | |
48 | fi | |
49 | ||
50 | # Include rcS defaults | |
51 | if [ -f /etc/default/rcS ]; then | |
52 | . /etc/default/rcS | |
53 | fi | |
54 | ||
55 | if [ "$FFPROXY_START" = "no" ] && [ "$1" != "stop" ]; then | |
56 | if [ "$VERBOSE" != "no" ]; then | |
57 | log_daemon_msg "Not starting ffproxy - edit /etc/default/ffproxy and change FFPROXY_START to be 'yes'." | |
58 | fi | |
59 | exit 0 | |
60 | fi | |
61 | ||
62 | update_chroot() { | |
63 | if [ ! -d "$FFPROXY_CHROOT" ]; then | |
64 | mkdir -p "$FFPROXY_CHROOT" | |
65 | fi | |
66 | for f in /etc/localtime /etc/hosts /etc/resolv.conf /etc/nsswitch.conf \ | |
67 | $(find "$FFPROXY_CONFDIR" -type f) /lib/*/libns*so* /lib/*/libresolv*so* ; do | |
68 | d=$(dirname "$f") | |
69 | if [ ! -d "$FFPROXY_CHROOT/$d" ]; then | |
70 | mkdir -p "$FFPROXY_CHROOT/$d" | |
71 | fi | |
72 | if [ -e "$FFPROXY_CHROOT/$f" ]; then | |
73 | rm -f "$FFPROXY_CHROOT/$f" | |
74 | fi | |
75 | cp "$f" "$FFPROXY_CHROOT/$f" | |
76 | done | |
77 | } | |
78 | ||
79 | delete_chroot() { | |
80 | rm -rf "$FFPROXY_CHROOT" | |
81 | } | |
82 | ||
83 | do_start() { | |
84 | if [ "$FFPROXY_USECHROOT" = "yes" ]; then | |
85 | update_chroot | |
86 | FFPROXY_OPTS="$FFPROXY_OPTS -r $FFPROXY_CHROOT -D $FFPROXY_CONFDIR" | |
87 | else | |
88 | FFPROXY_OPTS="$FFPROXY_OPTS -D $FFPROXY_CONFDIR" | |
89 | fi | |
90 | if [ -n "$FFPROXY_USER" ] && [ -n "$FFPROXY_GROUP" ]; then | |
91 | FFPROXY_OPTS="$FFPROXY_OPTS -u $FFPROXY_USER -g $FFPROXY_GROUP" | |
92 | fi | |
93 | log_daemon_msg "Starting $DESC" | |
94 | log_progress_msg "$NAME" | |
95 | start_daemon -p $FFPROXY_PID $FFPROXY $FFPROXY_OPTS | |
96 | RET=$? | |
97 | log_end_msg $RET | |
98 | return $RET | |
99 | } | |
100 | ||
101 | do_reload() { | |
102 | log_daemon_msg "Reloading $DESC" | |
103 | log_progress_msg "$NAME" | |
104 | if [ "$FFPROXY_USECHROOT" = "yes" ]; then | |
105 | update_chroot | |
106 | fi | |
107 | killproc -p $FFPROXY_PID $FFPROXY SIGHUP | |
108 | RET=$? | |
109 | log_end_msg $RET | |
110 | return $RET | |
111 | } | |
112 | ||
113 | do_stop() { | |
114 | log_daemon_msg "Stopping $DESC" | |
115 | log_progress_msg "$NAME" | |
116 | if [ -d "$FFPROXY_CHROOT" ]; then | |
117 | delete_chroot | |
118 | fi | |
119 | start-stop-daemon --stop --quiet --oknodo --pidfile $FFPROXY_PID | |
120 | RET=$? | |
121 | log_end_msg $? | |
122 | return $RET | |
123 | } | |
124 | ||
125 | do_status() { | |
126 | status_of_proc -p "$FFPROXY_PID" "$(basename "$FFPROXY")" "$NAME" | |
127 | RET=$? | |
128 | return $RET | |
129 | } | |
130 | ||
131 | case "$1" in | |
132 | start) | |
133 | do_start || exit $? | |
134 | ;; | |
135 | stop) | |
136 | do_stop || exit $? | |
137 | ;; | |
138 | reload|force-reload) | |
139 | do_reload || exit $? | |
140 | ;; | |
141 | restart) | |
142 | do_stop | |
143 | sleep 5 | |
144 | do_start || exit $? | |
145 | ;; | |
146 | status) | |
147 | do_status || exit $? | |
148 | ;; | |
149 | *) | |
150 | N=/etc/init.d/$NAME | |
151 | echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2 | |
152 | exit 1 | |
153 | ;; | |
154 | esac | |
155 | ||
156 | exit 0 |
0 | usr/bin/ffproxy | |
1 | usr/share/ffproxy/db/* etc/ffproxy/db/ | |
2 | usr/share/ffproxy/html/* etc/ffproxy/html/ | |
3 | debian/ffproxy.conf.debian usr/share/ffproxy |
0 | #!/bin/sh | |
1 | # | |
2 | # postinst script for ffproxy | |
3 | # | |
4 | ||
5 | set -e | |
6 | ||
7 | if [ "$1" = "configure" ]; then | |
8 | if which ucf >/dev/null; then | |
9 | ucf /usr/share/ffproxy/ffproxy.conf.debian \ | |
10 | /etc/ffproxy/ffproxy.conf | |
11 | fi | |
12 | if which ucfr >/dev/null; then | |
13 | ucfr ffproxy /etc/ffproxy/ffproxy.conf | |
14 | fi | |
15 | fi | |
16 | ||
17 | #DEBHELPER# | |
18 | ||
19 | exit 0 |
0 | #!/bin/sh | |
1 | # | |
2 | # postrm script for ffproxy | |
3 | # | |
4 | ||
5 | set -e | |
6 | ||
7 | if [ "$1" = "purge" ]; then | |
8 | if which ucf >/dev/null; then | |
9 | ucf --purge /etc/ffproxy/ffproxy.conf | |
10 | fi | |
11 | if which ucfr >/dev/null; then | |
12 | ucfr --purge ffproxy /etc/ffproxy/ffproxy.conf | |
13 | fi | |
14 | if [ -d /etc/ffproxy ]; then | |
15 | rm -rf /etc/ffproxy | |
16 | fi | |
17 | fi | |
18 | ||
19 | #DEBHELPER# | |
20 | ||
21 | exit 0 |
0 | #!/bin/sh | |
1 | # | |
2 | # ffproxy This init.d script is used to start ffproxy | |
3 | # | |
4 | ||
5 | ### BEGIN INIT INFO | |
6 | # Provides: ffproxy | |
7 | # Required-Start: $remote_fs $network $syslog | |
8 | # Required-Stop: $remote_fs $network $syslog | |
9 | # Should-Start: $named | |
10 | # Should-Stop: $named | |
11 | # Default-Start: 2 3 4 5 | |
12 | # Default-Stop: 0 1 6 | |
13 | # Short-Description: Start, stop or reload ffproxy | |
14 | # Description: ffproxy is a light and customizable http(s) proxy server | |
15 | ### END INIT INFO | |
16 | ||
17 | # Edit /etc/default/ffproxy to change this. | |
18 | FFPROXY_START=yes | |
19 | FFPROXY_USECHROOT=yes | |
20 | FFPROXY_USER=nobody | |
21 | FFPROXY_GROUP=nogroup | |
22 | FFPROXY_OPTS= | |
23 | ||
24 | # Do not edit vars below | |
25 | FFPROXY_CHROOT=/var/lib/ffproxy | |
26 | FFPROXY_CONFDIR=/etc/ffproxy | |
27 | FFPROXY_PID=/var/run/ffproxy.pid | |
28 | ||
29 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
30 | FFPROXY=/usr/bin/ffproxy | |
31 | NAME=ffproxy | |
32 | DESC="http(s) proxy server" | |
33 | VERBOSE=no | |
34 | ||
35 | if [ ! -x "$FFPROXY" ]; then | |
36 | exit 0 | |
37 | fi | |
38 | ||
39 | # loading lsb functions | |
40 | . /lib/lsb/init-functions | |
41 | ||
42 | # Override root's umask while invoking this script | |
43 | umask 0022 | |
44 | ||
45 | # Include ffproxy defaults if available | |
46 | if [ -f /etc/default/ffproxy ]; then | |
47 | . /etc/default/ffproxy | |
48 | fi | |
49 | ||
50 | # Include rcS defaults | |
51 | if [ -f /etc/default/rcS ]; then | |
52 | . /etc/default/rcS | |
53 | fi | |
54 | ||
55 | if [ "$FFPROXY_START" = "no" ] && [ "$1" != "stop" ]; then | |
56 | if [ "$VERBOSE" != "no" ]; then | |
57 | log_daemon_msg "Not starting ffproxy - edit /etc/default/ffproxy and change FFPROXY_START to be 'yes'." | |
58 | fi | |
59 | exit 0 | |
60 | fi | |
61 | ||
62 | update_chroot() { | |
63 | if [ ! -d "$FFPROXY_CHROOT" ]; then | |
64 | mkdir -p "$FFPROXY_CHROOT" | |
65 | fi | |
66 | for f in /etc/localtime /etc/hosts /etc/resolv.conf /etc/nsswitch.conf \ | |
67 | $(find "$FFPROXY_CONFDIR" -type f) /lib/*/libns*so* /lib/*/libresolv*so* ; do | |
68 | d=$(dirname "$f") | |
69 | if [ ! -d "$FFPROXY_CHROOT/$d" ]; then | |
70 | mkdir -p "$FFPROXY_CHROOT/$d" | |
71 | fi | |
72 | if [ -e "$FFPROXY_CHROOT/$f" ]; then | |
73 | rm -f "$FFPROXY_CHROOT/$f" | |
74 | fi | |
75 | cp "$f" "$FFPROXY_CHROOT/$f" | |
76 | done | |
77 | } | |
78 | ||
79 | delete_chroot() { | |
80 | rm -rf "$FFPROXY_CHROOT" | |
81 | } | |
82 | ||
83 | do_start() { | |
84 | if [ "$FFPROXY_USECHROOT" = "yes" ]; then | |
85 | update_chroot | |
86 | FFPROXY_OPTS="$FFPROXY_OPTS -r $FFPROXY_CHROOT -D $FFPROXY_CONFDIR" | |
87 | else | |
88 | FFPROXY_OPTS="$FFPROXY_OPTS -D $FFPROXY_CONFDIR" | |
89 | fi | |
90 | if [ -n "$FFPROXY_USER" ] && [ -n "$FFPROXY_GROUP" ]; then | |
91 | FFPROXY_OPTS="$FFPROXY_OPTS -u $FFPROXY_USER -g $FFPROXY_GROUP" | |
92 | fi | |
93 | log_daemon_msg "Starting $DESC" | |
94 | log_progress_msg "$NAME" | |
95 | start_daemon -p $FFPROXY_PID $FFPROXY $FFPROXY_OPTS | |
96 | RET=$? | |
97 | log_end_msg $RET | |
98 | return $RET | |
99 | } | |
100 | ||
101 | do_reload() { | |
102 | log_daemon_msg "Reloading $DESC" | |
103 | log_progress_msg "$NAME" | |
104 | if [ "$FFPROXY_USECHROOT" = "yes" ]; then | |
105 | update_chroot | |
106 | fi | |
107 | killproc -p $FFPROXY_PID $FFPROXY SIGHUP | |
108 | RET=$? | |
109 | log_end_msg $RET | |
110 | return $RET | |
111 | } | |
112 | ||
113 | do_stop() { | |
114 | log_daemon_msg "Stopping $DESC" | |
115 | log_progress_msg "$NAME" | |
116 | if [ -d "$FFPROXY_CHROOT" ]; then | |
117 | delete_chroot | |
118 | fi | |
119 | start-stop-daemon --stop --quiet --oknodo --pidfile $FFPROXY_PID | |
120 | RET=$? | |
121 | log_end_msg $? | |
122 | return $RET | |
123 | } | |
124 | ||
125 | do_status() { | |
126 | status_of_proc -p "$FFPROXY_PID" "$(basename "$FFPROXY")" "$NAME" | |
127 | RET=$? | |
128 | return $RET | |
129 | } | |
130 | ||
131 | case "$1" in | |
132 | start) | |
133 | do_start || exit $? | |
134 | ;; | |
135 | stop) | |
136 | do_stop || exit $? | |
137 | ;; | |
138 | reload|force-reload) | |
139 | do_reload || exit $? | |
140 | ;; | |
141 | restart) | |
142 | do_stop | |
143 | sleep 5 | |
144 | do_start || exit $? | |
145 | ;; | |
146 | status) | |
147 | do_status || exit $? | |
148 | ;; | |
149 | *) | |
150 | N=/etc/init.d/$NAME | |
151 | echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2 | |
152 | exit 1 | |
153 | ;; | |
154 | esac | |
155 | ||
156 | exit 0 |
0 | usr/bin/ffproxy | |
1 | usr/share/ffproxy/db/* etc/ffproxy/db/ | |
2 | usr/share/ffproxy/html/* etc/ffproxy/html/ | |
3 | debian/ffproxy.conf.debian usr/share/ffproxy |
0 | #!/bin/sh | |
1 | # | |
2 | # postinst script for ffproxy | |
3 | # | |
4 | ||
5 | set -e | |
6 | ||
7 | if [ "$1" = "configure" ]; then | |
8 | if which ucf >/dev/null; then | |
9 | ucf /usr/share/ffproxy/ffproxy.conf.debian \ | |
10 | /etc/ffproxy/ffproxy.conf | |
11 | fi | |
12 | if which ucfr >/dev/null; then | |
13 | ucfr ffproxy /etc/ffproxy/ffproxy.conf | |
14 | fi | |
15 | fi | |
16 | ||
17 | #DEBHELPER# | |
18 | ||
19 | exit 0 |
0 | #!/bin/sh | |
1 | # | |
2 | # postrm script for ffproxy | |
3 | # | |
4 | ||
5 | set -e | |
6 | ||
7 | if [ "$1" = "purge" ]; then | |
8 | if which ucf >/dev/null; then | |
9 | ucf --purge /etc/ffproxy/ffproxy.conf | |
10 | fi | |
11 | if which ucfr >/dev/null; then | |
12 | ucfr --purge ffproxy /etc/ffproxy/ffproxy.conf | |
13 | fi | |
14 | if [ -d /etc/ffproxy ]; then | |
15 | rm -rf /etc/ffproxy | |
16 | fi | |
17 | fi | |
18 | ||
19 | #DEBHELPER# | |
20 | ||
21 | exit 0 |