mirror of
https://github.com/boltgolt/howdy.git
synced 2024-10-17 10:06:53 +02:00
24 lines
813 B
Python
Executable file
24 lines
813 B
Python
Executable file
#!/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)
|