From e15ef744398749f89805806f602759b51585f6e2 Mon Sep 17 00:00:00 2001 From: boltgolt Date: Thu, 12 Apr 2018 23:45:52 +0200 Subject: [PATCH] Fixed dlib dependency issue --- README.md | 2 +- debian/changelog | 7 +++++++ debian/postinst | 15 +++++++++++---- debian/preinst | 1 + debian/prerm | 10 +++++++++- 5 files changed, 29 insertions(+), 6 deletions(-) mode change 100644 => 100755 debian/preinst diff --git a/README.md b/README.md index 3094fa0..152b6d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Howdy for Ubuntu [![](https://travis-ci.org/Boltgolt/howdy.svg?branch=dev)](https://travis-ci.org/Boltgolt/howdy) +# Howdy for Ubuntu [![](https://travis-ci.org/Boltgolt/howdy.svg?branch=dev)](https://travis-ci.org/Boltgolt/howdy) ![](https://img.shields.io/github/release/Boltgolt/howdy.svg) [![](https://img.shields.io/github/issues-raw/Boltgolt/howdy/enhancement.svg?label=feature requests)](https://github.com/Boltgolt/howdy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) Windows Helloâ„¢ style authentication for Ubuntu. Use your built-in IR emitters and camera in combination with face recognition to prove who you are. diff --git a/debian/changelog b/debian/changelog index 18017d1..a8959b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +howdy (2.0.0-alpha+3) xenial; urgency=medium + + * Fixed issue where dlib dependency failed to install on some installations + * Added preinst script for camera detection + + -- boltgolt Thu, 12 Apr 2018 21:42:42 +0000 + howdy (2.0.0-alpha+2) xenial; urgency=medium * Fixed build dependency issue diff --git a/debian/postinst b/debian/postinst index 2b764a1..c1b45ec 100755 --- a/debian/postinst +++ b/debian/postinst @@ -25,25 +25,27 @@ def handleStatus(status): print("\033[31mError while running last command\033[0m") sys.exit(1) -log("Upgrading pip to the latest version") # We're not in fresh configuration mode, so exit if not os.path.exists("/tmp/howdy_picked_device"): sys.exit(0) in_file = open("/tmp/howdy_picked_device", "r") -picked = int(in_file.read()) +# Should be a string +picked = in_file.read() in_file.close() subprocess.call(["rm /tmp/howdy_picked_device"], shell=True) +log("Upgrading pip to the latest version") + # Update pip handleStatus(subprocess.call(["pip3 install --upgrade pip"], shell=True)) log("Cloning dlib") # Clone the git to /tmp -handleStatus(subprocess.call(["git", "clone", "https://github.com/davisking/dlib.git", "/tmp/dlib_clone"])) +handleStatus(subprocess.call(["git", "clone", "--depth", "1", "https://github.com/davisking/dlib.git", "/tmp/dlib_clone"])) log("Building dlib") @@ -56,10 +58,15 @@ log("Cleaning up dlib") handleStatus(subprocess.call(["rm", "-rf", "/tmp/dlib_clone"])) print("Temporary dlib files removed") +log("Installing python dependencies") + +# Install face_recognition though pip +handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "face_recognition_models==0.3.0", "Click>=6.0", "numpy", "Pillow"])) + log("Installing face_recognition") # Install face_recognition though pip -handleStatus(subprocess.call(["pip3", "install", "face_recognition"])) +handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "--no-deps", "face_recognition==1.2.2"])) log("Configuring howdy") diff --git a/debian/preinst b/debian/preinst old mode 100644 new mode 100755 index 1fabc77..d62616b --- a/debian/preinst +++ b/debian/preinst @@ -86,4 +86,5 @@ if picked == -1: with open("/tmp/howdy_picked_device", "w") as out_file: out_file.write(str(picked)) +# Add a line break print("") diff --git a/debian/prerm b/debian/prerm index 910bd88..cd693d2 100755 --- a/debian/prerm +++ b/debian/prerm @@ -12,14 +12,22 @@ def col(id): import subprocess # Remove files and symlinks +try: + subprocess.call(["rm /usr/local/bin/howdy"], shell=True) +except e: + print("Can't remove executable") try: subprocess.call(["rm /usr/share/bash-completion/completions/howdy"], shell=True) except e: print("Can't remove autocompletion script") +try: + subprocess.call(["rm -rf /lib/security/howdy"], shell=True) +except e: + # This error is normal pass # Remove face_recognition and dlib -subprocess.call(["pip3 uninstall face_recognition dlib -y --no-cache-dir"], shell=True) +subprocess.call(["pip3 uninstall face_recognition face_recognition_models dlib -y --no-cache-dir"], shell=True) # Print a tearbending message print(col(2) + """