diff --git a/install/intall_cockpit.sh b/install/install_cockpit.sh similarity index 99% rename from install/intall_cockpit.sh rename to install/install_cockpit.sh index b09a6127..cf608313 100644 --- a/install/intall_cockpit.sh +++ b/install/install_cockpit.sh @@ -5,10 +5,6 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -CheckEnvironment -InstallCockpit - - function get_os_type() { if [ -f /etc/os-release ]; then . /etc/os-release @@ -128,14 +124,14 @@ if [ "$os_type" == 'Debian' ];then fi fi +# Todo: need replaced it with vars # Check port used if netstat -tuln | grep -qE ':(80|443|9000)\s'; then echo "Port 80,443,9000 is already in use." exit 1 else echo "Port 80,443, 9000 are free." -fi - +fi } @@ -214,4 +210,7 @@ echo "Set cockpit port to 9000 ..." sudo sed -i 's/ListenStream=9090/ListenStream=9000/' /lib/systemd/system/cockpit.socket -} \ No newline at end of file +} + +CheckEnvironment +InstallCockpit \ No newline at end of file diff --git a/install/install_docker.sh b/install/install_docker.sh index ff797676..d94ea08e 100644 --- a/install/install_docker.sh +++ b/install/install_docker.sh @@ -2,8 +2,6 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -InstallDocker - InstallDocker(){ @@ -68,4 +66,6 @@ if ! docker network inspect websoft9 > /dev/null 2>&1; then sudo docker network create websoft9 fi -} \ No newline at end of file +} + +InstallDocker \ No newline at end of file diff --git a/install/install_new.sh b/install/install_new.sh index 61fcda5e..8cd4765d 100644 --- a/install/install_new.sh +++ b/install/install_new.sh @@ -5,12 +5,15 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -# Define vars -install_path="/data/websoft9" -urls="https://w9artifact.blob.core.windows.net/release/websoft9" +# Define global vars +export http_port=80 +export https_port=443 +export cockpit_port=9000 +export install_path="/data/websoft9" +export urls="https://w9artifact.blob.core.windows.net/release/websoft9" if [[ "$1" == "dev" ]]; then echo "update by dev artifact" - urls="https://w9artifact.blob.core.windows.net/dev/websoft9" + export urls="https://w9artifact.blob.core.windows.net/dev/websoft9" fi # Install runtime @@ -21,13 +24,13 @@ bash install_docker.sh bash install_cockpit.sh bash install_plugins.sh -# Install backend service +# Install backend services cd $install_path/docker sudo docker network create websoft9 sudo docker compose -p websoft9 up -d # Install Systemd service -cd $install_path/systemd +cp $install_path/systemd/websoft9.service /lib/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable websoft9.service sudo systemctl start websoft9 \ No newline at end of file diff --git a/install/install_plugins.sh b/install/install_plugins.sh index 34de920e..bc4f6d74 100644 --- a/install/install_plugins.sh +++ b/install/install_plugins.sh @@ -1,9 +1,8 @@ - #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -InstallPlugins + ### -----------------------------------------------------### @@ -132,3 +131,5 @@ cp -r /data/apps/websoft9/cockpit/menu_override/* /etc/cockpit echo "---------------------------------- Install success! When installation completed, you can access it by: http://Internet IP:9000 and using Linux user for login to install a app by websoft9's appstore. -------------------------------------------------------" } + +InstallPlugins diff --git a/install/install_tools.sh b/install/install_tools.sh index 9f7d82a9..dd1c5822 100644 --- a/install/install_tools.sh +++ b/install/install_tools.sh @@ -2,57 +2,32 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -InstallTools +echo "Starting InstallTools..." -### -----------------------------------------------------### InstallTools(){ echo "Prepare to install Tools ..." -if [ "$os_type" == 'CentOS' ] || [ "$os_type" == 'Rocky Linux' ] || [ "$os_type" == 'CentOS Stream' ] || [ "$os_type" == 'Fedora' ] || [ "$os_type" == 'OracleLinux' ] || [ "$os_type" == 'Redhat' ];then - sudo yum update -y - sudo yum install git curl wget yum-utils jq bc unzip -y +#!/bin/bash -fi +dnf --version >/dev/null 2>&1 || yum --version >/dev/null 2>&1 || apt --version >/dev/null 2>&1 -if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then - while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do +if [ $? -eq 0 ]; then + dnf install git curl wget yum-utils jq bc unzip -y +elif [ $? -eq 0 ]; then + yum install git curl wget yum-utils jq bc unzip -y +elif [ $? -eq 0 ]; then + while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do echo "Waiting for other software managers to finish..." sleep 5 - done - sudo apt update -y 1>/dev/null 2>&1 - if command -v git > /dev/null;then - echo "git installed ..." - else - sudo apt install git -y - fi - if command -v curl > /dev/null;then - echo "jcurlq installed ..." - else - sudo apt install curl -y - fi - if command -v wget > /dev/null;then - echo "wget installed ..." - else - sudo apt install wget -y - fi - if command -v jq > /dev/null;then - echo "jq installed ..." - else - sudo apt install jq -y - fi - - if command -v bc > /dev/null;then - echo "bc installed ..." - else - sudo apt install bc -y - fi - if command -v unzip > /dev/null;then - echo "unzip installed ..." - else - sudo apt install unzip -y - fi + done + sudo apt update -y 1>/dev/null 2>&1 + apt install curl wget yum-utils jq bc unzip -y --assume-yes +else + echo "None of the required package managers are installed." fi } + +InstallTools \ No newline at end of file