OSDN Git Service

Small installer tweak.
[lamexp/LameXP.git] / etc / NSIS / wrapper.nsi
index d450a55..a7fd428 100644 (file)
@@ -1,6 +1,6 @@
 ; ///////////////////////////////////////////////////////////////////////////////
 ; // LameXP - Audio Encoder Front-End
-; // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
+; // Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
 ; //
 ; // This program is free software; you can redistribute it and/or modify
 ; // it under the terms of the GNU General Public License as published by
@@ -74,7 +74,7 @@ OutFile "${LAMEXP_OUTPUT_FILE}"
 BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
 Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
 ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
-ShowInstDetails show
+ShowInstDetails nevershow
 AutoCloseWindow true
 InstallDir ""
 
@@ -103,6 +103,7 @@ SubCaption 4 " "
 
 ReserveFile "${NSISDIR}\Plugins\System.dll"
 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
+ReserveFile "${NSISDIR}\Plugins\SelfDel.dll"
 
 
 ;--------------------------------
@@ -117,7 +118,7 @@ VIAddVersionKey "Comments" "This program is free software; you can redistribute
 VIAddVersionKey "CompanyName" "Free Software Foundation"
 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
-VIAddVersionKey "LegalCopyright" "Copyright 2004-2012 LoRd_MuldeR"
+VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
 VIAddVersionKey "LegalTrademarks" "GNU"
 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.Build-${LAMEXP_BUILD}.exe"
 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
@@ -137,6 +138,12 @@ Section "-LaunchTheInstaller"
        InitPluginsDir
        SetOutPath "$PLUGINSDIR"
        
+       ${StdUtils.TestParameter} $R0 "Update"
+       ${If} "$R0" == "true"
+               SetFileAttributes "$EXEPATH" FILE_ATTRIBUTE_NORMAL
+               SelfDel::del /RMDIR
+       ${EndIf}
+       
        SetOverwrite on
        File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
 
@@ -164,15 +171,15 @@ Section "-LaunchTheInstaller"
                File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
                
                DetailPrint "ExecShellWait: ${InstallerFileName}"
-               ${StdUtils.ExecShellWait} $R1 "${InstallerFileName}" "open" '$R9'
-               DetailPrint "Result: $R1"
+               ${StdUtils.ExecShellWaitEx} $R1 $R2 "${InstallerFileName}" "open" '$R9'
+               DetailPrint "Result: $R1 ($R2)"
                
                ${IfThen} $R1 == "no_wait" ${|} Goto RunSuccess ${|}
                
-               ${If} $R1 != "error"
+               ${If} $R1 == "ok"
                        Sleep 333
                        HideWindow
-                       ${StdUtils.WaitForProc} $R1
+                       ${StdUtils.WaitForProcEx} $R1 $R2
                        Goto RunSuccess
                ${EndIf}
                
@@ -204,6 +211,7 @@ Section "-LaunchTheInstaller"
        SetDetailsPrint listonly
 
        SetErrorLevel 1
+       SetOutPath "$TEMP"
        Abort "Aborted."
 
        ; --------
@@ -212,4 +220,5 @@ Section "-LaunchTheInstaller"
 
        Delete /REBOOTOK "${InstallerFileName}"
        SetErrorLevel 0
+       SetOutPath "$TEMP"
 SectionEnd