From ca27a2d49df6ee2aaead4141cb95d9773b703418 Mon Sep 17 00:00:00 2001 From: hiCasper Date: Thu, 15 Dec 2022 17:53:17 +0800 Subject: [PATCH] Revert changes --- scripts/install.sh | 41 +++++++++++++++------------------ scripts/install_dev.sh | 46 ++++++++++++++++--------------------- scripts/update.sh | 51 +++++++++++++++++++---------------------- scripts/update_dev.sh | 52 +++++++++++++++++++----------------------- 4 files changed, 84 insertions(+), 106 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 67a803229..4e34b67e6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -20,42 +20,37 @@ if [ "$EUID" -ne 0 ] exit fi -# macOS if [ ${_os} == "Darwin" ]; then OSNAME='macos' -# SUSE Linux elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh zypper install cron wget curl zip unzip -# FreeBSD elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' -# Arch Linux -elif [ -f /etc/arch-release ]; then - OSNAME='arch' - pacman -Syu --noconfirm - pacman -S --noconfirm curl cronie -# Enterprise Linux -elif [ -f /etc/redhat-release ]; then - if grep -Eq "AlmaLinux" /etc/redhat-release ; then OSNAME='alma'; - elif grep -Eq "CentOS" /etc/redhat-release ; then OSNAME='centos'; - elif grep -Eq "Rocky" /etc/redhat-release ; then OSNAME='rocky'; - elif grep -Eq "Red Hat" /etc/redhat-release ; then OSNAME='rhel'; - fi +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/redhat-release; then + OSNAME='rhel' + yum install -y wget curl zip unzip tar crontabs +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='fedora' + yum install -y wget curl zip unzip tar crontabs +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/redhat-release; then + OSNAME='rhel' + yum install -y wget curl zip unzip tar crontabs +elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/redhat-release; then OSNAME='rhel' - if grep -Eq "Amazon Linux" /etc/redhat-release ; then OSNAME='amazon'; fi - if grep -Eq "Fedora" /etc/redhat-release ; then OSNAME='fedora'; fi yum install -y wget curl zip unzip tar crontabs -# Debian / Ubuntu -elif [ -f /etc/lsb-release ]; then +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget curl zip unzip tar crontabs +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/os-release; then OSNAME='debian' - if grep -Eq "Ubuntu" /etc/os-release; then OSNAME='ubuntu'; - elif grep -Eq "Debian" /etc/os-release; then OSNAME='debian'; - fi apt update -y apt install -y wget curl zip unzip tar cron -# Others +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/os-release; then + OSNAME='ubuntu' + apt update -y + apt install -y wget curl zip unzip tar cron else OSNAME='unknow' fi diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index 3184d8b9f..67a8fb20f 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -25,42 +25,36 @@ if [ "$EUID" -ne 0 ] fi -# macOS if [ ${_os} == "Darwin" ]; then OSNAME='macos' -# SUSE Linux elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh - zypper install cron wget curl zip unzip -# FreeBSD elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' -# Arch Linux -elif [ -f /etc/arch-release ]; then - OSNAME='arch' - pacman -Syu --noconfirm - pacman -S --noconfirm curl cronie -# Enterprise Linux -elif [ -f /etc/redhat-release ]; then - if grep -Eq "AlmaLinux" /etc/redhat-release ; then OSNAME='alma'; - elif grep -Eq "CentOS" /etc/redhat-release ; then OSNAME='centos'; - elif grep -Eq "Rocky" /etc/redhat-release ; then OSNAME='rocky'; - elif grep -Eq "Red Hat" /etc/redhat-release ; then OSNAME='rhel'; - fi +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='rhel' + yum install -y wget zip unzip +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='fedora' + yum install -y wget zip unzip +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then OSNAME='rhel' - if grep -Eq "Amazon Linux" /etc/redhat-release ; then OSNAME='amazon'; fi - if grep -Eq "Fedora" /etc/redhat-release ; then OSNAME='fedora'; fi - yum install -y wget curl zip unzip tar crontabs -# Debian / Ubuntu -elif [ -f /etc/lsb-release ]; then + yum install -y wget zip unzip +elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then + OSNAME='rhel' + yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' - if grep -Eq "Ubuntu" /etc/os-release; then OSNAME='ubuntu'; - elif grep -Eq "Debian" /etc/os-release; then OSNAME='debian'; - fi apt update -y - apt install -y wget curl zip unzip tar cron -# Others + apt install -y devscripts + apt install -y wget zip unzip +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='ubuntu' + apt install -y wget zip unzip else OSNAME='unknow' fi diff --git a/scripts/update.sh b/scripts/update.sh index ecad1b178..ee93efe59 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -19,42 +19,37 @@ if [ ${_os} != "Darwin" ] && [ ! -d /www/server/mdserver-web/logs ]; then fi { -# macOS + if [ ${_os} == "Darwin" ]; then OSNAME='macos' -# SUSE Linux elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh - zypper install cron wget curl zip unzip -# FreeBSD elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' -# Arch Linux -elif [ -f /etc/arch-release ]; then - OSNAME='arch' - pacman -Syu --noconfirm - pacman -S --noconfirm curl cronie -# Enterprise Linux -elif [ -f /etc/redhat-release ]; then - if grep -Eq "AlmaLinux" /etc/redhat-release ; then OSNAME='alma'; - elif grep -Eq "CentOS" /etc/redhat-release ; then OSNAME='centos'; - elif grep -Eq "Rocky" /etc/redhat-release ; then OSNAME='rocky'; - elif grep -Eq "Red Hat" /etc/redhat-release ; then OSNAME='rhel'; - fi - OSNAME='rhel' - if grep -Eq "Amazon Linux" /etc/redhat-release ; then OSNAME='amazon'; fi - if grep -Eq "Fedora" /etc/redhat-release ; then OSNAME='fedora'; fi - yum install -y wget curl zip unzip tar crontabs -# Debian / Ubuntu -elif [ -f /etc/lsb-release ]; then +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='centos' + yum install -y wget zip unzip +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='fedora' + yum install -y wget zip unzip +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then + OSNAME='rocky' + yum install -y wget zip unzip +elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then + OSNAME='alma' + yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' - if grep -Eq "Ubuntu" /etc/os-release; then OSNAME='ubuntu'; - elif grep -Eq "Debian" /etc/os-release; then OSNAME='debian'; - fi - apt update -y - apt install -y wget curl zip unzip tar cron -# Others + apt install -y wget zip unzip +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='ubuntu' + apt install -y wget zip unzip +elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + OSNAME='raspbian' else OSNAME='unknow' fi diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index af92153f2..4e58d725a 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -19,47 +19,41 @@ if [ ${_os} != "Darwin" ] && [ ! -d /www/server/mdserver-web/logs ]; then fi { -# macOS + if [ ${_os} == "Darwin" ]; then OSNAME='macos' -# SUSE Linux elif grep -Eq "openSUSE" /etc/*-release; then OSNAME='opensuse' zypper refresh - zypper install cron wget curl zip unzip -# FreeBSD elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' -# Arch Linux -elif [ -f /etc/arch-release ]; then - OSNAME='arch' - pacman -Syu --noconfirm - pacman -S --noconfirm curl cronie -# Enterprise Linux -elif [ -f /etc/redhat-release ]; then - if grep -Eq "AlmaLinux" /etc/redhat-release ; then OSNAME='alma'; - elif grep -Eq "CentOS" /etc/redhat-release ; then OSNAME='centos'; - elif grep -Eq "Rocky" /etc/redhat-release ; then OSNAME='rocky'; - elif grep -Eq "Red Hat" /etc/redhat-release ; then OSNAME='rhel'; - fi - OSNAME='rhel' - if grep -Eq "Amazon Linux" /etc/redhat-release ; then OSNAME='amazon'; fi - if grep -Eq "Fedora" /etc/redhat-release ; then OSNAME='fedora'; fi - yum install -y wget curl zip unzip tar crontabs -# Debian / Ubuntu -elif [ -f /etc/lsb-release ]; then +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='centos' + yum install -y wget zip unzip +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='fedora' + yum install -y wget zip unzip +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then + OSNAME='rocky' + yum install -y wget zip unzip +elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then + OSNAME='alma' + yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' - if grep -Eq "Ubuntu" /etc/os-release; then OSNAME='ubuntu'; - elif grep -Eq "Debian" /etc/os-release; then OSNAME='debian'; - fi - apt update -y - apt install -y wget curl zip unzip tar cron -# Others + apt install -y wget zip unzip +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='ubuntu' + apt install -y wget zip unzip +elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + OSNAME='raspbian' else OSNAME='unknow' fi - cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") if [ ! -z "$cn" ];then curl -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip