diff --git a/README.md b/README.md index 3634193..931a046 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,16 @@ Using the central authentication system in Linux (PAM), this works everywhere yo Run the installer by pasting (`ctrl+shift+V`) the following command into the terminal: -`wget -O /tmp/howdy_install.py https://raw.githubusercontent.com/Boltgolt/howdy/master/installer.py && sudo python3 /tmp/howdy_install.py` +``` +wget -O /tmp/howdy_install.py https://raw.githubusercontent.com/Boltgolt/howdy/master/installer.py && sudo python3 /tmp/howdy_install.py +``` This will guide you through the installation. When that's done run `howdy add` to add a face model for the current user. If nothing went wrong we should be able to run sudo by just showing your face. Open a new terminal and run `sudo -i` to see it in action. +**Note:** The build of dlib can hang on 100% for over a minute, give it time. + ### Command line The installer adds a `howdy` command to manage face models for the current user. Use `howdy help` to list the available options. diff --git a/installer.py b/installer.py index 6fb14c2..7759d71 100644 --- a/installer.py +++ b/installer.py @@ -2,6 +2,7 @@ import subprocess import time import sys import os +import re import signal import fileinput import urllib.parse @@ -37,7 +38,16 @@ for dev in devices: if (dev[:5] == "video"): time.sleep(.5) - print("Trying /dev/" + dev) + device_name = "/dev/" + dev + udevadm = subprocess.check_output(["udevadm info -r --query=all -n " + device_name], shell=True).decode("utf-8") + + for line in udevadm.split("\n"): + re_name = re.search('product.*=(.*)$', line, re.IGNORECASE) + + if re_name: + device_name = '"' + re_name.group(1) + '"' + + print("Trying " + device_name) sub = subprocess.Popen(["fswebcam -S 9999999999 -d /dev/" + dev + " /dev/null 2>/dev/null"], shell=True, preexec_fn=os.setsid) @@ -89,8 +99,8 @@ handleStatus(subprocess.call(["chmod 600 -R /lib/security/howdy/"], shell=True)) handleStatus(subprocess.call(["ln -s /lib/security/howdy/cli.py /usr/bin/howdy"], shell=True)) handleStatus(subprocess.call(["chmod +x /usr/bin/howdy"], shell=True)) -# Install the command autocomplete -handleStatus(subprocess.call(["sudo cp /lib/security/howdy/autocomplete.sh /etc/bash_completion.d/howdy"], shell=True)) +# 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) log("Adding howdy as PAM module") @@ -144,9 +154,7 @@ common_auth = open("/etc/pam.d/common-auth", "w") common_auth.write("".join(outlines)) common_auth.close() -diag_out = "" - -diag_out += "Video devices (IR:" + picked + ")\n" +diag_out = "Video devices [IR=" + picked + "]\n" diag_out += "```\n" diag_out += subprocess.check_output(['ls /dev/ | grep video'], shell=True).decode("utf-8") diag_out += "```\n" @@ -154,9 +162,14 @@ diag_out += "```\n" diag_out += "Lsusb output\n" diag_out += "```\n" diag_out += subprocess.check_output(['lsusb -vvvv | grep -i "Camera\|iFunction"'], shell=True).decode("utf-8") +diag_out += "```\n" + +diag_out += "Udevadm\n" +diag_out += "```\n" +diag_out += subprocess.check_output(['udevadm info -r --query=all -n /dev/video' + picked + ' | grep -i "ID_BUS\|ID_MODEL_ID\|ID_VENDOR_ID\|ID_V4L_PRODUCT\|ID_MODEL"'], shell=True).decode("utf-8") diag_out += "```" -print("https://github.com/Boltgolt/howdy/issues/new?title=%5Bdiag%5D%20Post-installation%20camera%20information&body=" + urllib.parse.quote_plus(diag_out) + "\n") +print("https://github.com/Boltgolt/howdy-reports/issues/new?title=Post-installation%20camera%20information&body=" + urllib.parse.quote_plus(diag_out) + "\n") print("Installation complete.") print("If you want to help the development, please use the link above to post some camera-related information to github") diff --git a/uninstall.py b/uninstall.py new file mode 100644 index 0000000..e3dd28f --- /dev/null +++ b/uninstall.py @@ -0,0 +1,4 @@ +import subprocess + +subprocess.call(["rm -rf /lib/security/howdy/"], shell=True) +subprocess.call(["rm /usr/bin/howdy"], shell=True)