X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions;h=7afb02363f41d887b727e2f71099425cf7d2e4a4;hb=b2f91df3e7c1d1ca93ced97b5001e3134243666b;hp=a986466fa5baaa971a88aedcbe09d76cc9f4eb76;hpb=5d494ebc6690e09f6dd2b69bb29e9aa1dbee97df;p=hvlinux.git diff --git a/functions b/functions index a986466..7afb023 100644 --- a/functions +++ b/functions @@ -20,7 +20,6 @@ WARNING="echo -en \\033[1;33m" # FAILURE prints text in a red colour FAILURE="echo -en \\033[1;31m" - # Extracting the version number from a complete package name. # Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4.4) get_pkg_ver() @@ -34,7 +33,6 @@ get_pkg_ver() echo ${1} | sed "s!^.*-\(.*\)!\1!g" } - # Extracting the base version number from a complete package name. # Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4) get_pkg_ver_base() @@ -48,7 +46,6 @@ get_pkg_ver_base() echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\).*!\1!g" } - # Extracting the base version number from a complete package name. # Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3) get_pkg_ver_major() @@ -62,7 +59,6 @@ get_pkg_ver_major() echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g" } - # Extracting the name from a complete package name. # Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output gcc) get_pkg_name() @@ -76,7 +72,6 @@ get_pkg_name() echo ${1} | sed "s!^\(.*\)-.*!\1!g" } - # Saves the content of CFLAGS and CXXFLAGS environment variables. save_flags() { @@ -86,7 +81,6 @@ save_flags() return ${EXIT_SUCCESS} } - # Saves the content of CFLAGS and CXXFLAGS environment variables, and then # set them to empty strings. save_flags_no_optimizations() @@ -99,7 +93,6 @@ save_flags_no_optimizations() return ${EXIT_SUCCESS} } - # Restores the previous values of CFLAGS and CXXFLAGS environment variables. These # must have been saved first using save_flags(). restore_flags() @@ -110,7 +103,6 @@ restore_flags() return ${EXIT_SUCCESS} } - # Create log directory and log file for current stage if necessary # This should be done automatically... init_log_file() @@ -121,7 +113,6 @@ init_log_file() fi } - # Create symbolic links for start/stop scripts in /etc/rc.d # # Arg #1: script name @@ -175,7 +166,6 @@ static_bootscript_add() fi } - # Create symbolic links for start/stop scripts in /etc/rc.d # # Arg #1: level @@ -209,7 +199,6 @@ bootscript_add_manual() fi } - # Create symbolic links for start/stop scripts in /etc/rc.d # # Arg #1: script name @@ -220,7 +209,6 @@ bootscript_add_rc3() static_bootscript_add ${*} 3 } - # Create symbolic links for start/stop scripts in /etc/rc.d # # Arg #1: script name @@ -231,7 +219,6 @@ bootscript_add_rcS() static_bootscript_add ${*} S } - # Add "export" before the variable name # # Arg #1: variable name @@ -275,7 +262,6 @@ var_export() sed -i "s!\(^${VARIABLE}=.*\)!export \1!" ${FILE} } - # Adding a new environment variable to a file. # # Arg #1: variable name @@ -342,7 +328,6 @@ var_add() return $? } - # Adding a new path environment variable to a file. # # Arg #1: variable name @@ -353,7 +338,6 @@ var_add_path() var_add ${1} ${2} "${3}" ":" 1>> ${LFS_LOG_FILE} 2>&1 } - # Adding a new string environment variable to a file. # # Arg #1: variable name @@ -364,7 +348,6 @@ var_add_str() var_add ${1} ${2} "${3}" " " } - # Adding a new string to a file. # # Arg #1: string @@ -395,7 +378,6 @@ string_add() echo "${STRING}" >> ${FILE} } - # Adding a new environment variable to a shadow password suite file (login.defs) # # Arg #1: variable name @@ -432,7 +414,6 @@ var_add_shadow() sed -i "s!\(^${VARIABLE}.*\)!\1:${VALUE}!" ${FILE} } - # Adding a new group, checking if it already exist before. # Arguments: same arguments as for standard groupadd command. hv_groupadd() @@ -476,7 +457,6 @@ hv_useradd() fi } - # Evaluates the return value of the process that was run just before this # function was called. evaluate_retval() @@ -501,9 +481,6 @@ eval_retval2() fi } - - - # Obtain the name of the base directory for the decompressed package. # First argument: package name static_decompressed_dirname() @@ -519,7 +496,6 @@ static_decompressed_dirname() echo ${DIRNAME} } - # Applying any patch(es) found for the current package. # Will work only if patches have the same base name as # the package, followed by a dash: @@ -559,7 +535,6 @@ apply_patches() return $? } - # Applying patch # First argument is the name of the patch # Second argument is the package name @@ -586,7 +561,6 @@ apply_patch() patch -Np1 -d ${LFS_TMP}/${PACKAGE} -i ${LFS_PKG_DIR}/${PATCH_FILE} } - # Decompression of a package # First argument: package name # Second argument: directory where decompressing (optional) @@ -624,7 +598,6 @@ decompress_package() cd - 1> /dev/null 2>&1 } - # Installation of a package, removing source and build directories after. # # First argument: package name @@ -643,7 +616,6 @@ ipkg() static_ipkg ${1} ${2} ${1} } - # Installation of a package conforming to GNU autotools. # The package must be able to be built outside the # source directory. @@ -667,7 +639,6 @@ ipkg_ac() static_ipkg ${PACKAGE} cis-ac ${PACKAGE} ${CONFIGURE_OPTS} } - # Installation of a package conforming to GNU autotools, # but that must be built inside the source directory. # @@ -690,7 +661,6 @@ ipkg_ac_nb() static_ipkg ${PACKAGE} cis-ac-nobuild ${PACKAGE} ${CONFIGURE_OPTS} } - # Installation of a GNOME package. # # First argument: package name @@ -707,7 +677,6 @@ ipkg_gnome() static_ipkg ${1} cis-gnome ${1} } - # Installation of a PERL module # # First argument: package name @@ -724,7 +693,6 @@ ipkg_pm() static_ipkg ${1} cis-pm ${1} } - # Multiple installation of a package. This is usefull for packages # that may need to be installed multiple times, at different # times of the build process, like for GCC pas 1 and GCC pass 2. @@ -745,7 +713,6 @@ ipkg_mult() static_ipkg ${1} ${2} ${3} } - # Installation of a package # # First argument: Real package name @@ -845,7 +812,6 @@ static_ipkg() return $EXIT_SUCCESS } - # Display the action name, run a command, log its output and display it's # status # First argument: action name (string) @@ -871,7 +837,6 @@ action_checkbox() return $EXIT_SUCCESS } - # Display the action name, run a command, log its output and display it's # status and the time it took to execute. # Note: In case of errors, this function returns an error code instead @@ -905,7 +870,6 @@ action_checkbox_time() fi } - # Display the action name, run a command, log its output and display it's # status. Write to install log file when successfully completed so it # won't be called again after a successfull installation. @@ -959,7 +923,6 @@ run_script_log() return $EXIT_SUCCESS } - # Display the action name, run a command, log its output and display it's # status. Write to install log file when successfully completed so it # won't be called again after a successfull installation. @@ -1002,7 +965,6 @@ run_cmd_log() return $EXIT_SUCCESS } - get_total_build_time() { INFILE=${1} @@ -1030,7 +992,6 @@ get_total_build_time() echo "${HOURS}.${MIN}" } - display_build_time() { END_TIME=$(echo `date +%s`) @@ -1059,7 +1020,6 @@ display_build_time() echo "h" 1>> ${LFS_LOG_FILE} } - # The print_status prints a coloured "X" letter inside the checkbox to the left # of the screen (the checkbox is displayed with the action_checkbox function). print_status() @@ -1090,7 +1050,6 @@ print_status() $NORMAL } - # Testing GCC toolchain gcc_toolchain_test_stage1() {