public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/blueness:master commit in: net-proxy/obfsproxy/files/
@ 2013-01-19 13:51 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2013-01-19 13:51 UTC (permalink / raw
  To: gentoo-commits

commit:     e90ed138ecef0d255d46673cecbfb773cd23196c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 19 13:51:11 2013 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jan 19 13:51:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=e90ed138

net-proxy/obfsproxy: fix CMDLINE for initd

---
 net-proxy/obfsproxy/files/obfsproxy.confd |    2 +-
 net-proxy/obfsproxy/files/obfsproxy.initd |   20 +++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/net-proxy/obfsproxy/files/obfsproxy.confd b/net-proxy/obfsproxy/files/obfsproxy.confd
index 30e8fa9..0f3699d 100644
--- a/net-proxy/obfsproxy/files/obfsproxy.confd
+++ b/net-proxy/obfsproxy/files/obfsproxy.confd
@@ -31,7 +31,7 @@ PROTOCOL="obfs2"
 #	Example:
 #	obfsproxy obfs2 --dest=127.0.0.1:666 --shared-secret=himitsu server 127.0.0.1:1026
 
-MODE="socks"
+MODE="server"
 DESTINATION="127.0.0.1:666"
 SECRET="changeme"
 LISTEN="127.0.0.1:1026"

diff --git a/net-proxy/obfsproxy/files/obfsproxy.initd b/net-proxy/obfsproxy/files/obfsproxy.initd
index 2e67745..887a7c8 100644
--- a/net-proxy/obfsproxy/files/obfsproxy.initd
+++ b/net-proxy/obfsproxy/files/obfsproxy.initd
@@ -13,23 +13,25 @@ depend() {
 start() {
 	[ "x${MODE}" = "x" ] && eerror "MODE not given"
 	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"
-		CMDLINE="${MODE} ${LISTEN} ${TARGET} ${LOGGING}"
+		[[ "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"
+		CMDLINE="${LOGGING} ${PROTOCOL} ${MODE} ${LISTEN} ${TARGET}"
 	elif [ ${PROTOCOL} = "obfs2" ] ; then
-		[ "x${LISTEN}" = "x" ] && eerror "LISTEN host:port is not given"
-		[ "x${DESTINATION}" != "x" ] && DESTINATION="--dest=${DESTINATION}"
-		[ "x${SECRET}" != "x" ] && SECRET="--shared-secret=${SECRET}"
-		CMDLINE="${DESTINATION} ${SECRET} ${MODE} ${LISTEN} ${LOGGING}"
+		[[ "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}"
+		CMDLINE="${LOGGING} ${PROTOCOL} ${DESTINATION} ${SECRET} ${MODE} ${LISTEN}"
 	else
 		eerror "Unknown protocol ${PROTOCOL}"
 	fi
 
-	start-stop-daemon --start --pidfile "${PIDFILE}" --exec "${DAEMON}"
+	ewarn ${CMDLINE}
+	start-stop-daemon -b --start --exec ${DAEMON} -- ${CMDLINE}
 
 	eend $?
 }
 
 stop() {
-	start-stop-daemon --stop --pidfile "${PIDFILE}"
+	start-stop-daemon --stop --exec ${DAEMON}
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] dev/blueness:master commit in: net-proxy/obfsproxy/files/
@ 2013-01-19 15:38 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2013-01-19 15:38 UTC (permalink / raw
  To: gentoo-commits

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 $?
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-19 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-19 15:38 [gentoo-commits] dev/blueness:master commit in: net-proxy/obfsproxy/files/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2013-01-19 13:51 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox