-
Notifications
You must be signed in to change notification settings - Fork 1
/
uninstall.py
33 lines (26 loc) · 954 Bytes
/
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
import os
# system's username grab
user = os.getenv('USER')
# if ~/amate.py exists, it'll delete it
if os.path.isfile(f'/home/{user}/amate.py'):
os.system(f"rm ~/amate.py")
# zshrc alias remove
with open(f'/home/{user}/.zshrc','r') as f:
with open(f'/home/{user}/.zshrccopy','w') as w:
for i in f:
if i == 'alias amate="python $HOME/amate.py"\n':
continue
w.write(i)
os.system("mv ~/.zshrccopy ~/.zshrc")
# bashrc alias remove
with open(f'/home/{user}/.bashrc','r') as f:
with open(f'/home/{user}/.bashrccopy','w') as w:
for i in f:
if i == 'alias amate="python $HOME/amate.py"\n':
continue
w.write(i)
os.system("mv ~/.bashrccopy ~/.bashrc")
# os.system("sudo pacman -R --noconfirm archmate")
os.system("pacman -Q archmate |& grep -q 'not found' && echo 'Not installed to the system' || sudo pacman -R --noconfirm archmate")
# exit
exit()