From 353463eebda239db61301da7a12d21ca57e1c802 Mon Sep 17 00:00:00 2001 From: boltgolt Date: Fri, 13 Apr 2018 00:54:36 +0200 Subject: [PATCH] Added manpage and commented recent additions --- README.md | 2 +- debian/howdy.1 | 73 +++++++++++++++---------------------------- debian/howdy.manpages | 1 + debian/postinst | 29 +++++++++++------ debian/preinst | 6 +++- debian/prerm | 9 ++++++ 6 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 debian/howdy.manpages diff --git a/README.md b/README.md index 152b6d7..89a0946 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) ![](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) +# 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/howdy.1 b/debian/howdy.1 index 97c3cea..8d3d47b 100644 --- a/debian/howdy.1 +++ b/debian/howdy.1 @@ -1,54 +1,31 @@ .\" Please adjust this date whenever revising the manpage. -.TH HOWDY SECTION "April 9, 2018" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) +.TH HOWDY 1 "April 9, 2018" "Howdy help" "User Commands" .SH NAME howdy \- Windows Hello style authentication for Ubuntu -.SH SYNOPSIS -.B howdy -.RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... .SH DESCRIPTION -This manual page documents briefly the -.B nwsmtp -and -.B bar -commands. +Howdy IR face recognition implements a PAM module to use your face as a authentication method. +.SS "Usage:" +.IP +howdy [user] [argument] +.SS "Commands:" +.TP +help +Show this help page +.TP +list +List all saved face models for the current user +.TP +add +Add a new face model for the current user +.TP +remove +Remove a specific model +.TP +clear +Remove all face models for the current user +.TP +test +Test the camera and recognition methods .PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBnwsmtp\fP is a program that... -.SH OPTIONS -These programs follow the usual GNU command line syntax, with long -options starting with two dashes (`-'). -A summary of options is included below. -For a complete description, see the Info files. -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.SH SEE ALSO -.BR bar (1), -.BR baz (1). -.br -The programs are documented fully by -.IR "The Rise and Fall of a Fooish Bar" , -available via the Info system. .SH AUTHOR -nwsmtp was written by . -.PP -This manual page was written by Alexei Moisseev , -for the Debian project (and may be used by others). +Howdy was written by boltgolt. For more information visit https://github.com/Boltgolt/howdy diff --git a/debian/howdy.manpages b/debian/howdy.manpages new file mode 100644 index 0000000..2578acd --- /dev/null +++ b/debian/howdy.manpages @@ -0,0 +1 @@ +debian/howdy.1 diff --git a/debian/postinst b/debian/postinst index c1b45ec..618d92e 100755 --- a/debian/postinst +++ b/debian/postinst @@ -2,6 +2,13 @@ # Installation script to install howdy # Executed after primary apt install +def col(id): + """Add color escape sequences""" + if id == 1: return "\033[32m" + if id == 2: return "\033[33m" + if id == 3: return "\033[31m" + return "\033[0m" + # Import required modules import subprocess import time @@ -12,29 +19,34 @@ import signal import fileinput import urllib.parse +# Don't run unless we need to configure the install +# Will also happen on upgrade but we will catch that later on if "configure" not in sys.argv: sys.exit(0) + def log(text): """Print a nicely formatted line to stdout""" - print("\n>>> \033[32m" + text + "\033[0m\n") + print("\n>>> " + col(1) + text + col(0)"\n") def handleStatus(status): """Abort if a command fails""" if (status != 0): - print("\033[31mError while running last command\033[0m") + print(col(3) + "Error while running last command" + col(0)) sys.exit(1) -# We're not in fresh configuration mode, so exit +# We're not in fresh configuration mode (probably an upgrade), so exit if not os.path.exists("/tmp/howdy_picked_device"): sys.exit(0) +# Open the temporary file containing the device ID in_file = open("/tmp/howdy_picked_device", "r") -# Should be a string +# Load it in, it should be a string picked = in_file.read() in_file.close() +# Remove the temporary file subprocess.call(["rm /tmp/howdy_picked_device"], shell=True) log("Upgrading pip to the latest version") @@ -44,7 +56,7 @@ handleStatus(subprocess.call(["pip3 install --upgrade pip"], shell=True)) log("Cloning dlib") -# Clone the git to /tmp +# Clone the dlib git to /tmp, but only the last commit handleStatus(subprocess.call(["git", "clone", "--depth", "1", "https://github.com/davisking/dlib.git", "/tmp/dlib_clone"])) log("Building dlib") @@ -86,10 +98,7 @@ print("Permissions set") # Make the CLI executable as howdy handleStatus(subprocess.call(["ln -s /lib/security/howdy/cli.py /usr/local/bin/howdy"], shell=True)) handleStatus(subprocess.call(["chmod +x /usr/local/bin/howdy"], shell=True)) -print("Installing howdy command") - -# Install the command autocomplete, don't error on failure -# subprocess.call(["sudo cp /lib/security/howdy/autocomplete.sh /etc/bash_completion.d/howdy"], shell=True) +print("Howdy command installed") log("Adding howdy as PAM module") @@ -192,4 +201,4 @@ if "HOWDY_NO_PROMPT" not in os.environ: # Let the user know what to do with the link print("Installation complete.") -print("\033[33mIf you want to help the development, please use the link above to post some camera-related information to github!\033[0m") +print(col(2) + "If you want to help the development, please use the link above to post some camera-related information to github!" + col(0)) diff --git a/debian/preinst b/debian/preinst index d62616b..02960a8 100755 --- a/debian/preinst +++ b/debian/preinst @@ -3,6 +3,7 @@ # Executed before primary apt install of files def col(id): + """Add color escape sequences""" if id == 1: return "\033[32m" if id == 2: return "\033[33m" if id == 3: return "\033[31m" @@ -15,10 +16,11 @@ import os import re import signal +# Don't run if we're not trying to install fresh if "install" not in sys.argv: sys.exit(0) -# The picked video device id +# The default picked video device id picked = -1 print(col(1) + "Starting IR camera check...\n" + col(0)) @@ -27,6 +29,7 @@ print(col(1) + "Starting IR camera check...\n" + col(0)) if "HOWDY_NO_PROMPT" in os.environ: print(col(2) + "AUTOMATED INSTALL, YOU WILL NOT BE ASKED FOR INPUT AND CHECKS WILL BE SKIPPED" + col(0)) + # Write the default device to disk and exit with open("/tmp/howdy_picked_device", "w") as out_file: out_file.write("0") @@ -83,6 +86,7 @@ if picked == -1: print(col(3) + "No suitable IR camera found, aborting install." + col(0)) sys.exit(23) +# Write the result to disk so postinst can have a look at it with open("/tmp/howdy_picked_device", "w") as out_file: out_file.write(str(picked)) diff --git a/debian/prerm b/debian/prerm index cd693d2..8c32076 100755 --- a/debian/prerm +++ b/debian/prerm @@ -3,6 +3,7 @@ # Completely remove howdy from the system def col(id): + """Add color escape sequences""" if id == 1: return "\033[32m" if id == 2: return "\033[33m" if id == 3: return "\033[31m" @@ -11,6 +12,14 @@ def col(id): # Import required modules import subprocess +# Only run when we actually want to remove +if "remove" not in sys.argv and "purge" not in sys.argv: + sys.exit(0) + +# Don't try running this if it's already gome +if not os.path.exists("/lib/security/howdy/cli"): + sys.exit(0) + # Remove files and symlinks try: subprocess.call(["rm /usr/local/bin/howdy"], shell=True)