KasmVNC/builder/scripts/common.sh

35 lines
757 B
Bash
Raw Normal View History

2023-01-24 09:29:05 +01:00
#!/bin/bash
2023-01-18 13:35:36 +01:00
detect_distro() {
if [ -f /etc/centos-release ]; then
DISTRO=centos
elif [ -f /etc/oracle-release ]; then
2023-01-24 09:29:05 +01:00
DISTRO=oracle
elif [ -f /etc/fedora-release ]; then
DISTRO=fedora
2023-01-18 13:35:36 +01:00
elif [ -f /usr/bin/zypper ]; then
DISTRO=opensuse
2023-03-13 20:57:24 +01:00
elif [ -f /etc/alpine-release ]; then
DISTRO=alpine
2023-01-18 13:35:36 +01:00
else
DISTRO=debian
fi
}
2023-01-24 10:15:03 +01:00
install_packages() {
local install_cmd=no-command-defined
case "$DISTRO" in
centos) install_cmd="yum install -y" ;;
oracle) install_cmd="dnf install -y" ;;
fedora) install_cmd="dnf install -y" ;;
2023-01-24 10:15:03 +01:00
opensuse) install_cmd="zypper install -y" ;;
2023-03-13 20:57:24 +01:00
alpine) install_cmd="apk add" ;;
2023-01-24 10:15:03 +01:00
*) install_cmd="apt-get update && apt-get install -y"
esac
eval "$install_cmd $*"
}
2023-01-18 13:35:36 +01:00
detect_distro