Skip to content

Commit 4ec9dc3

Browse files
authored
Merge pull request #34 from Boltgolt/dev
Version 2.2.1
2 parents 0e7300c + c57d9e8 commit 4ec9dc3

12 files changed

Lines changed: 122 additions & 20 deletions

File tree

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ notifications:
2323
email:
2424
on_success: never
2525
on_failure: always
26+
27+
addons:
28+
apt:
29+
update: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Howdy for Ubuntu [![](https://img.shields.io/travis/Boltgolt/howdy/master.svg)](https://travis-ci.org/Boltgolt/howdy) [![](https://img.shields.io/github/release/Boltgolt/howdy.svg?colorB=4c1)](https://github.com/Boltgolt/howdy/releases) ![](https://boltgolt.nl/howdy_badge/installs.php)
1+
# Howdy for Ubuntu [![](https://img.shields.io/travis/Boltgolt/howdy/master.svg)](https://travis-ci.org/Boltgolt/howdy) [![](https://img.shields.io/github/release/Boltgolt/howdy.svg?colorB=4c1)](https://github.com/Boltgolt/howdy/releases) ![](https://boltgolt.nl/howdy_badge/installs.php?nc) ![](https://boltgolt.nl/howdy_badge/views.php)
22

33
Windows Hello™ style authentication for Ubuntu. Use your built-in IR emitters and camera in combination with face recognition to prove who you are.
44

autocomplete/howdy

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,42 @@
55
_howdy() {
66
local cur prev opts
77
COMPREPLY=()
8+
# The argument typed so far
89
cur="${COMP_WORDS[COMP_CWORD]}"
10+
# The previous argument
911
prev="${COMP_WORDS[COMP_CWORD-1]}"
10-
opts="help list add remove clear"
1112

12-
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
13+
# Go though all cases we support
14+
case "${prev}" in
15+
# After the main command, show the commands
16+
"howdy")
17+
opts="add clear config disable list remove clear test"
18+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
19+
return 0
20+
;;
21+
# For disable, grab the current "disabled" config option and give the reverse
22+
"disable")
23+
local status=$(cut -d'=' -f2 <<< $(cat /lib/security/howdy/config.ini | grep 'disabled =') | xargs echo -n)
24+
25+
[ "$status" == "false" ] && COMPREPLY="true" || COMPREPLY="false"
26+
return 0
27+
;;
28+
# List the users availible
29+
"-U")
30+
COMPREPLY=( $(compgen -u -- ${cur}) )
31+
return 0
32+
;;
33+
"--user")
34+
COMPREPLY=( $(compgen -u -- ${cur}) )
35+
return 0
36+
;;
37+
*)
38+
;;
39+
esac
40+
41+
# Nothing matched, so return nothing
1342
return 0
1443
}
1544

45+
# Register the autocomplete function
1646
complete -F _howdy howdy

debian/changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
howdy (2.2.1) xenial; urgency=medium
2+
3+
* Added mechanism to keep config files between updates
4+
* Added force_mjpeg option to fix YUYV image issues (thanks @arifeinberg!)
5+
* Revamped the bash autocompletion script
6+
* Fixed timeout never being reached in certain scenarios (thanks @Tkopic001!)
7+
* Fixed issue where BGR to RGB frame conversion caused a crash (thanks @Jerezano!)
8+
9+
-- boltgolt <boltgolt@gmail.com> Thu, 10 May 2018 15:14:03 +0200
10+
111
howdy (2.1.0) xenial; urgency=medium
212

313
* First complete PPA release

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Package: howdy
1010
Homepage: https://github.com/Boltgolt/howdy
1111
Architecture: all
1212
Depends: ${misc:Depends}, git, python3, python3-pip, python3-dev, python3-setuptools, build-essential, libpam-python, fswebcam, libopencv-dev, python-opencv, cmake
13-
Description: Windows Hello style authentication for Ubuntu.
13+
Description: Howdy: Windows Hello style authentication for Ubuntu.
1414
Use your built-in IR emitters and camera in combination with face recognition
1515
to prove who you are.

debian/postinst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,34 @@ def handleStatus(status):
3636
sys.exit(1)
3737

3838

39-
# We're not in fresh configuration mode (probably an upgrade), so exit
39+
# We're not in fresh configuration mode so don't continue the setup
4040
if not os.path.exists("/tmp/howdy_picked_device"):
41+
# Check if we have an older config we can restore
42+
if len(sys.argv) > 2:
43+
if os.path.exists("/tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"):
44+
# Get the config parser
45+
import configparser
46+
47+
# Load th old and new config files
48+
oldConf = configparser.ConfigParser()
49+
oldConf.read("/tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
50+
newConf = configparser.ConfigParser()
51+
newConf.read("/lib/security/howdy/config.ini")
52+
53+
# Go through every setting in the old config and apply it to the new file
54+
for section in oldConf.sections():
55+
for (key, value) in oldConf.items(section):
56+
try:
57+
newConf.set(section, key, value)
58+
# Add a new section where needed
59+
except configparser.NoSectionError as e:
60+
newConf.add_section(section)
61+
newConf.set(section, key, value)
62+
63+
# Write it all to file
64+
with open("/lib/security/howdy/config.ini", "w") as configfile:
65+
newConf.write(configfile)
66+
4167
sys.exit(0)
4268

4369
# Open the temporary file containing the device ID
@@ -162,7 +188,7 @@ if "HOWDY_NO_PROMPT" not in os.environ:
162188

163189
# Abort the whole thing if it's not
164190
if (ans.lower() != "y"):
165-
print("Inerpeting as a \"NO\", aborting")
191+
print("Interpreting as a \"NO\", aborting")
166192
sys.exit(1)
167193

168194
print("Adding lines to PAM\n")

debian/preinst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ import os
1616
import re
1717
import signal
1818

19+
# Backup the config file if we're upgrading
20+
if "upgrade" in sys.argv:
21+
# Try to copy the config file as a backup
22+
try:
23+
subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True)
24+
25+
# Let the user know so he knows where to look on a failed install
26+
print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini")
27+
except e:
28+
print("Could not make an backup of old Howdy config file")
29+
30+
# Don't continue setup when we're just upgrading
31+
sys.exit(0)
32+
1933
# Don't run if we're not trying to install fresh
2034
if "install" not in sys.argv:
2135
sys.exit(0)

src/cli/add.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080

8181
# Open the camera
8282
video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
83+
84+
# Force MJPEG decoding if true
85+
if config.get("debug", "force_mjpeg") == "true":
86+
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
87+
88+
# Request a frame to wake the camera up
8389
video_capture.read()
8490

8591
print("\nPlease look straight into the camera")

src/cli/disable.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@
2121
sys.exit(1)
2222

2323
# Translate the argument to the right string
24-
if builtins.howdy_args.argument == "1":
24+
if builtins.howdy_args.argument == "1" or builtins.howdy_args.argument.lower() == "true":
2525
out_value = "true"
26-
elif builtins.howdy_args.argument == "0":
26+
elif builtins.howdy_args.argument == "0" or builtins.howdy_args.argument.lower() == "false":
2727
out_value = "false"
2828
else:
2929
# Of it's not a 0 or a 1, it's invalid
30-
print("Please only use a 0 (enable) or a 1 (disable) as an argument")
30+
print("Please only use false (enable) or true (disable) as an argument")
31+
sys.exit(1)
32+
33+
# Don't do anything when the state is already the requested one
34+
if out_value == config.get("core", "disabled"):
35+
print("The disable option has already been set to " + out_value)
3136
sys.exit(1)
3237

3338
# Loop though the config file and only replace the line containing the disable config

src/cli/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# Start capturing from the configured webcam
2121
video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
2222

23+
# Force MJPEG decoding if true
24+
if config.get("debug", "force_mjpeg") == "true":
25+
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
26+
2327
# Let the user know what's up
2428
print("""
2529
Opening a window with a test feed

0 commit comments

Comments
 (0)