1
0
Fork 0

unix-setup.sh: improve distro detection

This commit is contained in:
Pratham Patel 2024-03-19 15:14:46 +05:30
parent c804af3a2e
commit 705e848e90
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 18 additions and 16 deletions

View File

@ -190,27 +190,29 @@ function common_setup() {
if [[ "$(uname -s)" == 'Linux' ]]; then
if grep "ID=debian\|ID=ubuntu" /etc/os-release > /dev/null; then
if grep 'debian' /etc/os-release > /dev/null; then
function unix_setup() {
install_pkgs_debian
enable_ssh_daemon_debian
common_setup
}
elif grep "ID=fedora" /etc/os-release > /dev/null; then
function unix_setup() {
dnf_conf
install_pkgs_fedora
enable_ssh_daemon_fedora
common_setup
}
elif grep "ID_LIKE=*.rhel*." /etc/os-release > /dev/null; then
RHEL_VERSION="$(grep VERSION_ID /etc/os-release | awk -F"=" '{print $2}')"
function unix_setup() {
dnf_conf
install_pkgs_rhel "${RHEL_VERSION}"
enable_ssh_daemon_fedora
common_setup
}
elif grep 'fedora' /etc/os-release > /dev/null; then
if grep 'rhel' /etc/os-release > /dev/null; then
RHEL_VERSION="$(grep VERSION_ID /etc/os-release | awk -F"=" '{print $2}')"
function unix_setup() {
dnf_conf
install_pkgs_rhel "${RHEL_VERSION}"
enable_ssh_daemon_fedora
common_setup
}
else
function unix_setup() {
dnf_conf
install_pkgs_fedora
enable_ssh_daemon_fedora
common_setup
}
fi
else
echo 'Unsupported Linux distribution.'
exit 1