2018-04-05 21:12:36 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Executed on deinstallation
|
2018-02-13 23:59:23 +01:00
|
|
|
# Completely remove howdy from the system
|
|
|
|
|
2018-04-12 19:38:34 +02:00
|
|
|
def col(id):
|
2018-04-13 00:54:36 +02:00
|
|
|
"""Add color escape sequences"""
|
2018-04-12 19:38:34 +02:00
|
|
|
if id == 1: return "\033[32m"
|
|
|
|
if id == 2: return "\033[33m"
|
|
|
|
if id == 3: return "\033[31m"
|
|
|
|
return "\033[0m"
|
|
|
|
|
2018-02-13 23:59:23 +01:00
|
|
|
# Import required modules
|
2018-02-13 15:00:30 +01:00
|
|
|
import subprocess
|
2018-04-13 14:54:06 +02:00
|
|
|
import sys
|
2018-04-13 15:27:52 +02:00
|
|
|
import os
|
2018-02-13 15:00:30 +01:00
|
|
|
|
2018-04-13 00:54:36 +02:00
|
|
|
# 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)
|
|
|
|
|
2018-02-13 23:59:23 +01:00
|
|
|
# Remove files and symlinks
|
2018-04-12 23:45:52 +02:00
|
|
|
try:
|
|
|
|
subprocess.call(["rm /usr/local/bin/howdy"], shell=True)
|
|
|
|
except e:
|
|
|
|
print("Can't remove executable")
|
2018-04-07 17:39:14 +02:00
|
|
|
try:
|
|
|
|
subprocess.call(["rm /usr/share/bash-completion/completions/howdy"], shell=True)
|
2018-04-07 19:15:00 +02:00
|
|
|
except e:
|
2018-04-12 19:38:34 +02:00
|
|
|
print("Can't remove autocompletion script")
|
2018-04-12 23:45:52 +02:00
|
|
|
try:
|
|
|
|
subprocess.call(["rm -rf /lib/security/howdy"], shell=True)
|
|
|
|
except e:
|
|
|
|
# This error is normal
|
2018-04-07 17:39:14 +02:00
|
|
|
pass
|
|
|
|
|
2018-02-13 23:59:23 +01:00
|
|
|
# Remove face_recognition and dlib
|
2018-04-12 23:45:52 +02:00
|
|
|
subprocess.call(["pip3 uninstall face_recognition face_recognition_models dlib -y --no-cache-dir"], shell=True)
|
2018-02-13 23:59:23 +01:00
|
|
|
|
|
|
|
# Print a tearbending message
|
2018-04-12 19:38:34 +02:00
|
|
|
print(col(2) + """
|
2018-02-13 23:59:23 +01:00
|
|
|
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\
|
2018-04-12 19:38:34 +02:00
|
|
|
""" + col(0))
|