aboutsummaryrefslogtreecommitdiffstats
path: root/main/ser2net/ser2net.initd
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2014-08-10 13:41:13 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2014-08-10 13:41:13 +0200
commit7816e4ece0d8bec8cc9a093f57c4f6e72634b13c (patch)
tree74361c487f4c69cce05fb353e05060befd1d1af5 /main/ser2net/ser2net.initd
parent3dcbed7944587029c51ff91e54967413b18e410a (diff)
downloadaports-7816e4ece0d8bec8cc9a093f57c4f6e72634b13c.tar.bz2
aports-7816e4ece0d8bec8cc9a093f57c4f6e72634b13c.tar.xz
testing/ser2net: move to main
Diffstat (limited to 'main/ser2net/ser2net.initd')
-rw-r--r--main/ser2net/ser2net.initd55
1 files changed, 55 insertions, 0 deletions
diff --git a/main/ser2net/ser2net.initd b/main/ser2net/ser2net.initd
new file mode 100644
index 0000000000..1999c7eb06
--- /dev/null
+++ b/main/ser2net/ser2net.initd
@@ -0,0 +1,55 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/ser2net/files/ser2net.initd,v 1.4 2012/07/17 19:44:24 sbriesen Exp $
+
+description="Serial to network proxy (${RC_SVCNAME#*.})"
+pidfile="/var/run/${RC_SVCNAME}.pid"
+command="/usr/sbin/ser2net"
+name="${RC_SVCNAME}"
+
+extra_started_commands="reload"
+description_reload="Reread configuration file and make the appropriate changes"
+start_stop_daemon_args="--quiet --exec ${command} --name ${name} --pidfile ${pidfile}"
+
+depend() {
+ use logger
+ need net
+}
+
+config_check() {
+ command_args="${EXTRA_OPTS}"
+ CONFIG_FILE_DEFAULT="/etc/ser2net.conf"
+
+ yesno "${CISCO_IOS:-no}" && command_args="${SER2NET_OPTS} -b"
+ yesno "${UUCP_LOCKS:-yes}" || command_args="${command_args} -u"
+ [ -z "${CONFIG_FILE}" ] && CONFIG_FILE="${CONFIG_FILE_DEFAULT}"
+ [ -n "${CONTROL_PORT}" ] && command_args="${command_args} -p ${CONTROL_PORT}"
+ [ "${CONFIG_FILE}" != "${CONFIG_FILE_DEFAULT}" ] && command_args="${command_args} -c ${CONFIG_FILE}"
+
+ if [ ! -f "${CONFIG_FILE}" ]; then
+ eerror "Please create ${CONFIG_FILE}"
+ eerror "Sample conf: ${CONFIG_FILE_DEFAULT}.dist"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ config_check || return ${?}
+ ebegin "Starting ${description}"
+ start-stop-daemon --start ${start_stop_daemon_args} -- ${command_args} -P "${pidfile}"
+ eend ${?}
+}
+
+stop() {
+ ebegin "Stopping ${description}"
+ start-stop-daemon --stop ${start_stop_daemon_args}
+ eend ${?}
+}
+
+reload() {
+ ebegin "Reloading ${description}"
+ start-stop-daemon --signal HUP ${start_stop_daemon_args}
+ eend ${?}
+}