:-'Generic Commit'
This commit is contained in:
parent
1d0b1f79b3
commit
503a366400
@ -53,10 +53,13 @@ print_warning() {
|
||||
|
||||
|
||||
# Function to check if a package is installed
|
||||
function is_package_installed() {
|
||||
is_package_installed() {
|
||||
if [ "$OS" = "Alpine Linux" ]; then
|
||||
apk info | grep -q "^$1$"
|
||||
else
|
||||
dpkg -l "$1" 2>/dev/null | grep -q "^ii"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_packages() {
|
||||
local PACKAGES
|
||||
local HAVE_UPDATED=0
|
||||
@ -77,7 +80,14 @@ function install_packages() {
|
||||
case $OS in
|
||||
"Ubuntu"|"Debian GNU/Linux")
|
||||
# Common packages for both Ubuntu and Debian
|
||||
PACKAGES="nlohmann-json3-dev wget curl cmake ninja-build mold build-essential"
|
||||
PACKAGES="bash build-essential cmake git wget tar curl ninja-build mold nodejs npm"
|
||||
INSTALLCMD="apt-get install -y"
|
||||
UPDATECMD="apt-get update"
|
||||
;;
|
||||
"Alpine Linux")
|
||||
PACKAGES="bash build-base cmake git wget tar curl ninja mold nodejs npm"
|
||||
INSTALLCMD="apk add --no-cache"
|
||||
UPDATECMD="apk update"
|
||||
;;
|
||||
*)
|
||||
print_error "Unsupported distribution: $OS"
|
||||
@ -94,11 +104,11 @@ function install_packages() {
|
||||
# Update package lists
|
||||
if [ "$HAVE_UPDATED" -eq 0 ]; then
|
||||
print_status "Updating package lists..."
|
||||
apt-get update
|
||||
${SUDOCMD:-} "${UPDATECMD}"
|
||||
HAVE_UPDATED=1
|
||||
fi
|
||||
|
||||
if ! "$SUDOCMD" apt-get install -y "$pkg"; then
|
||||
if ! ${SUDOCMD:-} "${INSTALLCMD}" "$pkg"; then
|
||||
print_error "Failed to install $pkg"
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user