2019-05-08 17:13:04 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-02-12 22:46:17 +08:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# CentOS 环境初始化脚本
|
|
|
|
# @author Zhang Peng
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ libs
|
|
|
|
# 装载其它库
|
|
|
|
LINUX_SCRIPTS_DIR=$(cd `dirname $0`; pwd)
|
|
|
|
|
|
|
|
if [[ ! -x ${LINUX_SCRIPTS_DIR}/lib/utils.sh ]]; then
|
|
|
|
logError "必要脚本库 ${LINUX_SCRIPTS_DIR}/lib/utils.sh 不存在!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
source ${LINUX_SCRIPTS_DIR}/lib/utils.sh
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ functions
|
|
|
|
|
|
|
|
# 打印头部信息
|
|
|
|
printHeadInfo() {
|
|
|
|
printf "${C_B_BLUE}\n"
|
2019-10-24 22:00:00 +08:00
|
|
|
cat << EOF
|
2019-05-08 17:13:04 +08:00
|
|
|
###################################################################################
|
2019-10-24 22:00:00 +08:00
|
|
|
# 欢迎使用 Dunwu Shell 环境初始化脚本(设置环境配置、安装基本的命令工具)
|
|
|
|
# 适用于 Linux CentOS 环境
|
2019-05-08 17:13:04 +08:00
|
|
|
# @author: Zhang Peng
|
|
|
|
###################################################################################
|
|
|
|
EOF
|
2020-02-12 22:46:17 +08:00
|
|
|
printf "${C_RESET}\n"
|
|
|
|
}
|
2019-05-08 17:13:04 +08:00
|
|
|
|
2019-10-10 08:56:31 +08:00
|
|
|
menus=( "替换yum镜像" "安装基本的命令工具" "安装常用libs" "系统配置" "全部执行" "退出" )
|
2019-05-08 17:13:04 +08:00
|
|
|
main() {
|
2019-10-29 18:22:19 +08:00
|
|
|
PS3="请输入命令编号:"
|
|
|
|
select item in "${menus[@]}"
|
|
|
|
do
|
|
|
|
case ${item} in
|
|
|
|
"替换yum镜像")
|
2020-02-12 22:46:17 +08:00
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/change-yum-repo.sh
|
2019-10-29 18:22:19 +08:00
|
|
|
main ;;
|
|
|
|
"安装基本的命令工具")
|
2020-02-12 22:46:17 +08:00
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/install-tools.sh
|
2019-10-29 18:22:19 +08:00
|
|
|
main ;;
|
|
|
|
"安装常用libs")
|
2020-02-12 22:46:17 +08:00
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/install-libs.sh
|
2019-10-29 18:22:19 +08:00
|
|
|
main ;;
|
|
|
|
"系统配置")
|
2020-02-12 22:46:17 +08:00
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/sys-settings.sh ${LINUX_SCRIPTS_DIR}/sys
|
2019-10-29 18:22:19 +08:00
|
|
|
main ;;
|
|
|
|
"全部执行")
|
2020-02-12 22:46:17 +08:00
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/change-yum-repo.sh
|
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/install-tools.sh
|
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/install-libs.sh
|
|
|
|
sh ${LINUX_SCRIPTS_DIR}/sys/sys-settings.sh ${LINUX_SCRIPTS_DIR}/sys
|
|
|
|
logInfo "执行完毕,退出" ;;
|
2019-10-29 18:22:19 +08:00
|
|
|
"退出")
|
|
|
|
exit 0 ;;
|
|
|
|
*)
|
2020-02-12 22:46:17 +08:00
|
|
|
logWarn "输入项不支持!"
|
2019-10-29 18:22:19 +08:00
|
|
|
main ;;
|
|
|
|
esac
|
|
|
|
break
|
|
|
|
done
|
2019-05-08 17:13:04 +08:00
|
|
|
}
|
|
|
|
|
2020-02-12 22:46:17 +08:00
|
|
|
# ------------------------------------------------------------------------------ main
|
|
|
|
|
|
|
|
printHeadInfo
|
2019-05-08 17:13:04 +08:00
|
|
|
main
|