Author: remi
Date: 2008-11-28 11:22:29 +0100 (Fri, 28 Nov 2008)
New Revision: 2893

Modified:
   
software_suite_v2/software/http_server_resources/chatter_tux/trunk/installer.nsi
Log:
* updated the installer script according to the new Windows arch

Modified: 
software_suite_v2/software/http_server_resources/chatter_tux/trunk/installer.nsi
===================================================================
--- 
software_suite_v2/software/http_server_resources/chatter_tux/trunk/installer.nsi
    2008-11-28 10:22:02 UTC (rev 2892)
+++ 
software_suite_v2/software/http_server_resources/chatter_tux/trunk/installer.nsi
    2008-11-28 10:22:29 UTC (rev 2893)
@@ -4,136 +4,68 @@
 
 ; HM NIS Edit Wizard helper defines
 !define PRODUCT_NAME "ChatterTux"
-!define PRODUCT_VERSION "0.1.0"
+!define PRODUCT_VERSION "0.1.1"
 
-; Uninstaller name
-!define UNINSTALLER_EXE "uninstallChatterTux.exe"
+; The files to write
+!define FINAL_INSTALLER_EXE "ChatterTuxInstaller_${PRODUCT_VERSION}.exe"
+!define UNINSTALLER_EXE "ChatterTuxUninstaller.exe"
 
 ; The name of the installer
 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
 
 ; The file to write
-OutFile "${PRODUCT_NAME}_${PRODUCT_VERSION}.exe"
+OutFile "${FINAL_INSTALLER_EXE}"
 
 ; The default installation directory
-InstallDir c:\tuxdroid\bin\ChatterTux
+InstallDir c:\
 
 ; Request application privileges for Windows Vista
 RequestExecutionLevel admin
 
+; Get the Tuxdroid installation paths
+var /GLOBAL TUXDROID_PATH
+var /GLOBAL UNINSTALLERS_SUB_PATH
+
 ; -----------------------------------------------------------------------------
 ; Section ""
 ; -----------------------------------------------------------------------------
 Section ""
-    ; Check that the tuxhttpserver package found
-    ReadRegStr $0 HKLM SOFTWARE\Tuxdroid\TuxHTTPServer "Install_Dir"
-    StrCmp $0 "" endNoInstall
+    ; Get the Tuxdroid installation paths
+    ReadRegStr $TUXDROID_PATH HKLM "SOFTWARE\Tuxdroid\TuxdroidSetup" 
"Install_Dir"
+    StrCpy $UNINSTALLERS_SUB_PATH "$TUXDROID_PATH\uninstallers\sub"
     
     ; Copy the attitune and wav files
-    Call getUserPath
-    CreateDirectory $R0\MyTux\MyTuxAttitunes\chatterTux
-    SetOutPath $R0\MyTux\MyTuxAttitunes\chatterTux
-       SetOverwrite ifnewer
+    CreateDirectory "$TUXDROID_PATH\resources\attitunes\chatterTux"
+    SetOutPath "$TUXDROID_PATH\resources\attitunes\chatterTux"
     File /r att\*
     File /r wav\*
        
-       ; Copy the resource
-    SetOutPath C:\tuxdroid\bin\tuxhttpserver\resources
-       SetOverwrite ifnewer
+    ; Copy the resource
+    SetOutPath "$TUXDROID_PATH\softwares\tuxhttpserver\resources"
        File "HTTPRessource\ResourceChatterTux.py"
     
     ; Copy the executables
-    CreateDirectory $INSTDIR
-    SetOutPath $INSTDIR
-    SetOverwrite ifnewer
+    CreateDirectory "$TUXDROID_PATH\resources\tuxhttpserver\chatterTux"
+    SetOutPath "$TUXDROID_PATH\resources\tuxhttpserver\chatterTux"
     File "ChatterTux\ChatterTux.exe"
     File "ChatterTuxStart\chattertux_start.exe"
     File "ChatterTuxStop\chattertux_stop.exe"
     
-    ; Write the installation path into the registry
-    WriteRegStr HKLM SOFTWARE\Tuxdroid\${PRODUCT_NAME} "Install_Dir" "$INSTDIR"
-    
-    ; Write the uninstall file
-    WriteUninstaller "${UNINSTALLER_EXE}"
-    
-    Return
-    
-    endNoInstall:
-        MessageBox MB_OK "Aborded : Tux HTTP Server pakage not found."
+    ; Write the uninstaller file
+    WriteUninstaller "$UNINSTALLERS_SUB_PATH\${UNINSTALLER_EXE}"
 SectionEnd
 
 ; -----------------------------------------------------------------------------
 ; Section "Uninstall"
 ; -----------------------------------------------------------------------------
 Section "Uninstall"
-    ; Stop chatter tux
-    ExecDos::exec /NOUNLOAD /TIMEOUT=1000 "$INSTDIR\chattertux_stop.exe"
-    Sleep "1000"
-    
-    ; Remove registry keys
-    DeleteRegKey HKLM SOFTWARE\Tuxdroid\${PRODUCT_NAME}
+    ; Get the Tuxdroid installation paths
+    ReadRegStr $TUXDROID_PATH HKLM "SOFTWARE\Tuxdroid\TuxdroidSetup" 
"Install_Dir"
+    StrCpy $UNINSTALLERS_SUB_PATH "$TUXDROID_PATH\uninstallers\sub"
 
     ; Remove files and uninstaller
-    Delete "C:\tuxdroid\bin\tuxhttpserver\resources\ResourceChatterTux.py"
-    Delete $INSTDIR\${UNINSTALLER_EXE}
-    Delete $INSTDIR\ChatterTux.exe
-    Delete $INSTDIR\chattertux_start.exe
-    Delete $INSTDIR\chattertux_stop.exe
-    RMDir /r $INSTDIR
-    
-    ; Restart the http server
-    ExecDos::exec /NOUNLOAD /ASYNC /TIMEOUT=1000 
"c:\tuxdroid\bin\tuxhttpserver_start.exe"
-    Pop $0
-    ExecDos::wait $0
+    Delete 
"$TUXDROID_PATH\softwares\tuxhttpserver\resources\ResourceChatterTux.py"
+    Delete "$UNINSTALLERS_SUB_PATH\${UNINSTALLER_EXE}"
+    RMDir /r "$TUXDROID_PATH\resources\attitunes\chatterTux"
+    RMDir /r "$TUXDROID_PATH\resources\tuxhttpserver\chatterTux"
 SectionEnd
-
-; -----------------------------------------------------------------------------
-; Post-installation/uninstallation
-; -----------------------------------------------------------------------------
-Function .onInstSuccess
-    ; Restart the http server
-    ExecDos::exec /NOUNLOAD /ASYNC /TIMEOUT=5000 
"c:\tuxdroid\bin\tuxhttpserver_start.exe"
-    Pop $0
-    ExecDos::wait $0
-FunctionEnd
-
-; -----------------------------------------------------------------------------
-; Function to retrieve the user path
-; R0 : The returned path
-; -----------------------------------------------------------------------------
-Function RIndexOf
-Exch $R0
-Exch
-Exch $R1
-Push $R2
-Push $R3
- 
- StrCpy $R3 $R0
- StrCpy $R0 0
- IntOp $R0 $R0 + 1
-  StrCpy $R2 $R3 1 -$R0
-  StrCmp $R2 "" +2
-  StrCmp $R2 $R1 +2 -3
- 
- StrCpy $R0 -1
- 
-Pop $R3
-Pop $R2
-Pop $R1
-Exch $R0
-FunctionEnd
- 
-!macro RIndexOf Var Str Char
-Push "${Char}"
-Push "${Str}"
- Call RIndexOf
-Pop "${Var}"
-!macroend
-!define RIndexOf "!insertmacro RIndexOf"
-
-Function getUserPath
-    ${RIndexOf} $R0 "$DOCUMENTS" "\"
-    StrLen $1 "$DOCUMENTS"
-    IntOp $1 $1 - $R0
-    StrCpy $R0 "$DOCUMENTS" $1
-FunctionEnd


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to