From 33e4217c0cd54cfd714d9a302d9280665b68b287 Mon Sep 17 00:00:00 2001 From: lizw <1183409807@qq.com> Date: Mon, 31 Oct 2022 11:45:14 +0800 Subject: [PATCH] 07env-install-centos.sh --- 00base/07env-install-centos.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/00base/07env-install-centos.sh b/00base/07env-install-centos.sh index 0da70ee..8509576 100644 --- a/00base/07env-install-centos.sh +++ b/00base/07env-install-centos.sh @@ -57,6 +57,7 @@ SUDO_PASSWORD="" INIT_TAG="0" #--- 指令参数 UPDATE_YUM_REPOS="1" +CONFIG_TAG="1" ADD_USER_TAG="1" GIT_TAG="1" DSTAT_TAG="1" @@ -242,6 +243,19 @@ function init:update_yum_repos() { log::info "[update-yum-repos]" "yum源更新成功!" } +# 系统配置 +function init:config() { + log::info "[config]" "关闭系统防火墙..." + local host="127.0.0.1" + command::exec "${host}" " + # 停止防火墙 + systemctl stop firewalld + # 彻底关闭防火墙 + systemctl disable firewalld + " + log::info "[config]" "系统防火墙关闭成功!" +} + # 新增用户 function init:add_user() { log::info "[add-user]" "新增用户[${ADD_USER_NAME}]..." @@ -535,6 +549,7 @@ Available Commands: init 初始化系统 Flag: -update-yum-repos 是否更新yum源, 默认: '1' + -config 配置系统, 默认: '1' -add-user 是否新增用户, 默认: '1' -user-name 新增用户名, 默认: 'www' -base-dir 新增用户名, 默认: '/opt' @@ -571,6 +586,9 @@ while [ "${1:-}" != "" ]; do -update-yum-repos ) shift UPDATE_YUM_REPOS=${1:-UPDATE_YUM_REPOS} ;; + -config ) shift + CONFIG_TAG=${1:-CONFIG_TAG} + ;; -add-user ) shift ADD_USER_TAG=${1:-ADD_USER_TAG} ;; @@ -618,6 +636,7 @@ log::info "[start]" "bash $0 ${SCRIPT_PARAMETER}" # 动作 if [[ "${INIT_TAG:-}" == "1" ]]; then [[ "${UPDATE_YUM_REPOS:-}" == "1" ]] && { init:update_yum_repos; } + [[ "${CONFIG_TAG:-}" == "1" ]] && { init:config; } [[ "${ADD_USER_TAG:-}" == "1" ]] && { init:add_user; } [[ "${GIT_TAG:-}" == "1" ]] && { init:git; } [[ "${DSTAT_TAG:-}" == "1" ]] && { init:dstat; }