diff options
author | Mario Fetka <[email protected]> | 2013-09-16 06:11:37 (GMT) |
---|---|---|
committer | Mario Fetka <[email protected]> | 2013-09-16 06:11:37 (GMT) |
commit | 49950d8b6685395c882bf45023c92879b74ab0b5 (patch) | |
tree | 400b5f59082cfc1fc3ac50f78bbcf74620404aaa /lib/builder-utils.sh | |
parent | 8ad86744fcadb26452e3d6abf9339102c8cbd56d (diff) |
Diffstat (limited to 'lib/builder-utils.sh')
-rw-r--r-- | lib/builder-utils.sh | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index ae08bf5..97dc96c 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -200,9 +200,15 @@ write_ini_file() { # Var: # ################### -vercomp() { - [ ! $(echo -e "$1\n$2" | sort --version-sort | head -1) = "$1" ] -} +# return 0 if program version is equal or greater than check version +check_version() +{ + local version=$1 check=$2 + local winner=$(echo -e "$version\n$check" | sed '/^$/d' | sort -Vr | head -1) + [[ "$winner" = "$version" ]] && return 0 + return 1 + } + ################### # Get Verison of File @@ -219,9 +225,16 @@ vercomp() { get_file_ver() { local getver_file=$2 local __resultvar=$1 - local myresult=`$CMD_showver $(cygpath -pw "$getver_file") | grep FileVersion: | rev | cut -d: -f1 | rev | tr -d ' '` + # local myresult=`$CMD_showver $(cygpath -pw "$getver_file") | grep FileVersion: | rev | cut -d: -f1 | rev | tr -d ' '` + local myresult=`cscript //nologo $(cygpath -pw "$BASEDIR/libexec/VersionInfo.vbs") $(cygpath -pw "$getver_file") | tr -d '\r' | tr -d '\n'` + local mydate=`date -r $getver_file +%Y.%m.%d.%M` + if [ "x$myresult" = "x" ] ; then + echo "$getver_file -> $mydate" + eval $__resultvar="'$mydate'" + else echo "$getver_file -> $myresult" eval $__resultvar="'$myresult'" + fi } ################### @@ -237,26 +250,26 @@ get_file_ver() { copyver() { local source_file=$1 local target_file=$2 - local source_ver="" - local target_ver="" + local source_ver="0.0.0.0" + local target_ver="0.0.0.0" echo "Source File: $source_file Target Version: $target_file" if [ -f "$source_file" ] && [ -f "$target_file" ] ; then get_file_ver source_ver $source_file get_file_ver target_ver $target_file - if [ vercomp $source_ver $target_ver ] ; then + if check_version $source_ver $target_ver ; then echo "Source Verssion: $source_ver > Target Version: $target_ver" echo "Copying File" - cp $source_file $target_file + cp -a $source_file $target_file else echo "Source Verssion: $source_ver =< Target Version: $target_ver" echo "Not Copying File" fi elif [ -f "$source_file" ] && [ ! -f "$target_file" ] ; then - source_ver=$(get_file_version $source_file) + get_file_ver source_ver $source_file echo "Source Verssion: $source_ver" echo "Copying File" - cp $source_file $target_file + cp -a $source_file $target_file else echo "Nothing to copy" fi @@ -317,6 +330,8 @@ function extract_file() { cp $src $dst_dir $CMD_msiexec /p "$src_file" /a "$dst_file" SHORTFILENAMES=TRUE /qb popd + elif [ "$format" = "msp-x" ]; then + $CMD_msix $(cygpath -pw "$src") /out $(cygpath -pw "$dst") elif [ "$format" = "7zip" ]; then $CMD_7z x -y $option -o$dst $src elif [ "$format" = "unzip" ]; then @@ -338,7 +353,7 @@ function extract_file() { popd done elif [ "$format" = "inno" ]; then - $CMD_innounp $option -d $dst $src + $CMD_innounp -x -d"$(cygpath -pw "$dst")" "$(cygpath -pw "$src")" else fatal_error "Unknown compression format: $format" fi |