diff --git a/ufw-docker b/ufw-docker index 655ed92..1908831 100755 --- a/ufw-docker +++ b/ufw-docker @@ -257,7 +257,7 @@ function ufw-docker--raw-command() { } function ufw-docker--install() { - if ! grep "^# BEGIN UFW AND DOCKER\$" /etc/ufw/after.rules &>/dev/null; then + if ! ufw-docker--is-installed; then err "Back up /etc/ufw/after.rules" cp /etc/ufw/after.rules /etc/ufw/after.rules-ufw-docker~"$(date '+%Y-%m-%d-%H%M%S').bak" cat <<-\EOF | tee -a /etc/ufw/after.rules @@ -286,6 +286,10 @@ function ufw-docker--install() { fi } +function ufw-docker--is-installed() { + grep "^# BEGIN UFW AND DOCKER\$" /etc/ufw/after.rules &>/dev/null +} + function ufw-docker--help() { cat <<-EOF >&2 Usage: @@ -371,7 +375,7 @@ case "$ufw_action" in shift || true "ufw-docker--$ufw_action" "$@" ;; - status|install) + status|install|is-installed) ufw-docker--"$ufw_action" ;; *)