mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
48 lines
1.2 KiB
Python
Executable file
48 lines
1.2 KiB
Python
Executable file
#!/usr/bin/python3
|
|
# Executed on deinstallation
|
|
# Completely remove howdy from the system
|
|
|
|
def col(id):
|
|
"""Add color escape sequences"""
|
|
if id == 1: return "\033[32m"
|
|
if id == 2: return "\033[33m"
|
|
if id == 3: return "\033[31m"
|
|
return "\033[0m"
|
|
|
|
# Import required modules
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
from shutil import rmtree
|
|
|
|
# Only run when we actually want to remove
|
|
if "remove" not in sys.argv and "purge" not in sys.argv:
|
|
sys.exit(0)
|
|
|
|
# Don't try running this if it's already gome
|
|
if not os.path.exists("/lib/security/howdy/cli"):
|
|
sys.exit(0)
|
|
|
|
# Remove files and symlinks
|
|
try:
|
|
os.unlink('/usr/local/bin/howdy')
|
|
except Exception:
|
|
print("Can't remove executable")
|
|
try:
|
|
os.unlink('/usr/share/bash-completion/completions/howdy')
|
|
except Exception:
|
|
print("Can't remove autocompletion script")
|
|
try:
|
|
rmtree('/lib/security/howdy')
|
|
except Exception:
|
|
# This error is normal
|
|
pass
|
|
|
|
# Remove dlib
|
|
subprocess.call(['pip3', 'uninstall', 'dlib', '-y', '--no-cache-dir'])
|
|
|
|
# Print a tearbending message
|
|
print(col(2) + """
|
|
There are still lines in /etc/pam.d/common-auth that can't be removed automatically
|
|
Run "nano /etc/pam.d/common-auth" to remove them by hand\
|
|
""" + col(0))
|