2018-11-09 12:43:10 +01:00
|
|
|
#!/usr/bin/python3
|
2018-04-05 21:12:36 +02:00
|
|
|
# Executed on deinstallation
|
2018-02-13 23:59:23 +01:00
|
|
|
# Completely remove howdy from the system
|
|
|
|
|
|
|
|
# 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-12-09 07:25:02 +01:00
|
|
|
from shutil import rmtree
|
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)
|
|
|
|
|
2019-03-14 15:53:48 +01:00
|
|
|
# Don't try running this if it's already gone
|
2018-04-13 00:54:36 +02:00
|
|
|
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:
|
2018-12-09 07:25:02 +01:00
|
|
|
os.unlink('/usr/local/bin/howdy')
|
|
|
|
except Exception:
|
2018-04-12 23:45:52 +02:00
|
|
|
print("Can't remove executable")
|
2018-04-07 17:39:14 +02:00
|
|
|
try:
|
2018-12-09 07:25:02 +01:00
|
|
|
os.unlink('/usr/share/bash-completion/completions/howdy')
|
|
|
|
except Exception:
|
2018-04-12 19:38:34 +02:00
|
|
|
print("Can't remove autocompletion script")
|
2018-12-05 12:23:07 +01:00
|
|
|
|
|
|
|
# Refresh and remove howdy from pam-config
|
|
|
|
try:
|
|
|
|
subprocess.call(["pam-auth-update --package"], shell=True)
|
|
|
|
subprocess.call(["rm /usr/share/pam-configs/howdy"], shell=True)
|
|
|
|
subprocess.call(["pam-auth-update --package"], shell=True)
|
2018-12-21 16:51:23 +01:00
|
|
|
except Exception:
|
2018-12-05 12:23:07 +01:00
|
|
|
print("Can't remove pam module")
|
|
|
|
|
|
|
|
# Remove full installation folder, just to be sure
|
2018-04-12 23:45:52 +02:00
|
|
|
try:
|
2018-12-09 07:25:02 +01:00
|
|
|
rmtree('/lib/security/howdy')
|
|
|
|
except Exception:
|
2018-04-12 23:45:52 +02:00
|
|
|
# This error is normal
|
2018-04-07 17:39:14 +02:00
|
|
|
pass
|
|
|
|
|
2018-12-09 08:28:16 +01:00
|
|
|
# Remove dlib
|
2018-12-09 07:25:02 +01:00
|
|
|
subprocess.call(['pip3', 'uninstall', 'dlib', '-y', '--no-cache-dir'])
|