X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions%2Fmain;fp=functions%2Fmain;h=0adc06d140a4e125c0b3a289c2d0f17abe6b146c;hb=a6cb6fc5391f8d73b7664cf9b97b038fbff1954e;hp=ebdc9d8726ffdd8e250cf1092d88350a22d44f06;hpb=89f60053b6ecd4357cdf4c3d7040711222badf20;p=hvlinux.git diff --git a/functions/main b/functions/main index ebdc9d8..0adc06d 100644 --- a/functions/main +++ b/functions/main @@ -178,6 +178,19 @@ get_pkg_ver() echo ${1} | sed "s!.*-\([0-9].*\)!\1!g" } +# Extracting the version number from a complete package name using underscore as separator. +# Arg. #1: Complete package name with version (ex: ecryptfs-utils_103 will output 103) +get_pkg_ver_underscore() +{ + # Checking for correct number of arguments + if [ $# -ne 1 ]; then + echo "${FUNCNAME}(), wrong number of arguments: ${*}" + return 1 + fi + + echo ${1} | sed "s!.*_\([0-9].*\)!\1!g" +} + # 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()