mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-12 09:41:18 +02:00
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
|
@ -73,17 +73,18 @@ class OnboardingWindow(gtk.Window):
|
|||
break
|
||||
else:
|
||||
lib_site = None
|
||||
|
||||
if lib_site is None:
|
||||
self.downloadoutputlabel.set_text(_("Unable to find Howdy's installation location"))
|
||||
return
|
||||
|
||||
if os.path.exists(lib_site + "/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
||||
if lib_site:
|
||||
conf_path = lib_site + "/security/howdy"
|
||||
else:
|
||||
conf_path = "/etc/howdy"
|
||||
|
||||
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.enable_next()
|
||||
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.read_download_line()
|
||||
|
|
|
@ -102,9 +102,9 @@ if not os.path.exists("/tmp/howdy_picked_device"):
|
|||
newConf.write(configfile)
|
||||
|
||||
# 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")
|
||||
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)
|
||||
|
||||
|
@ -121,7 +121,7 @@ handleStatus(subprocess.call(["pip3", "install", "--upgrade", "numpy"]))
|
|||
log("Downloading and unpacking data files")
|
||||
|
||||
# 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")
|
||||
|
||||
|
@ -208,6 +208,7 @@ print("Camera ID saved")
|
|||
|
||||
# Secure the howdy folder
|
||||
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
|
||||
os.chmod("/lib/security/howdy", 0o755)
|
||||
|
|
|
@ -9,13 +9,19 @@ import sys
|
|||
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)
|
||||
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
|
||||
print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
|
||||
except subprocess.CalledProcessError:
|
||||
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
|
||||
print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
|
||||
|
|
Loading…
Reference in a new issue