remove duplicated code

This commit is contained in:
pvincent
2024-02-28 15:15:28 +04:00
parent 9a645e19f8
commit 6e3c8fad3d
2 changed files with 2 additions and 18 deletions
-17
View File
@@ -673,20 +673,3 @@ function flatten_array {
IFS=" " read -r -a array <<<"$(tr ' ' '\n' <<<"${array[@]}" | sort -u | tr '\n' ' ')"
printf '%s\n' "${array[@]}"
}
function prepare_nftables() {
local PREFIX="miaou:firewall"
if [[ ! -f /etc/nftables.rules.d/firewall.table ]]; then
echo "installing nftables ..."
sudo apt install -y nftables
sudo cp -f "$MIAOU_BASEDIR/templates/hardened/nftables.conf" /etc/
sudo mkdir -p /etc/nftables.rules.d
sudo cp -f "$MIAOU_BASEDIR/templates/hardened/firewall.table" /etc/nftables.rules.d/
sudo systemctl restart nftables
sudo systemctl enable nftables
echo "OK"
else
echo "nftables already installed!"
fi
}
+2 -1
View File
@@ -143,7 +143,8 @@ EOF
if [[ -z "$env_container_hostname" ]]; then
env_container_hostname=$(hostname -s)
if env | grep -q container_hostname; then
local previous_container_hostname=$(env | grep container_hostname | cut -d '=' -f2)
local previous_container_hostname
previous_container_hostname=$(env | grep container_hostname | cut -d '=' -f2)
env_container_hostname="$previous_container_hostname $env_container_hostname"
fi