-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
#!/usr/bin/env bash
# Require script to be run as root
function super-user-check() {
if [ "${EUID}" -ne 0 ]; then
echo "Error: You need to run this script as administrator."
exit
fi
}
# Check for root
super-user-check
# Get the current system information
function system-information() {
if [ -f /etc/os-release ]; then
# shellcheck disable=SC1091
source /etc/os-release
CURRENT_DISTRO=${ID}
CURRENT_DISTRO_VERSION=${VERSION_ID}
fi
}
# Get the current system information
system-information
# Pre-Checks system requirements
function installing-system-requirements() {
if { [ "${CURRENT_DISTRO}" == "ubuntu" ] || [ "${CURRENT_DISTRO}" == "debian" ] || [ "${CURRENT_DISTRO}" == "raspbian" ] || [ "${CURRENT_DISTRO}" == "pop" ] || [ "${CURRENT_DISTRO}" == "kali" ] || [ "${CURRENT_DISTRO}" == "linuxmint" ] || [ "${CURRENT_DISTRO}" == "neon" ] || [ "${CURRENT_DISTRO}" == "fedora" ] || [ "${CURRENT_DISTRO}" == "centos" ] || [ "${CURRENT_DISTRO}" == "rhel" ] || [ "${CURRENT_DISTRO}" == "almalinux" ] || [ "${CURRENT_DISTRO}" == "rocky" ] || [ "${CURRENT_DISTRO}" == "arch" ] || [ "${CURRENT_DISTRO}" == "archarm" ] || [ "${CURRENT_DISTRO}" == "manjaro" ] || [ "${CURRENT_DISTRO}" == "alpine" ] || [ "${CURRENT_DISTRO}" == "freebsd" ]; }; then
if { [ ! -x "$(command -v curl)" ] || [ ! -x "$(command -v nft)" ]; }; then
if { [ "${CURRENT_DISTRO}" == "ubuntu" ] || [ "${CURRENT_DISTRO}" == "debian" ] || [ "${CURRENT_DISTRO}" == "raspbian" ] || [ "${CURRENT_DISTRO}" == "pop" ] || [ "${CURRENT_DISTRO}" == "kali" ] || [ "${CURRENT_DISTRO}" == "linuxmint" ] || [ "${CURRENT_DISTRO}" == "neon" ]; }; then
apt-get update
apt-get install curl nftables -y
elif { [ "${CURRENT_DISTRO}" == "fedora" ] || [ "${CURRENT_DISTRO}" == "centos" ] || [ "${CURRENT_DISTRO}" == "rhel" ] || [ "${CURRENT_DISTRO}" == "almalinux" ] || [ "${CURRENT_DISTRO}" == "rocky" ]; }; then
yum check-update
yum install curl nftables -y
elif { [ "${CURRENT_DISTRO}" == "arch" ] || [ "${CURRENT_DISTRO}" == "archarm" ] || [ "${CURRENT_DISTRO}" == "manjaro" ]; }; then
pacman -Syu --noconfirm --needed curl nftables
elif [ "${CURRENT_DISTRO}" == "alpine" ]; then
apk update
apk add curl nftables
elif [ "${CURRENT_DISTRO}" == "freebsd" ]; then
pkg update
pkg install curl nftables
fi
fi
else
echo "Error: ${CURRENT_DISTRO} ${CURRENT_DISTRO_VERSION} is not supported."
exit
fi
}
# check for requirements
installing-system-requirementsnf
function install-ip-rules() {
nft add table inet complexorganizations_ip_blocklists
}
Metadata
Metadata
Assignees
Labels
No labels