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
|
||||
#
|
||||
# DEPENDENCIES.sh - Runtime Dependencies for General Bots
|
||||
#
|
||||
# This script installs all system packages required to RUN botserver binary.
|
||||
# These are the minimal dependencies needed for production deployment.
|
||||
#
|
||||
# Usage: sudo ./DEPENDENCIES.sh
|
||||
#
|
||||
#!/bin/bash
|
||||
#
|
||||
# DEPENDENCIES.sh - Runtime Dependencies for General Bots
|
||||
#
|
||||
# This script installs all system packages required to RUN botserver binary.
|
||||
# These are the minimal dependencies needed for production deployment.
|
||||
#
|
||||
# Usage: sudo ./DEPENDENCIES.sh
|
||||
#
|
||||
|
||||
set -e
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo -e "${GREEN} General Bots Runtime Dependencies${NC}"
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
echo -e "${GREEN} General Bots Runtime Dependencies${NC}"
|
||||
echo -e "${GREEN}========================================${NC}"
|
||||
|
||||
# Check root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
# Check root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo -e "${RED}Error: Run as root (use sudo)${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Detect OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
# Detect OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
OS=$ID
|
||||
else
|
||||
else
|
||||
echo -e "${RED}Error: Cannot detect OS${NC}"
|
||||
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 \
|
||||
libpq5 \
|
||||
libssl3 \
|
||||
|
|
@ -47,21 +47,14 @@ install_debian_ubuntu() {
|
|||
ca-certificates \
|
||||
curl \
|
||||
wget \
|
||||
libabseil20210324 \
|
||||
libclang1 \
|
||||
pkg-config \
|
||||
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 \
|
||||
libpq \
|
||||
openssl-libs \
|
||||
|
|
@ -75,9 +68,9 @@ install_fedora_rhel() {
|
|||
pkgconf-pkg-config \
|
||||
lxc \
|
||||
lxc-templates
|
||||
}
|
||||
}
|
||||
|
||||
install_arch() {
|
||||
install_arch() {
|
||||
pacman -Sy --noconfirm \
|
||||
postgresql-libs \
|
||||
openssl \
|
||||
|
|
@ -90,9 +83,9 @@ install_arch() {
|
|||
clang \
|
||||
pkgconf \
|
||||
lxc
|
||||
}
|
||||
}
|
||||
|
||||
install_alpine() {
|
||||
install_alpine() {
|
||||
apk add --no-cache \
|
||||
libpq \
|
||||
openssl \
|
||||
|
|
@ -105,9 +98,9 @@ install_alpine() {
|
|||
clang \
|
||||
pkgconf \
|
||||
lxc
|
||||
}
|
||||
}
|
||||
|
||||
case $OS in
|
||||
case $OS in
|
||||
ubuntu|debian|linuxmint|pop)
|
||||
install_debian_ubuntu
|
||||
;;
|
||||
|
|
@ -132,9 +125,9 @@ case $OS in
|
|||
echo " - LXC (containers)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
echo -e "${GREEN}Runtime dependencies installed!${NC}"
|
||||
echo ""
|
||||
echo "You can now run:"
|
||||
echo " ./botserver"
|
||||
echo -e "${GREEN}Runtime dependencies installed!${NC}"
|
||||
echo ""
|
||||
echo "You can now run:"
|
||||
echo " ./botserver"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue