-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuninstall
executable file
·98 lines (85 loc) · 3.16 KB
/
uninstall
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python
'''
Alias Manager - UnInstaller
...un-installs everything 'install' created...
Created on Jan 21, 2013
@author: cj
'''
from __future__ import print_function
import sys
import os
import os.path
bdebug = False
sinstall_dir = '/usr/share/aliasmgr'
def main(largs):
global bdebug
# root check
if os.environ.has_key("USER"):
suser = os.environ["USER"]
if suser != 'root':
print("Please run this uninstaller as root.")
print("You might try 'sudo ./uninstall'")
exit(1)
for sarg in largs:
if "-h" in sarg or "--h" in sarg:
print("Alias Manager UnInstaller Help:")
print(" This uninstaller needs root, you might try running:")
print(" sudo ./uninstall")
print("\n To reinstall Alias Manager please run the install")
print(" script. Like this:")
print(" sudo ./install\n")
exit(0)
if '-d' in sarg or '--d' in sarg:
bdebug = True
do_uninstall()
def do_uninstall():
print("UnInstalling Alias Manager...")
if os.path.isdir(sinstall_dir):
print("Removing Alias Manager directory...")
if not bdebug:
try:
os.system('rm -r ' + sinstall_dir)
except:
print("Unable to remove Alias Manager directory!: /usr/share/aliasmgr")
else:
print("Alias Manager directory already removed!")
if os.path.islink('/usr/bin/aliasmgr'):
print("Removing Alias Manager symlink [/usr/bin/aliasmgr]")
if not bdebug:
try:
os.system('rm /usr/bin/aliasmgr')
except:
print("Unable to remove Alias Manager symlink!: /usr/bin/aliasmgr")
else:
print("Alias Manager symlink already removed!")
sdesktop_file = ""
if os.path.isfile('/usr/share/applications/aliasmanager.desktop'):
sdesktop_file = '/usr/share/applications/aliasmanager.desktop'
else:
if os.environ.has_key("HOME"):
sdesktop_file = os.path.join(os.environ['HOME'], '/.local/share/applications/aliasmanager.desktop')
if os.path.isfile(sdesktop_file):
print("Removing Alias Manager menu item [" + sdesktop_file + "]")
if not bdebug:
try:
os.system('rm ' + sdesktop_file)
except:
print("Unable to remove Alias Manager menu item!: " + sdesktop_file)
else:
print("Alias Manager menu item already removed!")
if os.path.isfile('/usr/share/pixmaps/alias-manager.xpm'):
print("Removing Alias Manager icon [/usr/share/pixmaps/alias-manager.xpm]")
if not bdebug:
try:
os.system('rm /usr/share/pixmaps/alias-manager.xpm')
except:
print("Unable to remove Alias Manager icon!: /usr/share/pixmaps/alias-manager.xpm")
else:
print("Alias Manager icon already removed!")
print("\nFinished removing Alias Manager.")
if __name__ == "__main__":
if len(sys.argv) < 2:
largs = []
else:
largs = sys.argv[1:]
main(largs)