Check_env function parsing and check_env Parsing
It is also a long function used to check file permissions and directory conditions. The Code is as follows:
Check_env () {# Check user privilege. # Check user Permissions
check_user root # Check FQDN hostname.
# Check whether the host name meets the check_hostname rules # Check config tool: dialog.
# Check whether the configuration tool dig_has check_pkg $ {BIN_DIALOG }$ {PKG_DIALOG} ECHO_INFO-n "Checking configuration file :$ {IREDMAIL_CONFIG_FILE }... "# Check whether the configuration file exists. The default installation package does not exist. It should be used to resume installation after the installation is interrupted.
if [ -f ${IREDMAIL_CONFIG_FILE} ]; then if grep '^#EOF$' ${IREDMAIL_CONFIG_FILE} >/dev/null; then echo -e " [FOUND]" ECHO_QUESTION -n "Use it for mail server setting? [y|N]"
# Read an existing configuration file
read_setting ${AUTO_USE_EXISTING_CONFIG_FILE}
# Select whether to use an existing configuration file or reinstall it.
case $ANSWER in Y|y ) ECHO_INFO "Use config file: ${IREDMAIL_CONFIG_FILE} for mail server setting." . ${IREDMAIL_CONFIG_FILE} # Check installation status. # After each component installation was completed, there # should be a variable in ${STATUS_FILE}, e.g. # # export STATUS_PHP_INSTALLATION='DONE' # export STATUS_PHP_CONFIGURATION='DONE' #
# Determine whether a status file exists. If yes, read the status file.
if [ -f ${STATUS_FILE} ]; then ECHO_INFO "Import installation process status from file: ${STATUS_FILE}." . ${STATUS_FILE} else echo '' > ${STATUS_FILE} fi # Initialize tip file. if [ ! -f ${TIP_FILE} ]; then cat > ${TIP_FILE} <<EOF${CONF_MSG}EOF fi ;; N|n|* ) ECHO_INFO "Skip configuration file: ${IREDMAIL_CONFIG_FILE}." . ${CONFIG_VIA_DIALOG} ;; esac else ECHO_INFO "Found, but not finished." . ${CONFIG_VIA_DIALOG} fi else ECHO_INFO "[NOT FOUND]" . ${CONFIG_VIA_DIALOG} fi check_runtime_dir}