37 lines
964 B
Bash
Executable File
37 lines
964 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Function to install libmagic-dev on Debian-based distros
|
|
install_debian() {
|
|
echo "Detected Debian-based distro. Installing libmagic-dev..."
|
|
sudo apt-get update
|
|
sudo apt-get install -y libmagic-dev
|
|
}
|
|
|
|
# Function to install file-devel on Red Hat-based distros
|
|
install_redhat() {
|
|
echo "Detected Red Hat-based distro. Installing file-devel..."
|
|
sudo yum install -y file-devel
|
|
}
|
|
|
|
# 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!"
|
|
|