-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuninstall.py
67 lines (53 loc) · 1.61 KB
/
uninstall.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import subprocess as sub
import pathlib
from pathlib import Path
import sqlite3
import shutil
# Remember to change setup too!
HOME_USER = str(Path.home())
GET_CURRENT_LOCATION = pathlib.Path().resolve()
APP_NAME_CLOSE = "timemachine"
DST_FILE_EXE_DESKTOP = f"{HOME_USER}/.local/share/applications/{APP_NAME_CLOSE}.desktop"
DST_MIGRATION_ASSISTANT_DESKTOP = f"{HOME_USER}/.local/share/applications/migration_assistant.desktop"
DST_BACKUP_CHECK_DESKTOP = f"{HOME_USER}/.local/share/{APP_NAME_CLOSE}/src/desktop/backup_check.desktop"
SRC_USER_CONFIG_DB = f"{HOME_USER}/.local/share/{APP_NAME_CLOSE}/src/ini/config.db"
# Disable system tray
# Connect to the SQLite database
conn = sqlite3.connect(SRC_USER_CONFIG_DB)
cursor = conn.cursor()
cursor.execute(f'''
INSERT OR REPLACE INTO SYSTEMTRAY (key, value)
VALUES (?, ?)
''', ('system_tray', 'False'))
conn.commit()
conn.close()
try:
command = f"{HOME_USER}/.local/share/{APP_NAME_CLOSE}/"
# Remove dir
# sub.run(["rm", "-rf", command])
shutil.rmtree(command)
except Exception as error:
print(error)
try:
command = DST_FILE_EXE_DESKTOP
sub.run(["rm", "-rf", command])
# Remove dir
shutil.rmtree(command)
except Exception as error:
print(error)
try:
command = DST_MIGRATION_ASSISTANT_DESKTOP
# sub.run(["rm", "-rf", command])
# Remove dir
shutil.rmtree(command)
except Exception as error:
print(error)
try:
command = DST_BACKUP_CHECK_DESKTOP
# sub.run(["rm", "-rf", command])
# Remove dir
shutil.rmtree(command)
except Exception as error:
print(error)
print("App was successfully removed.")
exit()