2018-11-09 12:43:10 +01:00
|
|
|
#!/usr/bin/python3
|
2018-04-12 19:38:34 +02:00
|
|
|
# Used to check cameras before commiting to install
|
|
|
|
# Executed before primary apt install of files
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2018-05-10 15:05:27 +02:00
|
|
|
# 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")
|
2019-01-02 23:36:09 +01:00
|
|
|
except subprocess.CalledProcessError:
|
2018-05-10 15:05:27 +02:00
|
|
|
print("Could not make an backup of old Howdy config file")
|
|
|
|
|
|
|
|
# Don't continue setup when we're just upgrading
|
|
|
|
sys.exit(0)
|
|
|
|
|
2018-04-13 00:54:36 +02:00
|
|
|
# Don't run if we're not trying to install fresh
|
2018-04-12 19:38:34 +02:00
|
|
|
if "install" not in sys.argv:
|
|
|
|
sys.exit(0)
|