Author: markt Date: Thu Oct 9 16:10:57 2014 New Revision: 1630526 URL: http://svn.apache.org/r1630526 Log: Sign the uninstaller as well as the installer
Modified: tomcat/trunk/build.xml tomcat/trunk/res/tomcat.nsi tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1630526&r1=1630525&r2=1630526&view=diff ============================================================================== --- tomcat/trunk/build.xml (original) +++ tomcat/trunk/build.xml Thu Oct 9 16:10:57 2014 @@ -31,6 +31,7 @@ <property file="${user.home}/build.properties"/> <property file="build.properties"/> <property file="build.properties.default"/> + <property environment="env"/> <!-- Project Name --> <property name="project" value="apache-tomcat" /> @@ -2145,6 +2146,25 @@ Apache Tomcat ${version} native binaries </target> + <!-- Called by the Windows installer to sign the uninstaller --> + <target name="sign-windows-uninstaller"> + + <taskdef name="signcode" + classname="org.apache.tomcat.buildutil.SignCode" + classpath="${tomcat.classes}" /> + + <signcode userName="${codesigning.user}" password="${codesigning.pwd}" + partnerCode="${codesigning.partnercode}" + applicationName="Apache Tomcat ${version.major.minor} Uninstaller" + applicationversion="${version}" + signingService="${codesigning.service}"> + <fileset dir="${env.TEMP}"> + <filename name="uninstall.exe"/> + </fileset> + </signcode> + + </target> + <target name="release" depends="clean,release-init,dist-deployer,sign-windows-binaries,package-zip,package-winzip,package-tgz,package-deployer-zip,package-deployer-tgz,javadoc,package-docs-tgz,package-src-zip,package-src-tgz,package-src-jar" description="Create a Tomcat packaged distribution"> Modified: tomcat/trunk/res/tomcat.nsi URL: http://svn.apache.org/viewvc/tomcat/trunk/res/tomcat.nsi?rev=1630526&r1=1630525&r2=1630526&view=diff ============================================================================== --- tomcat/trunk/res/tomcat.nsi (original) +++ tomcat/trunk/res/tomcat.nsi Thu Oct 9 16:10:57 2014 @@ -15,6 +15,31 @@ ; Tomcat script for Nullsoft Installer +!ifdef INNER + OutFile "tempinstaller.exe" + SetCompressor /SOLID lzma +!else + ; Call makensis again, defining INNER. This writes an installer for us which, when + ; it is invoked, will just write the uninstaller to some location, and then exit. + ; Be sure to substitute the name of this script here. + + !system "$\"${NSISDIR}\makensis$\" /DINNER tomcat.nsi" = 0 + + ; So now run that installer we just created as tempinstaller.exe. Since it + ; calls quit the return value isn't zero. + + !system "tempinstaller.exe" = 2 + + ; That will have written an uninstaller binary for us. Now we sign it with your + ; favourite code signing tool. + !system "ant -f ..\..\build.xml sign-windows-uninstaller" = 0 + + ; Good. Now we can carry on writing the real installer. + + OutFile tomcat-installer.exe + SetCompressor /SOLID lzma +!endif + ;Compression options CRCCheck on SetCompressor /SOLID lzma @@ -90,9 +115,6 @@ Var ServiceInstallLog !define MUI_ICON tomcat.ico !define MUI_UNICON tomcat.ico - ;General - OutFile tomcat-installer.exe - ;Install Options pages LangString TEXT_JVM_TITLE ${LANG_ENGLISH} "Java Virtual Machine" LangString TEXT_JVM_SUBTITLE ${LANG_ENGLISH} "Java Virtual Machine path selection." @@ -339,7 +361,11 @@ Section -post Call createShortcuts ${EndIf} - WriteUninstaller "$INSTDIR\Uninstall.exe" + !ifndef INNER + SetOutPath $INSTDIR + ; this packages the signed uninstaller + File $%TEMP%\uninstall.exe + !endif WriteRegStr HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" "InstallPath" $INSTDIR WriteRegStr HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" "Version" @VERSION@ @@ -355,6 +381,14 @@ Section -post SectionEnd Function .onInit + !ifdef INNER + ; If INNER is defined, then we aren't supposed to do anything except write out + ; the installer. This is better than processing a command line option as it means + ; this entire code path is not present in the final (real) installer. + WriteUninstaller "$%TEMP%\uninstall.exe" + Quit + !endif + ${GetParameters} $R0 ClearErrors @@ -1085,90 +1119,92 @@ FunctionEnd ;-------------------------------- ;Uninstaller Section -Section Uninstall +!ifdef INNER + Section Uninstall - ${If} $TomcatServiceName == "" - MessageBox MB_ICONSTOP|MB_OK \ - "No service name specified to uninstall. This will be provided automatically if you uninstall via \ - Add/Remove Programs or the shortcut on the Start menu. Alternatively, call the installer from \ - the command line with -ServiceName=$\"<name of service>$\"." - Quit - ${EndIf} + ${If} $TomcatServiceName == "" + MessageBox MB_ICONSTOP|MB_OK \ + "No service name specified to uninstall. This will be provided automatically if you uninstall via \ + Add/Remove Programs or the shortcut on the Start menu. Alternatively, call the installer from \ + the command line with -ServiceName=$\"<name of service>$\"." + Quit + ${EndIf} - Delete "$INSTDIR\Uninstall.exe" + Delete "$INSTDIR\Uninstall.exe" - ; Stop Tomcat service monitor if running - DetailPrint "Stopping $TomcatServiceName service monitor" - nsExec::ExecToLog '"$INSTDIR\bin\$TomcatServiceManagerFileName" //MQ//$TomcatServiceName' - ; Delete Tomcat service - DetailPrint "Uninstalling $TomcatServiceName service" - nsExec::ExecToLog '"$INSTDIR\bin\$TomcatServiceFileName" //DS//$TomcatServiceName --LogPath "$INSTDIR\logs"' - ClearErrors + ; Stop Tomcat service monitor if running + DetailPrint "Stopping $TomcatServiceName service monitor" + nsExec::ExecToLog '"$INSTDIR\bin\$TomcatServiceManagerFileName" //MQ//$TomcatServiceName' + ; Delete Tomcat service + DetailPrint "Uninstalling $TomcatServiceName service" + nsExec::ExecToLog '"$INSTDIR\bin\$TomcatServiceFileName" //DS//$TomcatServiceName --LogPath "$INSTDIR\logs"' + ClearErrors - ; Don't know if 32-bit or 64-bit registry was used so, for now, remove both - SetRegView 32 - DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" - DeleteRegKey HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" - DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" - DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" - SetRegView 64 - DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" - DeleteRegKey HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" - DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" - DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" - - ; Don't know if short-cuts were created for all users, one user or not at all so, for now, remove both - SetShellVarContext all - RMDir /r "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" - SetShellVarContext current - RMDir /r "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" - - Delete "$INSTDIR\tomcat.ico" - Delete "$INSTDIR\LICENSE" - Delete "$INSTDIR\NOTICE" - RMDir /r "$INSTDIR\bin" - RMDir /r "$INSTDIR\lib" - Delete "$INSTDIR\conf\*.dtd" - RMDir "$INSTDIR\logs" - RMDir /r "$INSTDIR\webapps\docs" - RMDir /r "$INSTDIR\webapps\examples" - RMDir /r "$INSTDIR\work" - RMDir /r "$INSTDIR\temp" - RMDir "$INSTDIR" - - IfSilent Removed 0 - - ; if $INSTDIR was removed, skip these next ones - IfFileExists "$INSTDIR" 0 Removed - MessageBox MB_YESNO|MB_ICONQUESTION \ - "Remove all files in your Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName directory? (If you have anything \ - you created that you want to keep, click No)" IDNO Removed - ; these would be skipped if the user hits no - RMDir /r "$INSTDIR\webapps" - RMDir /r "$INSTDIR\logs" - RMDir /r "$INSTDIR\conf" - Delete "$INSTDIR\*.*" - RMDir /r "$INSTDIR" - Sleep 500 - IfFileExists "$INSTDIR" 0 Removed - MessageBox MB_OK|MB_ICONEXCLAMATION \ - "Note: $INSTDIR could not be removed." - Removed: + ; Don't know if 32-bit or 64-bit registry was used so, for now, remove both + SetRegView 32 + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" + DeleteRegKey HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" + DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" + DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" + SetRegView 64 + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" + DeleteRegKey HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" + DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" + DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "ApacheTomcatMonitor@VERSION_MAJOR_MINOR@_$TomcatServiceName" -SectionEnd + ; Don't know if short-cuts were created for all users, one user or not at all so, for now, remove both + SetShellVarContext all + RMDir /r "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" + SetShellVarContext current + RMDir /r "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" + Delete "$INSTDIR\tomcat.ico" + Delete "$INSTDIR\LICENSE" + Delete "$INSTDIR\NOTICE" + RMDir /r "$INSTDIR\bin" + RMDir /r "$INSTDIR\lib" + Delete "$INSTDIR\conf\*.dtd" + RMDir "$INSTDIR\logs" + RMDir /r "$INSTDIR\webapps\docs" + RMDir /r "$INSTDIR\webapps\examples" + RMDir /r "$INSTDIR\work" + RMDir /r "$INSTDIR\temp" + RMDir "$INSTDIR" + + IfSilent Removed 0 + + ; if $INSTDIR was removed, skip these next ones + IfFileExists "$INSTDIR" 0 Removed + MessageBox MB_YESNO|MB_ICONQUESTION \ + "Remove all files in your Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName directory? (If you have anything \ + you created that you want to keep, click No)" IDNO Removed + ; these would be skipped if the user hits no + RMDir /r "$INSTDIR\webapps" + RMDir /r "$INSTDIR\logs" + RMDir /r "$INSTDIR\conf" + Delete "$INSTDIR\*.*" + RMDir /r "$INSTDIR" + Sleep 500 + IfFileExists "$INSTDIR" 0 Removed + MessageBox MB_OK|MB_ICONEXCLAMATION \ + "Note: $INSTDIR could not be removed." + Removed: + + SectionEnd + + ; ================= + ; uninstall init function + ; + ; Read the command line paramater and set up the service name variables so the + ; uninstaller knows which service it is working with + ; ================= + Function un.onInit + ${GetParameters} $R0 + ${GetOptions} $R0 "-ServiceName=" $R1 + StrCpy $TomcatServiceName $R1 + StrCpy $TomcatServiceFileName $R1.exe + StrCpy $TomcatServiceManagerFileName $R1w.exe + FunctionEnd +!endif -; ================= -; uninstall init function -; -; Read the command line paramater and set up the service name variables so the -; uninstaller knows which service it is working with -; ================= -Function un.onInit - ${GetParameters} $R0 - ${GetOptions} $R0 "-ServiceName=" $R1 - StrCpy $TomcatServiceName $R1 - StrCpy $TomcatServiceFileName $R1.exe - StrCpy $TomcatServiceManagerFileName $R1w.exe -FunctionEnd ;eof Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1630526&r1=1630525&r2=1630526&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Oct 9 16:10:57 2014 @@ -176,6 +176,14 @@ </fix> </changelog> </subsection> + <subsection name="Other"> + <changelog> + <fix> + <bug>56079</bug>: The uninstaller packaged with the Apache Tomcat + Windows installer is now digitally signed. (markt) + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 8.0.14 (markt)" rtext="2014-09-29"> <subsection name="Other"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org