0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00
howdy/debian/prerm

46 lines
1.1 KiB
Text
Raw Normal View History

2018-11-09 12:43:10 +01:00
#!/usr/bin/python3
2018-04-05 21:12:36 +02:00
# Executed on deinstallation
# Completely remove howdy from the system
# Import required modules
import subprocess
2018-04-13 14:54:06 +02:00
import sys
2018-04-13 15:27:52 +02:00
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
2018-04-12 23:45:52 +02:00
try:
os.unlink('/usr/local/bin/howdy')
except Exception:
2018-04-12 23:45:52 +02:00
print("Can't remove executable")
try:
os.unlink('/usr/share/bash-completion/completions/howdy')
except Exception:
print("Can't remove autocompletion script")
# 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)
except Exception:
print("Can't remove pam module")
# Remove full installation folder, just to be sure
2018-04-12 23:45:52 +02:00
try:
rmtree('/lib/security/howdy')
except Exception:
2018-04-12 23:45:52 +02:00
# This error is normal
pass
# Remove dlib
subprocess.call(['pip3', 'uninstall', 'dlib', '-y', '--no-cache-dir'])