Parcourir la source

07env-install-centos.sh

lizw il y a 2 ans
Parent
commit
33e4217c0c
1 fichiers modifiés avec 19 ajouts et 0 suppressions
  1. 19 0
      00base/07env-install-centos.sh

+ 19 - 0
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; }