Ver código fonte

Add vcmibuilder version check for innoextract (#408)

* add vcmibuilder check for the old innoextract is unable to unpack the current GOG package
* fix for vcmibuilder to fail if innoextract version is less than required
Paul 7 anos atrás
pai
commit
d1bef9da13
1 arquivos alterados com 17 adições e 1 exclusões
  1. 17 1
      vcmibuilder

+ 17 - 1
vcmibuilder

@@ -62,13 +62,19 @@ then
 	exit 0
 fi
 
+# test if a program version ($1) is less than the required one ($2)
+verlt() {
+	[ "$1" = "$2" ] && return 1 || \
+	[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
+}
+
 # test presence of program $1, $2 will be passed as parameters to test presence
 test_utility ()
 {
 	$1 $2 > /dev/null 2>&1 || { echo "$1 was not found. Please install it" 1>&2 ; exit 1; }
 }
 
-#print error message and exit
+# print error message and exit
 fail ()
 {
 	$2
@@ -106,6 +112,16 @@ then
 	fi
 fi
 
+if [[ -n "$gog_file" ]]
+then
+	currentver="$(innoextract --version | head -n1 | cut -d ' ' -f2)"
+	requiredver="1.6"
+        if verlt $currentver $requiredver;
+           then
+                fail "innoextract version is $currentver, update it to version $requiredver or higher"
+        fi
+fi
+
 if [[ -n "$useffmpeg" ]]
 then
 	ffmpeg -version > /dev/null 2>&1 && AUDIO_CONV=ffmpeg