Tool Function Analysis
These functions belong to the Environment preparation class. In fact, it is important to check the environment when writing similar scripts. This prevents errors reported when some environments are not available. The first function is the prepare_dir function, the code for detecting the directory is as follows:
Prepare_dirs () {# create the necessary Directory, which will be output to ECHO_DEBUG "Creating necessary directories during installation... "# PKG_DIR, PKG_MISC_DIR, which has been defined in the previous article. FOR Loop reading, skipped. If not, create it directly. For I in $ {PKG_DIR }$ {PKG_MISC_DIR} do [-d "$ {I}"] | mkdir-p "$ {I}" done}After executing this function, you can create all the required directories. Next, analyze the fetch_misc () function. The Code is as follows:
Fetch_misc () {# enter this directory, prepare to download the Installation File cd $ {PKG_MISC_DIR} # calculate the total number of installation misc_total =$ ($ (echo $ {MISCLIST} | wc-w | awk '{print $1 }'))) # define the counter misc_count = 1 # Install the alert to get the ECHO_INFO "Fetching source tarbils in the source file... "# for Loop read the tag list, get it, and download it to the local for I in $ {MISCLIST }; do url = "$ {IREDMAIL_MIRROR}/yum/misc/$ {I}" ECHO_INFO "+ $ {misc_count} of $ {misc_total }: $ {url} "$ {FETCH_CMD}" $ {url} "misc_count =$ (misc_count + 1) done}
In fact, the meaning of this script is to download the corresponding version of the installation file from the address below