-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·47 lines (42 loc) · 1.3 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
PACKAGES="gcc nasm xorriso qemu mtools grub-common"
# Function to check if a package is installed on Arch Linux
check_package_arch() {
if pacman -Qi $1 >/dev/null 2>&1; then
echo "$1 is already installed."
else
echo "$1 is not installed. Installing..."
sudo pacman -Sy --noconfirm $1
fi
}
# Function to check if a package is installed on Ubuntu
check_package_ubuntu() {
if dpkg -s $1 >/dev/null 2>&1; then
echo "$1 is already installed."
else
echo "$1 is not installed. Installing..."
sudo apt update
sudo apt install -y $1
fi
}
# Check if all packages are installed based on the OS
OS=$(uname -s)
for package in $PACKAGES; do
case $OS in
Linux)
if [ -f "/etc/arch-release" ]; then
check_package_arch $package
elif [ -f "/etc/lsb-release" ] || [ -f "/etc/debian_version" ]; then
check_package_ubuntu $package
else
echo "Unsupported Linux distribution. Please install $package manually."
exit 1
fi
;;
*)
echo "Unsupported operating system. Please install $package manually."
exit 1
;;
esac
done
echo "All required packages are installed. Ready to build!"