gtk: search for config.ini in /etc/howdy
This commit is contained in:
parent
c345fb1fa8
commit
dee239a13c
3 changed files with 19 additions and 11 deletions
|
|
@ -74,16 +74,17 @@ class OnboardingWindow(gtk.Window):
|
||||||
else:
|
else:
|
||||||
lib_site = None
|
lib_site = None
|
||||||
|
|
||||||
if lib_site is None:
|
if lib_site:
|
||||||
self.downloadoutputlabel.set_text(_("Unable to find Howdy's installation location"))
|
conf_path = lib_site + "/security/howdy"
|
||||||
return
|
else:
|
||||||
|
conf_path = "/etc/howdy"
|
||||||
|
|
||||||
if os.path.exists(lib_site + "/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
if os.path.exists(conf_path + "/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
||||||
self.downloadoutputlabel.set_text(_("Datafiles have already been downloaded!\nClick Next to continue"))
|
self.downloadoutputlabel.set_text(_("Datafiles have already been downloaded!\nClick Next to continue"))
|
||||||
self.enable_next()
|
self.enable_next()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.proc = subprocess.Popen("./install.sh", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, cwd=lib_site + "/security/howdy/dlib-data")
|
self.proc = subprocess.Popen("./install.sh", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, cwd=conf_path + "/howdy/dlib-data")
|
||||||
|
|
||||||
self.download_lines = []
|
self.download_lines = []
|
||||||
self.read_download_line()
|
self.read_download_line()
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,9 @@ if not os.path.exists("/tmp/howdy_picked_device"):
|
||||||
newConf.write(configfile)
|
newConf.write(configfile)
|
||||||
|
|
||||||
# Install dlib data files if needed
|
# Install dlib data files if needed
|
||||||
if not os.path.exists("/lib/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
if not os.path.exists("/lib/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat") and not os.path.exists("/etc/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
||||||
print("Attempting installation of missing data files")
|
print("Attempting installation of missing data files")
|
||||||
handleStatus(subprocess.call(["./install.sh"], shell=True, cwd="/lib/security/howdy/dlib-data"))
|
handleStatus(subprocess.call(["./install.sh"], shell=True, cwd="/etc/howdy/dlib-data"))
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ handleStatus(subprocess.call(["pip3", "install", "--upgrade", "numpy"]))
|
||||||
log("Downloading and unpacking data files")
|
log("Downloading and unpacking data files")
|
||||||
|
|
||||||
# Run the bash script to download and unpack the .dat files needed
|
# Run the bash script to download and unpack the .dat files needed
|
||||||
handleStatus(subprocess.call(["./install.sh"], shell=True, cwd="/lib/security/howdy/dlib-data"))
|
handleStatus(subprocess.call(["./install.sh"], shell=True, cwd="/etc/howdy/dlib-data"))
|
||||||
|
|
||||||
log("Downloading dlib")
|
log("Downloading dlib")
|
||||||
|
|
||||||
|
|
@ -208,6 +208,7 @@ print("Camera ID saved")
|
||||||
|
|
||||||
# Secure the howdy folder
|
# Secure the howdy folder
|
||||||
handleStatus(sc(["chmod 744 -R /lib/security/howdy/"], shell=True))
|
handleStatus(sc(["chmod 744 -R /lib/security/howdy/"], shell=True))
|
||||||
|
handleStatus(sc(["chmod 744 -R /etc/howdy/"], shell=True))
|
||||||
|
|
||||||
# Allow anyone to execute the python CLI
|
# Allow anyone to execute the python CLI
|
||||||
os.chmod("/lib/security/howdy", 0o755)
|
os.chmod("/lib/security/howdy", 0o755)
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,19 @@ import sys
|
||||||
if "upgrade" in sys.argv:
|
if "upgrade" in sys.argv:
|
||||||
# Try to copy the config file as a backup
|
# Try to copy the config file as a backup
|
||||||
try:
|
try:
|
||||||
subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True)
|
if os.path.exists("/lib/security/howdy/config.ini") and not os.path.exists("/etc/howdy/config.ini"):
|
||||||
|
subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True)
|
||||||
|
else os.path.exists("/etc/howdy/config.ini"):
|
||||||
|
subprocess.call(["cp /etc/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
|
# 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")
|
print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
try:
|
try:
|
||||||
subprocess.call(["cp /etc/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True)
|
if os.path.exists("/lib/security/howdy/config.ini") and not os.path.exists("/etc/howdy/config.ini"):
|
||||||
|
subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True)
|
||||||
|
else os.path.exists("/etc/howdy/config.ini"):
|
||||||
|
subprocess.call(["cp /etc/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
|
# 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")
|
print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue