From b8919ceb0d5b1dc4263a032040425f3145660036 Mon Sep 17 00:00:00 2001 From: Bozhidar Slaveykov Date: Thu, 23 Nov 2023 20:13:24 +0200 Subject: [PATCH] update --- installers/Ubuntu/22.04/install.sh | 29 +++++++++++++++++++++++++++++ installers/install.sh | 16 ++++++++++++++++ installers/ubuntu-22/install.sh | 0 shell/helpers/ubuntu/common.sh | 14 ++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 installers/Ubuntu/22.04/install.sh delete mode 100644 installers/ubuntu-22/install.sh create mode 100644 shell/helpers/ubuntu/common.sh diff --git a/installers/Ubuntu/22.04/install.sh b/installers/Ubuntu/22.04/install.sh new file mode 100644 index 0000000..11012fb --- /dev/null +++ b/installers/Ubuntu/22.04/install.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +HELPERS_DIR="$(dirname "$(pwd)")/shell/helpers/ubuntu" +. $HELPERS_DIR"/common.sh" + +# Update the system +#apt update && apt upgrade -y + +DEPENDENCIES_LIST=( + "curl" + "wget" + "git" + "nodejs" + "npm" + "unzip" + "zip" + "tar" + "php" +) +# Check if the dependencies are installed +for DEPENDENCY in "${DEPENDENCIES_LIST[@]}"; do + if ! command_is_installed $DEPENDENCY; then + echo "Dependency $DEPENDENCY is not installed." + echo "Installing $DEPENDENCY..." + apt install -y $DEPENDENCY + else + echo "Dependency $DEPENDENCY is installed." + fi +done diff --git a/installers/install.sh b/installers/install.sh index 7e6d145..cbdbf51 100644 --- a/installers/install.sh +++ b/installers/install.sh @@ -30,3 +30,19 @@ if [[ $(cat /etc/os-release | grep -w "ID_LIKE" | cut -d "=" -f 2) != "debian" ] exit 1 fi +# Check if the user is running a supported distro version +DISTRO_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2) +DISTRO_VERSION=${DISTRO_VERSION//\"/} # Remove quotes from version string + +DISTRO_NAME=$(cat /etc/os-release | grep -w "NAME" | cut -d "=" -f 2) +DISTRO_NAME=${DISTRO_NAME//\"/} # Remove quotes from name string + +DISTRO_INSTALLER_FILE="./${DISTRO_NAME}/${DISTRO_VERSION}/install.sh" +if [[ ! -f $DISTRO_INSTALLER_FILE ]]; then + echo "AlphaXPanel not supporting this version of distribution" + echo "Distro: ${DISTRO_NAME} Version: ${DISTRO_VERSION}" + echo "Exiting..." + # exit 1 +fi + +bash $DISTRO_INSTALLER_FILE diff --git a/installers/ubuntu-22/install.sh b/installers/ubuntu-22/install.sh deleted file mode 100644 index e69de29..0000000 diff --git a/shell/helpers/ubuntu/common.sh b/shell/helpers/ubuntu/common.sh new file mode 100644 index 0000000..de4b525 --- /dev/null +++ b/shell/helpers/ubuntu/common.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +function command_is_installed() { + + CHECK_COMMAND=$1 + + if [[ $(command -v $CHECK_COMMAND) == "" ]]; then + return 1 + else + return 0 + fi + +} +