extract function "is-installed"
This commit is contained in:
parent
1fe82b9560
commit
099f49653c
@ -257,7 +257,7 @@ function ufw-docker--raw-command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ufw-docker--install() {
|
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"
|
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"
|
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
|
cat <<-\EOF | tee -a /etc/ufw/after.rules
|
||||||
@ -286,6 +286,10 @@ function ufw-docker--install() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ufw-docker--is-installed() {
|
||||||
|
grep "^# BEGIN UFW AND DOCKER\$" /etc/ufw/after.rules &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
function ufw-docker--help() {
|
function ufw-docker--help() {
|
||||||
cat <<-EOF >&2
|
cat <<-EOF >&2
|
||||||
Usage:
|
Usage:
|
||||||
@ -371,7 +375,7 @@ case "$ufw_action" in
|
|||||||
shift || true
|
shift || true
|
||||||
"ufw-docker--$ufw_action" "$@"
|
"ufw-docker--$ufw_action" "$@"
|
||||||
;;
|
;;
|
||||||
status|install)
|
status|install|is-installed)
|
||||||
ufw-docker--"$ufw_action"
|
ufw-docker--"$ufw_action"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user