0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-10-17 10:06:53 +02:00
howdy/debian/preinst

25 lines
813 B
Text
Raw Normal View History

2018-11-09 12:43:10 +01:00
#!/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")
2019-01-02 23:36:09 +01:00
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)