change verison detect and other small fixes
This commit is contained in:
@@ -20,11 +20,11 @@ builder_config() {
|
||||
CMD_unix2dos="`which unix2dos.exe`" ; builder_check_error "Command 'unix2dos' not installed"
|
||||
CMD_sha1sum="`which sha1sum.exe`" ; builder_check_error "Command 'sha1sum' not installed"
|
||||
CMD_inifile="`which inifile.exe`" ; builder_check_error "Command 'inifile' not installed (http://www.horstmuc.de/wbat32d.htm#inifile)"
|
||||
CMD_showver="`which ShowVer.exe`" ; builder_check_error "Command 'ShowVer' not installed (http://www.codeproject.com/Articles/2457/ShowVer-exe-command-line-VERSIONINFO-display-progr)"
|
||||
CMD_tidy="`which tidy.exe`" ; builder_check_error "Command 'tidy' not installed"
|
||||
CMD_msiexec="`which msiexec.exe`" ; builder_check_error "Command 'msiexec' not installed"
|
||||
CMD_innounp="`which innounp.exe`" ; builder_check_error "Command 'innounp' not installed"
|
||||
CMD_xmlstarlet="`which xmlstarlet.exe`" ; builder_check_error "Command 'xmlstarlat' not installed"
|
||||
CMD_msix="`which MsiX.exe`" ; builder_check_error "Command 'msix' not installed"
|
||||
|
||||
# Check temp dir
|
||||
test -d ${TMP_DIR}
|
||||
@@ -215,10 +215,10 @@ builder_create() {
|
||||
done
|
||||
|
||||
# convert to dos file linefeed
|
||||
find $INST_DIR -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep -v "utf-16" | grep "text/plain" && '$CMD_unix2dos' $0 ' REP >/dev/null
|
||||
# find $INST_DIR -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep -v "utf-16" | grep "text/plain" && '$CMD_unix2dos' $0 ' REP >/dev/null
|
||||
|
||||
# set exec bit on executeables
|
||||
find $INST_DIR -type f -iname "*.exe" -o -iname "*.bat" -o -iname "*.cmd" -o -iname "*.msi" -o -iname "*.msp" | xargs chmod +x -v
|
||||
# find $INST_DIR -type f -iname "*.exe" -o -iname "*.bat" -o -iname "*.cmd" -o -iname "*.msi" -o -iname "*.msp" | xargs chmod +x -v
|
||||
|
||||
# Create changelog based on git - if available
|
||||
if [ -d "${PRODUCT_DIR}/.git" ] ; then
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user