WinGit: Add a script to update Inno Setup
authorSebastian Schuberth <sschuberth@gmail.com>
Thu, 31 Jan 2013 21:22:57 +0000 (31 22:22 +0100)
committerSebastian Schuberth <sschuberth@gmail.com>
Thu, 31 Jan 2013 21:25:11 +0000 (31 22:25 +0100)
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
share/WinGit/update-inno-setup.sh [new file with mode: 0644]

diff --git a/share/WinGit/update-inno-setup.sh b/share/WinGit/update-inno-setup.sh
new file mode 100644 (file)
index 0000000..5864c38
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh\r
+\r
+# Find a suitable download tool.\r
+if [ -f "$(type -p curl)" ]; then\r
+    download="curl"\r
+    download_args_rss="-s"\r
+    download_args="-# -L -o"\r
+elif [ -f "$(type -p wget)" ]; then\r
+    download="wget"\r
+    download_args_rss="-q -O -"\r
+    download_args="-N -O"\r
+else\r
+    echo "ERROR: No suitable download tool found."\r
+    exit 1\r
+fi\r
+\r
+SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"\r
+MSYSGITROOT="$(cd $SCRIPTDIR/../../ && pwd | sed 's/\/$//')/."\r
+cd $MSYSGITROOT\r
+\r
+# Download the most recent Inno Setup version.\r
+file="is-unicode.exe"\r
+url="http://www.jrsoftware.org/download.php/$file"\r
+\r
+if [ "$download" == "curl" ]; then\r
+    download_args="$download_args $file -R -z"\r
+fi\r
+$download $download_args $file $url\r
+\r
+if [ -f $file ]; then\r
+    # Remove any previous installation.\r
+    rm -fr share/InnoSetup/\r
+\r
+    # Silently install Inno Setup.\r
+    wine=$(type -p wine)\r
+    if [ $? -eq 0 ]; then\r
+        $wine $file /verysilent /dir="share\InnoSetup" /noicons /tasks="" /portable=1\r
+    else\r
+        # See http://www.mingw.org/wiki/Posix_path_conversion.\r
+        $file //verysilent //dir="share\InnoSetup" //noicons //tasks="" //portable=1\r
+    fi\r
+\r
+    # Remove unneeded files from the installation.\r
+    ( cd share/InnoSetup/ && rm -fr Examples/ Compil32.exe isscint.dll )\r
+\r
+    # Clean up.\r
+    rm $file\r
+fi\r