#!/bin/bash set -e while [ "$1" != "" ]; do case $1 in -ds | --download-scripts ) if [ "$2" != "" ]; then DOWNLOAD_SCRIPTS=$2 shift fi ;; -arg | --arguments ) if [ "$2" != "" ]; then ARGUMENTS=$2 shift fi ;; -pi | --production-install ) if [ "$2" != "" ]; then PRODUCTION_INSTALL=$2 shift fi ;; -li | --local-install ) if [ "$2" != "" ]; then LOCAL_INSTALL=$2 shift fi ;; -lu | --local-update ) if [ "$2" != "" ]; then LOCAL_UPDATE=$2 shift fi ;; -tr | --test-repo ) if [ "$2" != "" ]; then TEST_REPO_ENABLE=$2 shift fi ;; esac shift done export TERM=xterm-256color^M SERVICES_SYSTEMD=( "docspace-api.service" "docspace-doceditor.service" "docspace-studio-notify.service" "docspace-files.service" "docspace-notify.service" "docspace-studio.service" "docspace-backup-background.service" "docspace-files-services.service" "docspace-people-server.service" "docspace-backup.service" "docspace-healthchecks.service" "docspace-socket.service" "docspace-clear-events.service" "docspace-login.service" "docspace-ssoauth.service" "ds-converter.service" "ds-docservice.service" "ds-metrics.service") function common::get_colors() { COLOR_BLUE=$'\e[34m' COLOR_GREEN=$'\e[32m' COLOR_RED=$'\e[31m' COLOR_RESET=$'\e[0m' COLOR_YELLOW=$'\e[33m' export COLOR_BLUE export COLOR_GREEN export COLOR_RED export COLOR_RESET export COLOR_YELLOW } ############################################################################################# # Checking available resources for a virtual machine # Globals: # None # Arguments: # None # Outputs: # None ############################################################################################# function check_hw() { local FREE_RAM=$(free -h) local FREE_CPU=$(nproc) echo "${COLOR_RED} ${FREE_RAM} ${COLOR_RESET}" echo "${COLOR_RED} ${FREE_CPU} ${COLOR_RESET}" } ############################################################################################# # Prepare vagrant boxes like: set hostname/remove postfix for DEB distributions # Globals: # None # Arguments: # None # Outputs: # ☑ PREPAVE_VM: **** ############################################################################################# function prepare_vm() { if [ -f /etc/lsb-release ] ; then DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'` REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'` DISTRIB_CODENAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'` DISTRIB_RELEASE=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'` elif [ -f /etc/lsb_release ] || [ -f /usr/bin/lsb_release ] ; then DIST=`lsb_release -a 2>&1 | grep 'Distributor ID:' | awk -F ":" '{print $2 }'` REV=`lsb_release -a 2>&1 | grep 'Release:' | awk -F ":" '{print $2 }'` DISTRIB_CODENAME=`lsb_release -a 2>&1 | grep 'Codename:' | awk -F ":" '{print $2 }'` DISTRIB_RELEASE=`lsb_release -a 2>&1 | grep 'Release:' | awk -F ":" '{print $2 }'` elif [ -f /etc/os-release ] ; then DISTRIB_CODENAME=$(grep "VERSION=" /etc/os-release |awk -F= {' print $2'}|sed s/\"//g |sed s/[0-9]//g | sed s/\)$//g |sed s/\(//g | tr -d '[:space:]') DISTRIB_RELEASE=$(grep "VERSION_ID=" /etc/os-release |awk -F= {' print $2'}|sed s/\"//g |sed s/[0-9]//g | sed s/\)$//g |sed s/\(//g | tr -d '[:space:]') fi DIST=`echo "$DIST" | tr '[:upper:]' '[:lower:]' | xargs`; DISTRIB_CODENAME=`echo "$DISTRIB_CODENAME" | tr '[:upper:]' '[:lower:]' | xargs`; REV=`echo "$REV" | xargs`; if [ ! -f /etc/centos-release ]; then if [ "${DIST}" = "debian" ]; then if [ "${DISTRIB_CODENAME}" == "bookworm" ]; then apt-get update -y apt install -y curl gnupg fi apt-get remove postfix -y echo "${COLOR_GREEN}☑ PREPAVE_VM: Postfix was removed${COLOR_RESET}" fi if [ "${TEST_REPO_ENABLE}" == 'true' ]; then mkdir -p -m 700 $HOME/.gnupg echo "deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] https://nexus.onlyoffice.com/repository/4testing-debian stable main" | sudo tee /etc/apt/sources.list.d/onlyoffice4testing.list curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/onlyoffice.gpg --import chmod 644 /usr/share/keyrings/onlyoffice.gpg fi fi if [ -f /etc/centos-release ]; then if [ "${TEST_REPO_ENABLE}" == 'true' ]; then cat > /etc/yum.repos.d/onlyoffice4testing.repo <