#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
lan='\033[0;34m'
purple='\033[35m'
redbg="\033[41;37m"
greenbg="\033[42;37m"

#检查账号
check_root(){
	if [[ $EUID != 0 ]];then
		echo -e "${redbg}当前不是ROOT账号，建议更换ROOT账号使用。${plain}"
	else
		echo -e "${greenbg}ROOT账号权限检查通过，祝你使用愉快！${plain}"
		sleep 1
	fi
}

#脚本启动
echo
check_root

get_opsy(){
    [ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return
    [ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return
    [ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
}

#变量引用
opsy=$( get_opsy )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
tram=$( free -m | awk '/Mem/ {print $2}' )
uram=$( free -m | awk '/Mem/ {print $3}' )
ipaddr=$(curl -s myip.ipip.net | awk -F ' ' '{print $2}' | awk -F '：' '{print $2}')
ipdz=$(curl -s myip.ipip.net | awk -F '：' '{print $3}')



#yiyan=`curl -s https://www.cvsea.cn/yiyan/yiyan/`;
yiyan=`curl -s https://likemc.xyz/60s/yan.php`;
guanyu=`curl -s https://likemc.xyz/%E4%B8%8D%E7%BB%AD%E8%B4%B9%E9%80%9A%E7%9F%A5.txt`;
zanz=`curl -s https://likemc.xyz/zanz.txt`;

fastbuilder() {
echo
echo -e "====================================================="
    echo -e "${green}${yiyan}${plain}"
    echo -e "操作系统${purple} $opsy ${plain}CPU${purple} $cores ${plain}核 系统内存${purple} $tram ${plain}MB${plain}"
    echo -e "IP地址${purple} $ipaddr $ipdz ${plain}"
    echo -e "====================================================="
    echo -e "
     ${plain}(${red}1${plain}) ${lan}安装FastBuilder
     ${plain}(${red}2${plain}) ${lan}安装Neomega
     ${plain}(${red}3${plain}) ${lan}安装Omega
     ${plain}(${red}4${plain}) ${lan}安装FastBuilder-Libre
     ${plain}(${yellow}5${plain}) ${yellow}赞助下载服务器${plain}"
    echo && read -p "请输入数字: " num

    case "${num}" in
        0) exit 0
        ;;
        1) bash -c "$(curl -fsSL https://likemc.xyz/fastbuilder.sh)"
        ;;
        2) bash -c "$(curl -fsSL https://likemc.xyz/newsOMEGA/install.sh)"
        ;;
        3) bash -c "$(curl -fsSL https://likemc.xyz/binary/install.sh)"
        ;;
        4) bash -c "$(curl -fsSL https://likemc.xyz/libre/libre.sh)"
        ;;
        5) echo -e "${purple}${zanz}${plain}" && termux-open-url https://wpa.qq.com/wpa_jump_page?v=3&uin=2690197367&site=qq&menu=yes
        ;;		
        *) echo -e "${red}请输入数字[0-6]${plain}"
        ;;
    esac
}
fastbuilder



