refactor: update dependencies installation script
This commit is contained in:
parent
1c39e743d4
commit
3a7eb3729c
1 changed files with 121 additions and 128 deletions
|
|
@ -1,44 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# DEPENDENCIES.sh - Runtime Dependencies for General Bots
|
# DEPENDENCIES.sh - Runtime Dependencies for General Bots
|
||||||
#
|
#
|
||||||
# This script installs all system packages required to RUN botserver binary.
|
# This script installs all system packages required to RUN botserver binary.
|
||||||
# These are the minimal dependencies needed for production deployment.
|
# These are the minimal dependencies needed for production deployment.
|
||||||
#
|
#
|
||||||
# Usage: sudo ./DEPENDENCIES.sh
|
# Usage: sudo ./DEPENDENCIES.sh
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
echo -e "${GREEN} General Bots Runtime Dependencies${NC}"
|
echo -e "${GREEN} General Bots Runtime Dependencies${NC}"
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
|
|
||||||
# Check root
|
# Check root
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
echo -e "${RED}Error: Run as root (use sudo)${NC}"
|
echo -e "${RED}Error: Run as root (use sudo)${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect OS
|
# Detect OS
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
OS=$ID
|
OS=$ID
|
||||||
else
|
else
|
||||||
echo -e "${RED}Error: Cannot detect OS${NC}"
|
echo -e "${RED}Error: Cannot detect OS${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${YELLOW}OS: $OS${NC}"
|
echo -e "${YELLOW}OS: $OS${NC}"
|
||||||
|
|
||||||
|
install_debian_ubuntu() {
|
||||||
|
|
||||||
install_debian_ubuntu() {
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
libpq5 \
|
libpq5 \
|
||||||
libssl3 \
|
libssl3 \
|
||||||
|
|
@ -47,21 +47,14 @@ install_debian_ubuntu() {
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
libabseil20210324 \
|
|
||||||
libclang1 \
|
libclang1 \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
snapd
|
snapd
|
||||||
|
|
||||||
# LXC for containers
|
|
||||||
snap install lxd || apt-get install -y lxd || true
|
|
||||||
|
|
||||||
# Initialize LXD
|
}
|
||||||
if command -v lxd &> /dev/null && ! lxc list &> /dev/null 2>&1; then
|
|
||||||
lxd init --auto || true
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_fedora_rhel() {
|
install_fedora_rhel() {
|
||||||
dnf install -y \
|
dnf install -y \
|
||||||
libpq \
|
libpq \
|
||||||
openssl-libs \
|
openssl-libs \
|
||||||
|
|
@ -75,9 +68,9 @@ install_fedora_rhel() {
|
||||||
pkgconf-pkg-config \
|
pkgconf-pkg-config \
|
||||||
lxc \
|
lxc \
|
||||||
lxc-templates
|
lxc-templates
|
||||||
}
|
}
|
||||||
|
|
||||||
install_arch() {
|
install_arch() {
|
||||||
pacman -Sy --noconfirm \
|
pacman -Sy --noconfirm \
|
||||||
postgresql-libs \
|
postgresql-libs \
|
||||||
openssl \
|
openssl \
|
||||||
|
|
@ -90,9 +83,9 @@ install_arch() {
|
||||||
clang \
|
clang \
|
||||||
pkgconf \
|
pkgconf \
|
||||||
lxc
|
lxc
|
||||||
}
|
}
|
||||||
|
|
||||||
install_alpine() {
|
install_alpine() {
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
libpq \
|
libpq \
|
||||||
openssl \
|
openssl \
|
||||||
|
|
@ -105,9 +98,9 @@ install_alpine() {
|
||||||
clang \
|
clang \
|
||||||
pkgconf \
|
pkgconf \
|
||||||
lxc
|
lxc
|
||||||
}
|
}
|
||||||
|
|
||||||
case $OS in
|
case $OS in
|
||||||
ubuntu|debian|linuxmint|pop)
|
ubuntu|debian|linuxmint|pop)
|
||||||
install_debian_ubuntu
|
install_debian_ubuntu
|
||||||
;;
|
;;
|
||||||
|
|
@ -132,9 +125,9 @@ case $OS in
|
||||||
echo " - LXC (containers)"
|
echo " - LXC (containers)"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo -e "${GREEN}Runtime dependencies installed!${NC}"
|
echo -e "${GREEN}Runtime dependencies installed!${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "You can now run:"
|
echo "You can now run:"
|
||||||
echo " ./botserver"
|
echo " ./botserver"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue