#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#Check Root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }

echo "欢迎使用 SSR-Bash (Python Base) Author"
echo "输入数字选择功能："
echo ""
echo "1.服务器控制"
echo "2.用户管理"
echo "3.全局流量管理"
echo "4.实验性功能"
echo "5.程序自检"
echo "6.卸载"
while :; do echo
	read -p "请选择： " choice
	if [[ ! $choice =~ ^[1-6]$ ]]; then
		echo "输入错误! 请输入正确的数字!"
	else
		break	
	fi
done

if [[ $choice == 1 ]];then
	bash /usr/local/SSR-Bash-Python/server.sh
fi

if [[ $choice == 2 ]];then
	bash /usr/local/SSR-Bash-Python/user.sh
fi

if [[ $choice == 3 ]];then
	bash /usr/local/SSR-Bash-Python/traffic.sh
fi

if [[ $choice == 4 ]];then
	bash /usr/local/SSR-Bash-Python/dev.sh
fi

if [[ $choice == 5 ]];then
	bash /usr/local/SSR-Bash-Python/self-check.sh
fi

if [[ $choice == 6 ]];then
	bash /usr/local/SSR-Bash-Python/uninstall.sh
fi
