mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
tor: Completely uninstall app
Tests: * Manually reinstall the app and check if hidden service is regenerated * Functional tests passed Signed-off-by: nbenedek <contact@nbenedek.me> [sunil: Update docstrings, make uninstall fail-safe] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
6c14b9a304
commit
82101cc9b3
@ -187,6 +187,11 @@ class TorApp(app_module.App):
|
|||||||
if not old_version:
|
if not old_version:
|
||||||
self.enable()
|
self.enable()
|
||||||
|
|
||||||
|
def uninstall(self):
|
||||||
|
"""De-configure and uninstall the app."""
|
||||||
|
super().uninstall()
|
||||||
|
privileged.uninstall()
|
||||||
|
|
||||||
|
|
||||||
def update_hidden_service_domain(status=None):
|
def update_hidden_service_domain(status=None):
|
||||||
"""Update HS domain with Name Services module."""
|
"""Update HS domain with Name Services module."""
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import codecs
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
@ -507,3 +508,14 @@ def _set_onion_header(hidden_service):
|
|||||||
encoding='utf-8')
|
encoding='utf-8')
|
||||||
|
|
||||||
action_utils.service_reload('apache2')
|
action_utils.service_reload('apache2')
|
||||||
|
|
||||||
|
|
||||||
|
@privileged
|
||||||
|
def uninstall():
|
||||||
|
"""Remove create instances."""
|
||||||
|
directories = [
|
||||||
|
'/etc/tor/instances/', '/var/lib/tor-instances/',
|
||||||
|
'/var/run/tor-instances/'
|
||||||
|
]
|
||||||
|
for directory in directories:
|
||||||
|
shutil.rmtree(directory, ignore_errors=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user