X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions%2Fmain;h=25e1bcb2c38418034765cc2273fe946196f72fa3;hb=71881ad0ddc734eda6935b1c6ca11b4a24439921;hp=720715753ca337327e367a56d8b06511b41be475;hpb=564ec1bbb321286571c30da20b81620c33b18e6f;p=hvlinux.git diff --git a/functions/main b/functions/main index 7207157..25e1bcb 100644 --- a/functions/main +++ b/functions/main @@ -157,9 +157,9 @@ get_pkg_ver() echo ${1} | sed "s!.*-\([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.4) -get_pkg_ver_base() +# Extracting the first digit version number from a complete package name. +# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3) +get_pkg_ver1() { # Checking for correct number of arguments if [ $# -ne 1 ]; then @@ -167,13 +167,12 @@ get_pkg_ver_base() return 1 fi - echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\).*!\1!g" + echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g" } -# Extracting the 3-digit version number from a complete package name. -# Arg. #1: Complete package name with version -# (ex: linux-2.6.37.1 will output 2.6.37) -get_pkg_ver3() +# Extracting the first 2 digits 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_ver2() { # Checking for correct number of arguments if [ $# -ne 1 ]; then @@ -181,12 +180,13 @@ get_pkg_ver3() return 1 fi - echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\.[0-9]*\).*!\1!g" + 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() +# Extracting the first 3 digit version number from a complete package name. +# Arg. #1: Complete package name with version +# (ex: linux-2.6.37.1 will output 2.6.37) +get_pkg_ver3() { # Checking for correct number of arguments if [ $# -ne 1 ]; then @@ -194,7 +194,7 @@ get_pkg_ver_major() return 1 fi - echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g" + echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\.[0-9]*\).*!\1!g" } # Extracting the name from a complete package name. @@ -650,23 +650,27 @@ static_decompressed_dirname() continue; fi + local DIRNAME="" + case ${arch_ext} in tar.bz2|tar.gz|tgz|tar.Z) # Remove optional "./" leading component with sed # and extract base directory name with awk. # tar 1.23 reports an error when using pipes, so # remove error message with "2> /dev/null" - local DIRNAME=$(tar ${TAR_OPTS} -tf \ + DIRNAME=$(tar ${TAR_OPTS} -tf \ ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} 2> /dev/null | \ head -n1 | sed 's!^\./!!' | awk -F \/ '{print $1}') - echo ${DIRNAME} ;; zip) - # TODO - echo ${PACKAGE} + DIRNAME=$(unzip -l \ + ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} | head -n4 | \ + sed '$!d' | awk -F " " '{print $4}' | sed 's!/$!!') ;; esac + echo ${DIRNAME} + return $? done