# Detect Operating System
function dist-check() {
# shellcheck disable=SC1090
if [ -e /etc/os-release ]; then
# shellcheck disable=SC1091
source /etc/os-release
DISTRO=$ID
# shellcheck disable=SC2034
DISTRO_VERSION=$VERSION_ID
fi
}
# Check Operating System
dist-check
# Pre-Checks
function installing-system-requirements() {
# shellcheck disable=SC2233,SC2050
if ([ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "DISTRO" == "raspbian" ]); then
apt-get update && apt-get install iptables curl coreutils bc jq sed e2fsprogs -y
fi
# shellcheck disable=SC2233,SC2050
if ([ "$DISTRO" == "fedora" ] || [ "$DISTRO" == "centos" ] || [ "DISTRO" == "rhel" ]); then
yum update -y && yum install epel-release iptables curl coreutils bc jq sed e2fsprogs -y
fi
if [ "$DISTRO" == "arch" ]; then
pacman -Syu --noconfirm iptables curl bc jq sed
fi
}
# Run the function and check for requirements
installing-system-requirements
Why wont this run?
I am using || to separate the distros but its still not working.
$onDISTRO.casestatementshellcheck? Are you doing one change at a time, and testing? It so then the bug will be in the last thing that you changed.