aboutsummaryrefslogtreecommitdiff
path: root/network/miniupnpd/rc.miniupnpd.new
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2018-05-06 16:13:51 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-05-12 06:58:23 +0700
commitaf7fe71764b4dd8992634cb5634e4d41843c905a (patch)
tree04fa1bfa3530ab22c1b9dfa23b26f54342bed4f1 /network/miniupnpd/rc.miniupnpd.new
parenta8ecd8cbf73a874bea6b42fc17af726a7f3c8a07 (diff)
network/miniupnpd: Added (IGD Protocol, NAT-PMP, and PCP daemon).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/miniupnpd/rc.miniupnpd.new')
-rw-r--r--network/miniupnpd/rc.miniupnpd.new92
1 files changed, 92 insertions, 0 deletions
diff --git a/network/miniupnpd/rc.miniupnpd.new b/network/miniupnpd/rc.miniupnpd.new
new file mode 100644
index 000000000000..cb8893834589
--- /dev/null
+++ b/network/miniupnpd/rc.miniupnpd.new
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+PRG="MiniUPnPd"
+ARGS="-f /etc/miniupnpd/miniupnpd.conf"
+IPV6=@IPV6@
+
+cleanup() {
+ /etc/miniupnpd/iptables_removeall.sh &> /dev/null
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_removeall.sh &> /dev/null
+}
+
+start() {
+ echo -n "Starting $PRG..."
+ /etc/miniupnpd/iptables_init.sh &> /dev/null
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_init.sh &> /dev/null
+ if /usr/sbin/miniupnpd $ARGS; then
+ echo "Done."
+ else
+ EXIT=$?
+ cleanup
+ exit $EXIT
+ fi
+}
+
+stop() {
+ echo -n "Stopping $PRG..."
+ killall miniupnpd &> /dev/null
+ cleanup
+ echo "Done."
+}
+
+ensure_running() {
+ if pidof miniupnpd &> /dev/null; then
+ RUN=1
+ else
+ echo "$PRG is not running."
+ exit 1
+ fi
+}
+
+case "$1" in
+ "start")
+ if pidof miniupnpd &> /dev/null; then
+ echo "$PRG already running."
+ exit 0
+ fi
+ start
+ ;;
+ "stop")
+ ensure_running
+ stop
+ ;;
+ "restart")
+ if pidof miniupnpd &> /dev/null; then
+ stop
+ else
+ echo -n "$PRG is not running. Cleaning..."
+ cleanup
+ echo "Done."
+ fi
+ start
+ ;;
+ "flush")
+ ensure_running
+ echo -n "Flushing $PRG iptables rules..."
+ /etc/miniupnpd/iptables_flush.sh
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_flush.sh
+ echo "Done."
+ ;;
+ "display")
+ ensure_running
+ /etc/miniupnpd/iptables_display.sh
+ [ "$IPV6" = "yes" ] && /etc/miniupnpd/ip6tables_display.sh
+ ;;
+ "status")
+ ensure_running
+ echo "$PRG is running."
+ ;;
+ "cleanup")
+ if pidof miniupnpd &> /dev/null; then
+ echo "$PRG is running. Refusing to cleanup."
+ exit 1
+ fi
+ echo -n "Cleaning..."
+ cleanup
+ echo "Done."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|flush|display|cleanup|status}"
+ exit 1
+ ;;
+esac