diff --git a/configure b/configure old mode 100644 new mode 100755 index b17ca4c..e1b995a --- a/configure +++ b/configure @@ -1,2 +1,36 @@ -#!/bin/sh -sudo apt update && sudo apt install libmagic-dev +#!/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!" +