[PATCH 1 of 2] (Issue13) Precompile uninstaller

Wald Commits scm-commit at wald.intevation.org
Thu Jul 24 16:30:14 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1406210340 -7200
# Node ID 747a48996c1f74df721a4379a5f5a39bf2f28e01
# Parent  344d15e23f6c0d84fa24bdc7ce3cf53414c6a5d9
(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.

diff -r 344d15e23f6c -r 747a48996c1f packaging/create-dist-package.sh.in
--- 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- at 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- at 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- at 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- at PROJECT_VERSION@-uni.exe
+
 cd $TMPD
 zip -r TrustBridge- at PROJECT_VERSION@.zip TrustBridge- at PROJECT_VERSION@
 mv TrustBridge- at PROJECT_VERSION@.zip @CMAKE_BINARY_DIR@
diff -r 344d15e23f6c -r 747a48996c1f packaging/trustbridge.nsi
--- 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


More information about the Trustbridge-commits mailing list