'Generic Commit'
This commit is contained in:
parent
9918607f74
commit
2caa800363
@ -39,21 +39,32 @@ function version() {
|
||||
# CHECK PACKAGES
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
OS=""
|
||||
|
||||
# Function to check if a package is installed
|
||||
is_package_installed() {
|
||||
if [ "$OS" = "Alpine Linux" ]; then
|
||||
apk info | grep -q "^$1$"
|
||||
else
|
||||
dpkg -l "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function check_packages() {
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
# VER=$VERSION_ID
|
||||
else
|
||||
print_error "Could not detect distribution"
|
||||
exit 1
|
||||
OS=$(source /etc/os-release && echo $NAME)
|
||||
fi
|
||||
|
||||
[ -n "$OS" ] || die "Could not detect distribution (no /etc/os-release file?)"
|
||||
|
||||
# Define packages based on distribution
|
||||
case $OS in
|
||||
"Ubuntu"|"Debian GNU/Linux")
|
||||
# Common packages for both Ubuntu and Debian
|
||||
PACKAGES="cmake make g++ build-essential upx musl-tools wget tar ccache ninja-build mold"
|
||||
PACKAGES="build-essential cmake git wget tar curl ninja-build mold nodejs npm perl jq ccache"
|
||||
;;
|
||||
"Alpine Linux")
|
||||
PACKAGES="build-base cmake git wget tar curl ninja mold nodejs npm linux-headers perl jq ccache"
|
||||
;;
|
||||
*)
|
||||
print_error "Unsupported distribution: $OS"
|
||||
@ -61,12 +72,6 @@ function check_packages() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# Function to check if a package is installed
|
||||
is_package_installed() {
|
||||
dpkg -l "$1" 2>/dev/null | grep -q "^ii"
|
||||
}
|
||||
|
||||
# Install missing packages
|
||||
print_status "Checking required packages..."
|
||||
for pkg in $PACKAGES; do
|
||||
if ! is_package_installed "$pkg"; then
|
||||
|
@ -79,6 +79,7 @@ function install_packages() {
|
||||
case $OS in
|
||||
"Ubuntu"|"Debian GNU/Linux")
|
||||
# Common packages for both Ubuntu and Debian
|
||||
# cmake make g++ build-essential upx musl-tools wget tar ccache ninja-build mold
|
||||
PACKAGES="build-essential cmake git wget tar curl ninja-build mold nodejs npm perl jq ccache"
|
||||
INSTALLCMD="apt-get install -y"
|
||||
UPDATECMD="apt-get update"
|
||||
|
Loading…
x
Reference in New Issue
Block a user