add uninstall
This commit is contained in:
@@ -39,14 +39,17 @@ def check_version():
|
|||||||
## }
|
## }
|
||||||
return str('.'.join(json.loads(mattermost_raw_version)['version'].split('.')[0:3]))
|
return str('.'.join(json.loads(mattermost_raw_version)['version'].split('.')[0:3]))
|
||||||
|
|
||||||
|
|
||||||
def systemd_stop_service(servicename):
|
def systemd_stop_service(servicename):
|
||||||
print('Systemd stop %s' % servicename)
|
print('Systemd stop %s' % servicename)
|
||||||
run('systemctl stop %s' % servicename)
|
run('systemctl stop %s' % servicename)
|
||||||
|
|
||||||
|
|
||||||
def systemd_start_service(servicename):
|
def systemd_start_service(servicename):
|
||||||
print('Systemd start %s' % servicename)
|
print('Systemd start %s' % servicename)
|
||||||
run('systemctl start %s' % servicename)
|
run('systemctl start %s' % servicename)
|
||||||
|
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
print('Installing %s' % control.asrequirement())
|
print('Installing %s' % control.asrequirement())
|
||||||
|
|
||||||
@@ -184,6 +187,7 @@ def install():
|
|||||||
f.truncate()
|
f.truncate()
|
||||||
|
|
||||||
print('Create Mattermost server service')
|
print('Create Mattermost server service')
|
||||||
|
|
||||||
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
|
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
|
||||||
template = jinja_env.get_template('mattermost.service.j2')
|
template = jinja_env.get_template('mattermost.service.j2')
|
||||||
|
|
||||||
@@ -211,6 +215,7 @@ def install():
|
|||||||
|
|
||||||
print('Mattermost Server is installed !')
|
print('Mattermost Server is installed !')
|
||||||
|
|
||||||
|
# Install Nginx if needed
|
||||||
if use_nginx:
|
if use_nginx:
|
||||||
#WAPT.install('{}-nginx'.format(control.package.split('-')[0]))
|
#WAPT.install('{}-nginx'.format(control.package.split('-')[0]))
|
||||||
print('Install Nginx Web Server')
|
print('Install Nginx Web Server')
|
||||||
@@ -265,13 +270,33 @@ def install():
|
|||||||
|
|
||||||
print('Create symlink to activate mattermost site')
|
print('Create symlink to activate mattermost site')
|
||||||
if not os.path.exists('/etc/nginx/sites-enabled/mattermost.conf'):
|
if not os.path.exists('/etc/nginx/sites-enabled/mattermost.conf'):
|
||||||
print(run('ln -s /etc/nginx/sites-available/mattermost.conf /etc/nginx/sites-enabled/mattermost.conf'))
|
print(run('ln -s /etc/nginx/sites-available/mattermost.conf /etc/nginx/sites-enabled/mattermost.conf'))
|
||||||
|
|
||||||
print('Test Nginx configuration and start nginx')
|
print('Test Nginx configuration and start nginx')
|
||||||
print(run('nginx -t'))
|
print(run('nginx -t'))
|
||||||
print(run('systemctl restart nginx'))
|
print(run('systemctl restart nginx'))
|
||||||
print(run('systemctl enable nginx'))
|
print(run('systemctl enable nginx'))
|
||||||
|
|
||||||
|
|
||||||
|
def uninstall():
|
||||||
|
print('Uninstall Mattermost Server')
|
||||||
|
print("Warning ! This script doesn't remove Mysql Server or Postgresql Server")
|
||||||
|
systemd_stop_service('mattermost')
|
||||||
|
|
||||||
|
print('Remove nginx configuration files')
|
||||||
|
os.unlink(makepath('/etc','nginx','sites-enabled','mattermost.conf'))
|
||||||
|
remove_file(makepath('/etc','nginx','sites-avalables','mattermost.conf'))
|
||||||
|
print(run('nginx -t'))
|
||||||
|
print(run('systemctl restart nginx'))
|
||||||
|
|
||||||
|
print('Remove Mattermost Server Service')
|
||||||
|
remove_file(makepath('/lib','systemd','system','mattermost.service'))
|
||||||
|
run('systemctl daemon-reload')
|
||||||
|
|
||||||
|
print('Remove Mattermost server folder')
|
||||||
|
remove_tree(mattermost_path)
|
||||||
|
|
||||||
|
|
||||||
def audit():
|
def audit():
|
||||||
installed_version = check_version()
|
installed_version = check_version()
|
||||||
|
|
||||||
@@ -284,7 +309,6 @@ def audit():
|
|||||||
|
|
||||||
|
|
||||||
def update_package():
|
def update_package():
|
||||||
|
|
||||||
proxies = {}
|
proxies = {}
|
||||||
if isfile(makepath(application_data(),'waptconsole','waptconsole.ini')):
|
if isfile(makepath(application_data(),'waptconsole','waptconsole.ini')):
|
||||||
proxywapt = inifile_readstring(makepath(user_local_appdata(),'waptconsole','waptconsole.ini'),'global','http_proxy')
|
proxywapt = inifile_readstring(makepath(user_local_appdata(),'waptconsole','waptconsole.ini'),'global','http_proxy')
|
||||||
|
|||||||
Reference in New Issue
Block a user