sp-containers/files/common/scripts/install-dependencies.sh

34 lines
736 B
Bash
Raw Normal View History

2023-06-05 15:24:42 +02:00
#!/bin/bash
set -eo pipefail
main() {
if [ "${INSTALL_DEPENDENCIES}" == "0" ]; then
echo "Dependencies installation disabled. Doing nothing."
exit
fi
install_additional_packages
}
# Return 3 for unknown distribution
install_additional_packages() {
if [ -z "${ADDITIONAL_PACKAGES}" ]; then
return
fi
echo "Installing additional packages '${ADDITIONAL_PACKAGES}'..."
if [ -f "/etc/debian_version" ]; then
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get install -y ${ADDITIONAL_PACKAGES}
elif [ -f "/etc/alpine-release" ]; then
apk update
apk add --no-cache ${ADDITIONAL_PACKAGES}
else
return 3
fi
}
main