Skip to content

Instantly share code, notes, and snippets.

@RealYukiSan
Created July 18, 2024 00:39
Show Gist options
  • Save RealYukiSan/c5eda5f17939bcab339c848d035ca9ad to your computer and use it in GitHub Desktop.
Save RealYukiSan/c5eda5f17939bcab339c848d035ca9ad to your computer and use it in GitHub Desktop.
Check if the required packages are installed or not; the script was originally intended for https://wiki.lineageos.org/emulator
#!/bin/bash
# Define the list of packages
packages=(
bc bison ccache curl flex git git-lfs gnupg gperf imagemagick
lib32-readline lib32-zlib libelf liblz4 libsdl2 libssl libxml2
lzop rsync schedtool squashfs-tools xsltproc zip zlib
)
# Initialize an empty array to hold missing packages
missing_packages=()
# Loop through each package to check if it is installed
for pkg in "${packages[@]}"; do
if pacman -Qs $pkg > /dev/null; then
echo "$pkg is installed."
else
echo "$pkg is NOT installed."
missing_packages+=($pkg)
fi
done
# Print the missing packages, if any
if [ ${#missing_packages[@]} -ne 0 ]; then
echo "The following packages are missing:"
for missing in "${missing_packages[@]}"; do
echo $missing
done
else
echo "All packages are installed."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment