summaryrefslogtreecommitdiff
path: root/lib/builder-utils.sh
diff options
context:
space:
mode:
authorU-XPBUILDBOT\mario <[email protected](none)>2013-09-10 22:13:08 (GMT)
committer U-XPBUILDBOT\mario <[email protected](none)>2013-09-10 22:13:08 (GMT)
commit8ad86744fcadb26452e3d6abf9339102c8cbd56d (patch)
treecc6baeb3dd646a555e862cebad1215eb8265cc14 /lib/builder-utils.sh
parentdf3c29f0d90c1c6afa11de4b948ec038745fe1e0 (diff)
update all the functiosn now used in the msvc pack
Diffstat (limited to 'lib/builder-utils.sh')
-rw-r--r--lib/builder-utils.sh125
1 files changed, 110 insertions, 15 deletions
diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh
index 88b5e77..ae08bf5 100644
--- a/lib/builder-utils.sh
+++ b/lib/builder-utils.sh
@@ -1,3 +1,4 @@
+
#############################################
# void retrieve_file (src, dst)
#
@@ -67,8 +68,6 @@ function process_file() {
$CMD_unzip $option -o $src -d $dst
elif [ "$format" = "unrar" ]; then
$CMD_unrar x -y $option $src $dst
- elif [ "$format" = "lha" ]; then
- $CMD_lha x $option -w=$dst $src
elif [ "$format" = "targz" ]; then
$CMD_tar xzvf $option $src -C $dst
elif [ "$format" = "tarbz2" ]; then
@@ -201,16 +200,28 @@ write_ini_file() {
# Var:
#
###################
-get_file_version() {
- local getver_file=$1
- local getver_var=$2
-
- if [ -f "$getver_file" ] ; then
- $CMD_showver $getver_file | grep FileVersion: | rev | cut -d: -f1 | rev | tr -d ' ' > $getver_ver
- echo "file $getver_file has version $getver_ver"
- else
- echo "$getver_file not found"
- fi
+vercomp() {
+ [ ! $(echo -e "$1\n$2" | sort --version-sort | head -1) = "$1" ]
+}
+
+###################
+# Get Verison of File
+#
+# Copy file only if it is newer
+#
+# Parameter
+# File: to process
+# Var:
+#
+###################
+
+
+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 ' '`
+ echo "$getver_file -> $myresult"
+ eval $__resultvar="'$myresult'"
}
###################
@@ -226,10 +237,29 @@ get_file_version() {
copyver() {
local source_file=$1
local target_file=$2
- local source_ver
- local target_ver
+ local source_ver=""
+ local target_ver=""
- get_file_version $source_file $source_ver
+ 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
+ echo "Source Verssion: $source_ver > Target Version: $target_ver"
+ echo "Copying File"
+ cp $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)
+ echo "Source Verssion: $source_ver"
+ echo "Copying File"
+ cp $source_file $target_file
+ else
+ echo "Nothing to copy"
+ fi
}
###################
@@ -249,3 +279,68 @@ tidy_xml() {
cat $source_file | $CMD_tidy -utf8 -xml -w 255 -i -c -q -asxml | sed -e 's!&gt;!>!g' -e 's!&lt;!<!g' > $target_file
}
+#############################################
+# void extract_file (format, src, dst)
+#
+# Description: Extract a file
+#
+# Parameter
+# format: compression format
+# src: source file to be used
+# dst: path to extract the file
+#
+#############################################
+function extract_file() {
+
+ local format=$1
+ local src=$2
+ local dst=$3
+ local option=$4
+ local src_dir=`dirname "$src"`
+ local src_file=`basename "$src"`
+ local dst_dir=`dirname "$dst"`
+ local dst_file=`basename "$dst"`
+
+ log_debug "Compression format: $format"
+
+ mkdir -p $dst
+ if [ "$format" = "msi-a" ]; then
+ mkdir /cygdrive/c/msi-adm
+ pushd $src_dir
+ echo $src_file
+ $CMD_msiexec /a "$src_file" $option TARGETDIR="c:\msi-adm"
+ popd
+ cp -r /cygdrive/c/msi-adm/* $dst
+ rm -rf /cygdrive/c/msi-adm
+ elif [ "$format" = "msp-a" ]; then
+ pushd $dst_dir
+ cp $src $dst_dir
+ $CMD_msiexec /p "$src_file" /a "$dst_file" SHORTFILENAMES=TRUE /qb
+ popd
+ elif [ "$format" = "7zip" ]; then
+ $CMD_7z x -y $option -o$dst $src
+ elif [ "$format" = "unzip" ]; then
+ $CMD_unzip $option -o $src -d $dst
+ elif [ "$format" = "unrar" ]; then
+ $CMD_unrar x -y $option $(cygpath -pw "$src") $(cygpath -pw "$dst")
+ elif [ "$format" = "cab" ]; then
+ $CMD_cabextract $option -d $dst $src
+ elif [ "$format" = "cab-sfx" ]; then
+ $CMD_cabextract $option -d $dst $src
+ $CMD_xmlstarlet sel -N X="http://schemas.microsoft.com/wix/2008/Burn" -t -m "//X:Payload" -v "concat(@SourcePath,'-',@FilePath)" -n $dst/0 | tr '\\' '/' > $dst/rename.list
+ for i in `cat $dst/rename.list`
+ do
+ pushd $dst
+ local src_var=$(echo $i | cut -f1 -d-)
+ local dst_var=$(echo $i | cut -f2 -d-)
+ mkdir -p $(dirname $dst_var)
+ mv -v $src_var $dst_var
+ popd
+ done
+ elif [ "$format" = "inno" ]; then
+ $CMD_innounp $option -d $dst $src
+ else
+ fatal_error "Unknown compression format: $format"
+ fi
+}
+

Powered by Domaintechnik.at | Hosting - Domain - Webspace