changeset 227:07e7f254ef16

Improve windows build script.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Mar 2018 10:52:21 +0200
parents c0dfbbd67692
children 37d5f4329449
files build-win32.sh
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/build-win32.sh	Mon Mar 12 10:27:47 2018 +0200
+++ b/build-win32.sh	Mon Mar 12 10:52:21 2018 +0200
@@ -1,5 +1,5 @@
 #!/bin/sh
-INSTALL_USB="/mnt/sdb1/Syntilista/"
+INSTALL_USB="/mnt/sdb1"
 INSTALL_WINE="$HOME/.wine/drive_c/Syntilista/"
 TMPFILE="unix2dos.tmp"
 
@@ -24,8 +24,14 @@
 do_install()
 {
     TARGET="$1"
-    if test ! -d "$TARGET"; then
-        echo "ERROR: Target directory '$TARGET' does not exist."
+    if test -d "$TARGET"; then
+        rm -fr "$TARGET"
+    else
+        echo "ERROR: Target '$TARGET' exists but is not a directory!"
+        return 1
+    fi
+    if ! mkdir -p "$TARGET"; then
+        echo "ERROR: Could not create target directory '$TARGET'."
         return 1
     fi
 
@@ -55,5 +61,9 @@
 make -f Makefile.cross-mingw-win32 QT5_PREFIX="$QT5_PREFIX" BINPATH="$BUILDPATH"
 
 ### Install to targets
-do_install "$INSTALL_USB"
+if test -d "$INSTALL_USB" && mount|grep -q "$INSTALL_USB"; then
+    do_install "$INSTALL_USB/Syntilista"
+else
+    echo "INFO: '$INSTALL_USB' is not mounted. Not installing."
+fi
 do_install "$INSTALL_WINE"