is also a longer function, is used to check file permissions, directory conditions. The specific code is as follows:
Check_env () { # Check user privilege. #检查用户权限
check_user root hostname.
#检查主机名是否符合规则 check_hostname Dialog.
#检查配置工具dialog是否存在 check_pkg ${bin_dialog} ${pkg_dialog} "Checking Configuration file: ${iredmail_config_file} ... " #判断配置文件是否存在, the default installation package is not available and should be used for installation after the outage is resumed.
if then if grep ' ^ #EOF $ ' ${iredmail_config_file} >/dev/nullthen echo' [ FOUND]" "useit for mail server setting? [y| N]"
#读取已经存在的配置文件
Read_setting ${auto_use_existing_config_file}
#给用户一个选择, whether to use an existing configuration file or reinstall
Case$ANSWERinchY|y) Echo_info"Use config file: ${iredmail_config_file} for mail server setting.". ${iredmail_config_file} # Check installation status. # After each component installation is completed, there # should be a variableinch${status_file}, e.g. # # Export Status_php_installation=' Done'# Export Status_php_configuration=' Done' #
#判断状态文件是否存在, read the state file if it exists
if[-F ${status_file}]; ThenEcho_info"Import installation process status from file: ${status_file}.". ${status_file}Else Echo "'>${status_file}fi# Initialize Tipfile. if[!-f ${tip_file}]; Then Cat> ${tip_file} <<eof${conf_msg}eoffi ;; N|n|*) Echo_info"Skip configuration file: ${iredmail_config_file}.". ${config_via_dialog};; Esac ElseEcho_info"Found, but not finished.". ${config_via_dialog}fi ElseEcho_info"[not FOUND]". ${config_via_dialog}fiCheck_runtime_dir}
check_env function parsing