From 9b1146780ce62eaf663ad382436809620d335c41 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 1 Apr 2024 13:12:28 +0430 Subject: OS - Oracle Linux --- install.sh | 62 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 25 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index a9b6711b..692e9e7e 100644 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ else fi echo "The OS release is: $release" -arch3xui() { +arch() { case "$(uname -m)" in x86_64 | x64 | amd64) echo 'amd64' ;; i*86 | x86) echo '386' ;; @@ -35,12 +35,18 @@ arch3xui() { esac } -echo "arch: $(arch3xui)" +echo "arch: $(arch)" os_version="" os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1) -if [[ "${release}" == "centos" ]]; then +if [[ "${release}" == "arch" ]]; then + echo "Your OS is Arch Linux" +elif [[ "${release}" == "manjaro" ]]; then + echo "Your OS is Manjaro" +elif [[ "${release}" == "armbian" ]]; then + echo "Your OS is Armbian" +elif [[ "${release}" == "centos" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1 fi @@ -48,40 +54,46 @@ elif [[ "${release}" == "ubuntu" ]]; then if [[ ${os_version} -lt 20 ]]; then echo -e "${red} Please use Ubuntu 20 or higher version!${plain}\n" && exit 1 fi - elif [[ "${release}" == "fedora" ]]; then if [[ ${os_version} -lt 36 ]]; then echo -e "${red} Please use Fedora 36 or higher version!${plain}\n" && exit 1 fi - elif [[ "${release}" == "debian" ]]; then if [[ ${os_version} -lt 11 ]]; then echo -e "${red} Please use Debian 11 or higher ${plain}\n" && exit 1 fi - elif [[ "${release}" == "almalinux" ]]; then if [[ ${os_version} -lt 9 ]]; then echo -e "${red} Please use AlmaLinux 9 or higher ${plain}\n" && exit 1 fi - elif [[ "${release}" == "rocky" ]]; then if [[ ${os_version} -lt 9 ]]; then - echo -e "${red} Please use RockyLinux 9 or higher ${plain}\n" && exit 1 + echo -e "${red} Please use Rocky Linux 9 or higher ${plain}\n" && exit 1 + fi +elif [[ "${release}" == "oracle" ]]; then + if [[ ${os_version} -lt 8 ]]; then + echo -e "${red} Please use Oracle Linux 8 or higher ${plain}\n" && exit 1 fi -elif [[ "${release}" == "arch" ]]; then - echo "Your OS is ArchLinux" -elif [[ "${release}" == "manjaro" ]]; then - echo "Your OS is Manjaro" -elif [[ "${release}" == "armbian" ]]; then - echo "Your OS is Armbian" - else - echo -e "${red}Failed to check the OS version, please contact the author!${plain}" && exit 1 + echo -e "${red}Your operating system is not supported by this script.${plain}\n" + echo "Please ensure you are using one of the following supported operating systems:" + echo "- Ubuntu 20.04+" + echo "- Debian 11+" + echo "- CentOS 8+" + echo "- Fedora 36+" + echo "- Arch Linux" + echo "- Manjaro" + echo "- Armbian" + echo "- AlmaLinux 9+" + echo "- Rocky Linux 9+" + echo "- Oracle Linux 8+" + exit 1 + fi install_base() { case "${release}" in - centos | almalinux | rocky) + centos | almalinux | rocky | oracle) yum -y update && yum install -y -q wget curl tar tzdata ;; fedora) @@ -141,16 +153,16 @@ install_x-ui() { exit 1 fi echo -e "Got x-ui latest version: ${last_version}, beginning the installation..." - wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch3xui).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch3xui).tar.gz + wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch).tar.gz if [[ $? -ne 0 ]]; then echo -e "${red}Downloading x-ui failed, please be sure that your server can access Github ${plain}" exit 1 fi else last_version=$1 - url="https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch3xui).tar.gz" + url="https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch).tar.gz" echo -e "Beginning to install x-ui $1" - wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch3xui).tar.gz ${url} + wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch).tar.gz ${url} if [[ $? -ne 0 ]]; then echo -e "${red}Download x-ui $1 failed,please check the version exists ${plain}" exit 1 @@ -162,18 +174,18 @@ install_x-ui() { rm /usr/local/x-ui/ -rf fi - tar zxvf x-ui-linux-$(arch3xui).tar.gz - rm x-ui-linux-$(arch3xui).tar.gz -f + tar zxvf x-ui-linux-$(arch).tar.gz + rm x-ui-linux-$(arch).tar.gz -f cd x-ui chmod +x x-ui # Check the system's architecture and rename the file accordingly - if [[ $(arch3xui) == "armv5" || $(arch3xui) == "armv6" || $(arch3xui) == "armv7" ]]; then - mv bin/xray-linux-$(arch3xui) bin/xray-linux-arm + if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then + mv bin/xray-linux-$(arch) bin/xray-linux-arm chmod +x bin/xray-linux-arm fi - chmod +x x-ui bin/xray-linux-$(arch3xui) + chmod +x x-ui bin/xray-linux-$(arch) cp -f x-ui.service /etc/systemd/system/ wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh chmod +x /usr/local/x-ui/x-ui.sh -- cgit v1.2.3