summaryrefslogtreecommitdiff
path: root/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch')
-rw-r--r--net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch b/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch
new file mode 100644
index 000000000000..91791e01c4d4
--- /dev/null
+++ b/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch
@@ -0,0 +1,46 @@
+diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std
+index 9896e18d4..2d8c7df67 100644
+--- a/Shorewall/lib.cli-std
++++ b/Shorewall/lib.cli-std
+@@ -1063,6 +1063,41 @@ restart_command() {
+ return $rc
+ }
+
++read_yesno_with_timeout() {
++ local timeout
++ timeout=${1:-60}
++
++ case $timeout in
++ *s)
++ ;;
++ *m)
++ timeout=$((${timeout%m} * 60))
++ ;;
++ *h)
++ timeout=$((${timeout%h} * 3600))
++ ;;
++ esac
++
++ read -t $timeout yn 2> /dev/null
++ if [ $? -eq 2 ]
++ then
++ # read doesn't support timeout
++ test -x /bin/bash || return 2 # bash is not installed so the feature is not available
++ /bin/bash -c "read -t $timeout yn ; if [ \"\$yn\" == \"y\" ] ; then exit 0 ; else exit 1 ; fi" # invoke bash and use its version of read
++ return $?
++ else
++ # read supports timeout
++ case "$yn" in
++ y|Y)
++ return 0
++ ;;
++ *)
++ return 1
++ ;;
++ esac
++ fi
++}
++
+ #
+ # Safe-start/safe-reload/safe-restart Command Executor
+ #