changeset 831:747a48996c1f

(Issue13) Precompile uninstaller Create-dist-packge now creates a temporary installer that only writes the uninstaller. Then it excutes this installer (using wine) to create the uninstaller. That uninstaller is then packaged normaly and packaged instead of the written uninstaller.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 24 Jul 2014 15:59:00 +0200
parents 344d15e23f6c
children 170b13ea05ee
files packaging/create-dist-package.sh.in packaging/trustbridge.nsi
diffstat 2 files changed, 37 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/create-dist-package.sh.in	Thu Jul 24 12:09:28 2014 +0200
+++ b/packaging/create-dist-package.sh.in	Thu Jul 24 15:59:00 2014 +0200
@@ -9,6 +9,11 @@
     exit 1
 fi
 
+if [ ! -x `which wine` ]; then
+    echo "ERROR: Could not find wine."
+    exit 1
+fi
+
 TMPD=$(mktemp -d)
 TMPDIR=$TMPD/TrustBridge-@PROJECT_VERSION@
 cd @CMAKE_BINARY_DIR@
@@ -32,6 +37,23 @@
 echo "description=TrustBridge" >> $TMPDIR/meta.ini
 echo "size=$EST_SIZE" >> $TMPDIR/meta.ini
 cp $WINDOWS_NSSDIR/*.dll $TMPDIR/windows
+
+# Create a temporary NSIS file for the uninstaller cration
+LC_ALL="de_DE.latin-1" makensis -Dfiles_dir=$TMPDIR/windows \
+    -Dcompany="Bundesamt für Sicherheit in der Informationstechnik" \
+    -Dversion_number=@PROJECT_VERSION@ \
+    -Dsetupname="$TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe" \
+    -Dproductname="TrustBridge" \
+    -Dpath_sep="/" \
+    -Dinfo_url="https://wald.intevation.org/projects/trustbridge/" \
+    -Dsize=$EST_SIZE \
+    -DWRITE_UNINSTALLER \
+    -Dproductname_short="TrustBridge" @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi
+wine $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe /S || true
+mv ~/.wine/drive_c/tmp-uninstaller/Uninstall.exe $TMPDIR/windows
+rmdir ~/.wine/drive_c/tmp-uninstaller
+rm $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe
+
 cd $TMPD
 zip -r TrustBridge-@PROJECT_VERSION@.zip TrustBridge-@PROJECT_VERSION@
 mv TrustBridge-@PROJECT_VERSION@.zip @CMAKE_BINARY_DIR@
--- a/packaging/trustbridge.nsi	Thu Jul 24 12:09:28 2014 +0200
+++ b/packaging/trustbridge.nsi	Thu Jul 24 15:59:00 2014 +0200
@@ -101,9 +101,10 @@
 !insertmacro MUI_PAGE_INSTFILES
 !insertmacro MUI_PAGE_FINISH
 
-!insertmacro MUI_UNPAGE_CONFIRM
-!insertmacro MUI_UNPAGE_INSTFILES
-
+!ifdef WRITE_UNINSTALLER
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+!endif
 
 !insertmacro MUI_LANGUAGE "German"
 
@@ -112,6 +113,12 @@
 ; Install Functions
 
 Function ".onInit"
+  !ifdef WRITE_UNINSTALLER
+  SetOutPath "c:\tmp-uninstaller"
+  WriteUninstaller "c:\tmp-uninstaller\Uninstall.exe"
+  Quit
+  !endif
+
   ${IfNot} ${AtLeastWinVista}
     MessageBox MB_OK "Windows XP und ältere Windows Versionen werden von dieser Anwendung nicht unterstützt."
     Quit
@@ -157,7 +164,9 @@
   !include "filelist.nsh"
 
 ;Create uninstaller
-  WriteUninstaller "$INSTDIR\Uninstall.exe"
+!ifndef WRITE_UNINSTALLER
+  File "${files_dir}${path_sep}Uninstall.exe"
+!endif
 
 ; Code below is not run on updates
   StrCmp $is_update '1' done
@@ -205,6 +214,7 @@
 
 SectionEnd
 
+!ifdef WRITE_UNINSTALLER
 Section "Uninstall"
   RMDir /r "$INSTDIR" ; TODO include uninstall files
 ; !include "filelist-un.nsh"
@@ -224,3 +234,4 @@
 ; Remove uninstaller
   DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}"
 SectionEnd
+!endif

http://wald.intevation.org/projects/trustbridge/