#!/bin/bash # Function to install libmagic-dev on Debian-based distros install_debian() { echo "Detected Debian-based distro. Installing libmagic-dev..." # if [ "$EUID" -ne 0 ] sudo apt-get update sudo apt-get install -y libmagic-dev # else # apt-get update # apt-get install -y libmagic-dev # fi } # Function to install file-devel on Red Hat-based distros install_redhat() { echo "Detected Red Hat-based distro. Installing file-devel..." # if [ "$EUID" -ne 0 ] sudo yum install -y file-devel # else # yum install -y file-devel # fi } # Function to install libmagic on Arch-based distros install_arch() { echo "Detected Arch-based distro. Installing libmagic..." sudo pacman -Syu --noconfirm sudo pacman -S --noconfirm libmagic } # Detect Linux distro and install appropriate package if [ -f /etc/debian_version ]; then install_debian elif [ -f /etc/redhat-release ]; then install_redhat elif [ -f /etc/arch-release ]; then install_arch else echo "Unsupported Linux distribution. Please install libmagic manually." exit 1 fi echo "Installation complete!"