浏览代码

Updated auto install script

Compatible with AWS lightsail Debian
AY 3 年之前
父节点
当前提交
a9189ef292

+ 64 - 0
documents/headless setup files/install_latest_hkwtc.sh

@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Automatic install script for ArozOS - by tobychui
+# For internal use only, All Right Reserved
+echo "[ArozOS Installer]"
+echo "Updating apt"
+sudo apt upgrade -y
+sudo apt-get update -y
+sudo apt-get install ffmpeg samba git net-tools -y
+
+echo "Cloning ArozOS from source"
+git clone https://git.hkwtc.org/TC/arozos.git
+
+echo "Installing Golang"
+arch=$(uname -i)
+gover="1.17.6"
+if [[ $arch == x86_64* ]]; then
+    echo "Selecting x64 Architecture"
+    wget https://golang.org/dl/go$gover.linux-amd64.tar.gz
+elif  [[ $arch == arm* ]]; then
+    echo "Selecting ARM Architecture"
+    wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
+elif [[ $arch == "unknown" ]]; then
+    echo "Unknown CPU arch. Please enter CPU architecture manually (arm/arm64/amd64)"
+    read -p "Architecture: " arch
+    if [ "$arch" = "arm" ]; then
+        echo "Installing arm version of go"
+        wget https://golang.org/dl/go$gover.linux-armv6l.tar.gz
+    fi
+    if [ "$arch" = "arm64" ]; then
+	echo "Installing arm64 version of go"
+	wget https://golang.org/dl/go$gover.linux-arm64.tar.gz
+    fi
+
+    if [ "$arch" = "amd64" ]; then
+	echo "Installing amd64 version of go"
+	wget https://golang.org/dl/go$gover.linux-amd64.tar.gz
+    fi
+fi
+sudo tar -C /usr/local -xzf go*
+echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
+PATH=$PATH:/usr/local/go/bin
+
+echo "Building ArozOS"
+cd arozos
+sudo chmod 777 -R ./
+cd src
+go mod tidy
+go build
+
+echo "Setting up system services"
+sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service
+cd /etc/systemd/system/
+
+printf "[Unit]\nDescription=ArozOS Cloud Service\nAfter=systemd-networkd-wait-online.service\nWants=systemd-networkd-wait-online.service\n\n[Service]\nType=simple\nExecStartPre=/bin/sleep 10\nWorkingDirectory=/home/pi/arozos/src/\nExecStart=/bin/bash /home/pi/arozos/src/start.sh\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target" | sudo tee -a ./arozos.service
+
+echo "Registering systemctl service"
+sudo systemctl start arozos.service
+
+echo "Starting arozos"
+sudo systemctl enable arozos.service
+
+thisip=$(hostname -I | cut -d' ' -f1)
+echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"

+ 63 - 0
documents/headless setup files/install_latest_jenkins.sh

@@ -0,0 +1,63 @@
+#!/bin/bash
+
+# Automatic install script for ArozOS - by tobychui
+# For internal use only, All Right Reserved
+
+server="https://jenkins.alanyeung.co"
+echo "[ArozOS Installer]"
+echo "Jenkins Server: "
+echo $server
+echo "You are downloading: "
+curl -slient $server/job/arozos/lastBuild/api/json | grep -iEo '"fullDisplayName":"([^"]*)"' | awk -F ":" '{gsub(/"/, "", $2);print $2}'
+echo "With build timestamp: "
+time=$(curl -slient $server/job/arozos/lastBuild/api/json | grep -iEo '"timestamp":([0-9]*)'  | awk -F ":" '{gsub(/"/, "", $2);print $2}')
+echo $time
+timeHuman=$(date -d "@$(($time/1000))")
+echo "$timeHuman"
+sleep 3
+
+echo "Updating apt"
+sudo apt upgrade -y
+sudo apt-get update -y
+sudo apt-get install ffmpeg samba git net-tools unzip -y
+
+echo "Installing Web components from Jenkins..."
+wget $server/job/arozos/lastSuccessfulBuild/artifact/arozos_web_components.zip
+unzip arozos_web_components.zip
+
+echo "Creating ArozOS structure..."
+cd arozos
+sudo chmod 777 -R ./
+
+echo "Installing Core binary from Jenkins...."
+arch=$(uname -i)
+sysname=$(uname | tr '[:upper:]' '[:lower:]')
+echo "Your system is $sysname"
+if [[ $arch == "unknown" ]]; then
+    echo "Unknown CPU arch. Please enter CPU architecture manually (arm/arm64/amd64/i386/armv7/misple)"
+    read -p "Architecture: " arch
+    wget $server/job/arozos/lastSuccessfulBuild/artifact/arozos_$sysname\_$arch
+else
+    wget $server/job/arozos/lastSuccessfulBuild/artifact/arozos_$sysname\_$arch
+fi
+
+mv arozos_$sysname\_$arch arozos
+printf "#%c/bin/bash\nsudo ./arozos -port 8080 -tls=true -tls_port 8443" ! | sudo tee -a ./start.sh
+
+echo "Setting up system services"
+sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service
+cd /etc/systemd/system/
+
+username=$USER
+printf "[Unit]\nDescription=ArozOS Cloud Service\nAfter=systemd-networkd-wait-online.service\nWants=systemd-networkd-wait-online.service\n\n[Service]\nType=simple\nExecStartPre=/bin/sleep 10\nWorkingDirectory=/home/$username/arozos/\nExecStart=/bin/bash /home/$username/arozos/start.sh\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target" | sudo tee -a ./arozos.service
+
+echo "Reloading daemon"
+sudo systemctl daemon-reload
+echo "Registering systemctl service"
+sudo systemctl start arozos.service
+
+echo "Starting arozos"
+sudo systemctl enable arozos.service
+
+thisip=$(hostname -I | cut -d' ' -f1)
+echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"

+ 2 - 2
documents/headless setup files/arozos_installer.sh → documents/headless setup files/install_release_github.sh

@@ -1,4 +1,4 @@
-#/bin/bash
+#!/bin/bash
 
 # Automatic install script for ArozOS - by tobychui
 # For internal use only, All Right Reserved
@@ -60,5 +60,5 @@ sudo systemctl start arozos.service
 echo "Starting arozos"
 sudo systemctl enable arozos.service
 
-thisip=$(hostname -I)
+thisip=$(hostname -I | cut -d' ' -f1)
 echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"