From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/blueness:master commit in: net-proxy/obfsproxy/files/
Date: Sat, 19 Jan 2013 15:38:30 +0000 (UTC) [thread overview]
Message-ID: <1358609898.2d26d5b6c909ddd66afe4d33ff8b6c33ee8b7ec1.blueness@gentoo> (raw)
commit: 2d26d5b6c909ddd66afe4d33ff8b6c33ee8b7ec1
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 19 15:38:18 2013 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jan 19 15:38:18 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=2d26d5b6
net-proxy/obfsproxy: clean up initd logic
---
net-proxy/obfsproxy/files/obfsproxy.initd | 37 +++++++++++++++++++++--------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/net-proxy/obfsproxy/files/obfsproxy.initd b/net-proxy/obfsproxy/files/obfsproxy.initd
index 887a7c8..75dfc05 100644
--- a/net-proxy/obfsproxy/files/obfsproxy.initd
+++ b/net-proxy/obfsproxy/files/obfsproxy.initd
@@ -10,28 +10,45 @@ depend() {
need net
}
-start() {
- [ "x${MODE}" = "x" ] && eerror "MODE not given"
+checkconfig() {
+ [[ "x${PROTOCOL}" = "x" ]] \
+ && eerror "PROTOCOL not given" && return 1
+ [[ "x${MODE}" = "x" ]] \
+ && eerror "MODE not given" && return 1
if [ ${PROTOCOL} = "dummy" ] ; then
- [[ "x${MODE}" = "xserver" && "x${TARGET}" = "x" ]] && eerror "MODE=server but no target was given"
- [[ "x${MODE}" = "xsocks" && "x${TARGET}" != "x" ]] && eerror "MODE=sock but a target was given"
+ [[ "x${LISTEN}" = "x" ]] \
+ && eerror "No listen address was given" && return 1
+ [[ "x${MODE}" = "xserver" && "x${TARGET}" = "x" ]] \
+ && eerror "MODE=server but no target address was given" && return 1
+ [[ "x${MODE}" = "xsocks" && "x${TARGET}" != "x" ]] \
+ && eerror "MODE=sock but a target address was given" && return 1
CMDLINE="${LOGGING} ${PROTOCOL} ${MODE} ${LISTEN} ${TARGET}"
elif [ ${PROTOCOL} = "obfs2" ] ; then
- [[ "x${MODE}" = "xsocks" && "x${DESTINATION}" != "x" ]] && eerror "MODE=sock but a destination was given"
- [[ "x${LISTEN}" = "x" ]] && eerror "LISTEN host:port is not given"
- [[ "x${DESTINATION}" != "x" ]] && DESTINATION="--dest=${DESTINATION}"
- [[ "x${SECRET}" != "x" ]] && SECRET="--shared-secret=${SECRET}"
+ [[ "x${MODE}" = "xsocks" && "x${DESTINATION}" != "x" ]] \
+ && eerror "MODE=sock but a destination address was given" && return 1
+ [[ "x${LISTEN}" = "x" ]] \
+ && eerror "LISTEN host:port was not given" && return 1
+ [[ "x${DESTINATION}" != "x" ]] \
+ && DESTINATION="--dest=${DESTINATION}"
+ [[ "x${SECRET}" != "x" ]] \
+ && SECRET="--shared-secret=${SECRET}"
CMDLINE="${LOGGING} ${PROTOCOL} ${DESTINATION} ${SECRET} ${MODE} ${LISTEN}"
else
eerror "Unknown protocol ${PROTOCOL}"
+ return 1
fi
+ return 0
+}
- ewarn ${CMDLINE}
+start() {
+ checkconfig || return 1
+ ebegin "Starting obfsproxy server"
start-stop-daemon -b --start --exec ${DAEMON} -- ${CMDLINE}
-
eend $?
}
stop() {
+ ebegin "Stopping obfsproxy server"
start-stop-daemon --stop --exec ${DAEMON}
+ eend $?
}
next reply other threads:[~2013-01-19 15:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-19 15:38 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-19 13:51 [gentoo-commits] dev/blueness:master commit in: net-proxy/obfsproxy/files/ Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358609898.2d26d5b6c909ddd66afe4d33ff8b6c33ee8b7ec1.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox