#!/usr/bin/python3 # Used to check cameras before commiting to install # Executed before primary apt install of files import subprocess import sys # Backup the config file if we're upgrading if "upgrade" in sys.argv: # Try to copy the config file as a backup try: subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True) # Let the user know so he knows where to look on a failed install print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini") except subprocess.CalledProcessError: print("Could not make an backup of old Howdy config file") # Don't continue setup when we're just upgrading sys.exit(0) # Don't run if we're not trying to install fresh if "install" not in sys.argv: sys.exit(0)