forked from jessp01/install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean.py
50 lines (40 loc) · 1.55 KB
/
clean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
__author__ = 'yuriy'
import os, util, config
def cleanUp(d):
cleanUpPreviousRun(d)
cleanUpTomcat(d)
def cleanUpTomcat(d):
tomcatConf = os.path.join(d['tomcatHome'], "conf")
tomcatBin = os.path.join(d['tomcatHome'], "bin")
tomcatWebapps = os.path.join(d['tomcatHome'], "webapps")
tomcatConf = os.path.normpath(tomcatConf)
tomcatBin = os.path.normpath(tomcatBin)
tomcatWebapps = os.path.normpath(tomcatWebapps)
if d['platform'] == "windows":
actions = [
'%s\\shutdown.bat' % (tomcatBin), # shutdown tomcat
'del /f /q %s\\ox*' % (tomcatConf), # remove OX configs
'del /f /q %s\\ox*' % (tomcatWebapps), # remove wars
'rmdir /s /q %s\\oxauth' % (tomcatWebapps), # remove dirs
'rmdir /s /q %s\\oxTrust' % (tomcatWebapps) # remove dirs
]
else:
actions = [
'%s/shutdown.sh' % (tomcatBin), # shutdown tomcat
'rm -f %s/ox*' % (tomcatConf), # remove OX configs
'rm -f %s/ox*' % (tomcatWebapps) # remove OX configs
]
util.call(actions)
def cleanUpPreviousRun(d):
if d['platform'] == "windows":
actions = [
'del /f /q %s' % d['dataGeneratedFile'], # remove dataGeneratedFile.ldif
'del /f /q %s' % d['schemaFN'], # remove schemaFN.ldif
]
else:
actions = [
'rm -f %s' % d['dataGeneratedFile'], # remove dataGeneratedFile.ldif
'rm -f %s' % d['schemaFN'], # remove schemaFN.ldif
]
util.call(actions)
cleanUp(config.getConfigDir())