| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | #!/bin/bash# Automatic install script for ArozOS - by tobychui# For internal use only, All Right Reserved# This code compitiable with Amazon Linux 2 and Debianserver="https://jenkins.alanyeung.co"echo "[ArozOS Installer]"echo "Jenkins Server: "echo $serverecho "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 $timetimeHuman=$(date -d "@$(($time/1000))")echo "$timeHuman"sleep 3echo "Installing necessary packages..."if [ -f /etc/os-release ]; then    # freedesktop.org and systemd    . /etc/os-release    OS=$NAMEelif type lsb_release >/dev/null 2>&1; then    # linuxbase.org    OS=$(lsb_release -si)elif [ -f /etc/lsb-release ]; then    # For some versions of Debian/Ubuntu without lsb_release command    . /etc/lsb-release    OS=$DISTRIB_IDelif [ -f /etc/debian_version ]; then    # Older Debian/Ubuntu/etc.    OS=Debianelse    # Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.    OS=$(uname -s)fiif [[ $OS == "Amazon Linux" ]]; then    echo "YUM Package Manager"    sudo yum update    sudo yum install epel-release    sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm    sudo yum install ffmpeg ffmpeg-devel samba git net-tools unzip -yelse#elif [[ $OS == "Debian" ]]; then    echo "APT Package Manager"    sudo apt upgrade -y    sudo apt-get update -y    sudo apt-get install ffmpeg samba git net-tools unzip -yfi    echo "Installing Web components from Jenkins..."wget $server/job/arozos/lastSuccessfulBuild/artifact/arozos_web_components.zipunzip arozos_web_components.zipecho "Creating ArozOS structure..."cd arozosecho "Installing Core binary from Jenkins...."arch=$(uname -i)sysname=$(uname | tr '[:upper:]' '[:lower:]')echo "Your system is $sysname"if [[ $arch == "x86_64" ]]; then    arch="i386"fiif [[ $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\_$archelse    wget $server/job/arozos/lastSuccessfulBuild/artifact/arozos_$sysname\_$archfimv arozos_$sysname\_$arch arozossudo chmod 777 -R ./printf "#%c/bin/bash\nsudo ./arozos -port 8080 -tls=true -tls_port 8443" ! | sudo tee -a ./start.shecho "Setting up system services"sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.servicecd /etc/systemd/system/username=$USERprintf "[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.serviceecho "Reloading daemon"sudo systemctl daemon-reloadecho "Registering systemctl service"sudo systemctl start arozos.serviceecho "Starting arozos"sudo systemctl enable arozos.servicethisip=$(hostname -I | cut -d' ' -f1)echo "Installation completed. Visit ArozOS web UI with http://$thisip:8080"
 |