Skip to content
Permalink
Browse files

Handling cleanup of agent and launcher jars from previous version of …

…agent during an upgrade - #2789
  • Loading branch information...
jyotisingh committed Oct 27, 2016
1 parent f4bce94 commit 5387e2171ff4bd9aff68d3649f1e3ad5b13b44d5
@@ -48,7 +48,7 @@ Function SilentCustomUseInput
FunctionEnd

Function CustomInstallBits
Call CleanUpUnnecessaryStuffOfOldInstallations
Call CleanUpTempFilesFromOlderInstallations
StrCmp $GO_AGENT_JAVA_HOME "" 0 +2
StrCpy $GO_AGENT_JAVA_HOME "$INSTDIR\jre"

@@ -75,14 +75,17 @@ Function CustomInstallBits
DONE:
FunctionEnd

Function CleanUpUnnecessaryStuffOfOldInstallations
Function CleanUpTempFilesFromOlderInstallations
StrCmp $IsUpgrading $UPGRADING upgrade done

upgrade:
IfFileExists $INSTDIR\jdk 0 done
RMDir /r $INSTDIR\jdk
DELETE $INSTDIR\*agent-launcher.jar
IfFileExists $INSTDIR\agent.jar 0 +2
DELETE $INSTDIR\agent.jar
IfFileExists $INSTDIR\tfs-impl.jar 0 +2
DELETE $INSTDIR\tfs-impl.jar
IfFileExists $INSTDIR\agent-plugins.zip 0 +2
DELETE $INSTDIR\agent-plugins.zip
done:

FunctionEnd

; Silent Installer Service Creation Section
@@ -21,4 +21,6 @@
<% if name == 'go-server' -%>
# Start the service
/etc/init.d/go-server start
<% else -%>
<%= ERB.new(File.read(File.join(install_scripts_dir, 'shared', 'partials', '_cleanup_temp_files_from_previous_version_of_go_agent.sh.erb')), nil, '-', "_#{SecureRandom.hex}").result(binding) %>
<% end -%>
@@ -19,4 +19,6 @@
<% if name == 'go-server' -%>
# Start the service
/etc/init.d/go-server start
<% else -%>
<%= ERB.new(File.read(File.join(install_scripts_dir, 'shared', 'partials', '_cleanup_temp_files_from_previous_version_of_go_agent.sh.erb')), nil, '-', "_#{SecureRandom.hex}").result(binding) %>
<% end -%>
@@ -0,0 +1,19 @@
<%
#########################################################################
# Copyright 2016 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#########################################################################
-%>

rm -rf /var/lib/go-agent/{agent-launcher.jar,agent.jar,tfs-impl.jar,agent-plugins.zip} /var/lib/go-agent/*agent-launcher.jar

0 comments on commit 5387e21

Please sign in to comment.
You can’t perform that action at this time.