diff --git a/archlinux/facerec-git/.gitignore b/archlinux/facerec-git/.gitignore new file mode 100644 index 0000000..6748987 --- /dev/null +++ b/archlinux/facerec-git/.gitignore @@ -0,0 +1,7 @@ +pkg +src +*.tar.gz +*.zip +*.tar.xz +*.patch +*.dat.bz2 \ No newline at end of file diff --git a/archlinux/facerec-git/PKGBUILD b/archlinux/facerec-git/PKGBUILD new file mode 100644 index 0000000..286cac4 --- /dev/null +++ b/archlinux/facerec-git/PKGBUILD @@ -0,0 +1,88 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# The following guidelines are specific to BZR, GIT, HG and SVN packages. +# Other VCS sources are not natively supported by makepkg yet. + +# Maintainer: Sarbesh Kumar Sarkar +pkgname=facerec +pkgver=r226.d4aed9e +pkgrel=1 +pkgdesc="A face authentication system for Linux." +arch=('x86_64') +url="https://github.com/rushabh-v/linux_face_unlock" +license=('GNU') +groups=() +depends=( + 'opencv' + 'pam-python' + 'python3' + 'python-pillow' + 'python-dlib' + 'python-face_recognition' + 'python-face_recognition_models' + 'python-click' + 'python-numpy' + 'python-execnet' + 'python-terminaltables' +) +makedepends=('git') +provides=("${pkgname%-VCS}") +conflicts=("${pkgname%}") +replaces=() +backup=() +options=() +install= +source=('git+https://github.com/sarbesh/linux_face_unlock.git#branch=dev') +noextract=() +md5sums=('SKIP') + +# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for +# a description of each element in the source array. + +pkgver() { +# cd "$srcdir/${pkgname%-VCS}" + +# The examples below are not absolute and need to be adapted to each repo. The +# primary goal is to generate version numbers that will increase according to +# pacman's version comparisons with later commits to the repo. The format +# VERSION='VER_NUM.rREV_NUM.HASH', or a relevant subset in case VER_NUM or HASH +# are not available, is recommended. + +# Git, no tags available + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + +} + +package() { + cd "$srcdir/linux_face_unlock" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + #preinstall + mkdir -p "$pkgdir/usr/lib/Auth/Facerec/roots" + + #install + cp config.py "$pkgdir/usr/lib/Auth/Facerec" + cp -r src/utils/* "$pkgdir/usr/lib/Auth/Facerec" + cp src/cli/cli_info.py "$pkgdir/usr/lib/Auth/Facerec" + cp -r src/cli/arch/* "$pkgdir/usr/lib/Auth/Facerec" + + #postinstall + # dependencies +# sudo -H pip3 --no-cache-dir install face_recognition terminaltables + + mkdir -p "$pkgdir/usr/bin" + ln -s /lib/Auth/Facerec/cli.sh "$pkgdir/usr/bin/facerec" + + mkdir -p "$pkgdir/usr/share/bash-completion/completions" + cp src/cli/facerec "$pkgdir/usr/share/bash-completion/completions/facerec" + + # setup + cd "$pkgdir/usr/lib/Auth/Facerec/" + sudo python3 ./build.py + chmod +x cli.sh + cd ~ + +} diff --git a/archlinux/facerec/.SRCINFO b/archlinux/facerec/.SRCINFO new file mode 100644 index 0000000..3329d97 --- /dev/null +++ b/archlinux/facerec/.SRCINFO @@ -0,0 +1,27 @@ +pkgbase = facerec + pkgdesc = A face authentication system for Linux + pkgver = 1.1 + pkgrel = 1 + url = https://github.com/rushabh-v/linux_face_unlock + arch = x86_64 + license = GNU + makedepends = python2-sphinx + makedepends = cmake + makedepends = pkgfile + depends = opencv + depends = pam-python + depends = python3 + depends = python-pillow + depends = python-dlib + depends = python-face_recognition + depends = python-face_recognition_models + depends = python-click + depends = python-numpy + depends = python-execnet + depends = python-terminaltables + backup = usr/lib/security/howdy/config.ini + source = https://github.com/rushabh-v/linux_face_unlock/archive/v1.1.zip + sha256sums = 7eb1085e03aa6e66ac91269ac46fb9fede9e5da6dea89a3978efdd2e7b9bd73b + +pkgname = facerec + diff --git a/archlinux/facerec/.gitignore b/archlinux/facerec/.gitignore new file mode 100644 index 0000000..6748987 --- /dev/null +++ b/archlinux/facerec/.gitignore @@ -0,0 +1,7 @@ +pkg +src +*.tar.gz +*.zip +*.tar.xz +*.patch +*.dat.bz2 \ No newline at end of file diff --git a/archlinux/facerec/PKGBUILD b/archlinux/facerec/PKGBUILD new file mode 100644 index 0000000..d41be74 --- /dev/null +++ b/archlinux/facerec/PKGBUILD @@ -0,0 +1,73 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Sarbesh Kumar Sarkar +pkgname=facerec +pkgver=1.1 +pkgrel=1 +pkgdesc="A face authentication system for Linux." +arch=('x86_64') +url="https://github.com/rushabh-v/linux_face_unlock" +license=('GNU') +groups=() +depends=( + 'opencv' + 'pam-python' + 'python3' + 'python-pillow' + 'python-dlib' + 'python-face_recognition' + 'python-face_recognition_models' + 'python-click' + 'python-numpy' + 'python-execnet' + 'python-terminaltables' +) +makedepends=( + 'python2-sphinx' + 'cmake' + 'pkgfile' +) +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=("https://github.com/rushabh-v/linux_face_unlock/archive/v$pkgver.zip") +sha256sums=('7eb1085e03aa6e66ac91269ac46fb9fede9e5da6dea89a3978efdd2e7b9bd73b') + +package() { + cd "$srcdir/linux_face_unlock-$pkgver" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + #preinstall + mkdir -p "$pkgdir/usr/lib/Auth/Facerec/roots" + + #install + cp config.py "$pkgdir/usr/lib/Auth/Facerec" + cp -r src/utils/* "$pkgdir/usr/lib/Auth/Facerec" + cp src/cli/cli_info.py "$pkgdir/usr/lib/Auth/Facerec" + cp -r src/cli/arch/* "$pkgdir/usr/lib/Auth/Facerec" + + #postinstall + # dependencies +# sudo -H pip3 --no-cache-dir install face_recognition terminaltables + + mkdir -p "$pkgdir/usr/bin" + ln -s /lib/Auth/Facerec/cli.sh "$pkgdir/usr/bin/facerec" + + mkdir -p "$pkgdir/usr/share/bash-completion/completions" + cp src/cli/facerec "$pkgdir/usr/share/bash-completion/completions/facerec" + + # setup + cd "$pkgdir/usr/lib/Auth/Facerec/" + sudo python3 ./build.py + chmod +x cli.sh + cd ~ +} diff --git a/src/cli/arch/build.py b/src/cli/arch/build.py new file mode 100644 index 0000000..6c92ecb --- /dev/null +++ b/src/cli/arch/build.py @@ -0,0 +1,11 @@ +import sys +import numpy as np + +from os import system + +if __name__ == '__main__': + + sp = np.array(sys.path) + np.save("/usr/lib/Auth/Facerec/deps_path.npy", sp) + system("sudo python3 /usr/lib/Auth/Facerec/cli_info.py") + diff --git a/src/cli/arch/cli.py b/src/cli/arch/cli.py new file mode 100644 index 0000000..e69de29 diff --git a/src/cli/arch/cli.sh b/src/cli/arch/cli.sh new file mode 100644 index 0000000..2d7efcd --- /dev/null +++ b/src/cli/arch/cli.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +FILE=/usr/share/pam-configs/Facerec +SUDO=/etc/pam.d/sudo +TEXT='auth sufficient pam_python.so /lib/Auth/Facerec/pam_ptn.py' + +function facerec(){ +if [ "$1" = "new" ]; then + sudo python3 /usr/lib/Auth/Facerec/add_new.py + + +#elif [ "$1" = "enable" ]; then +# if grep -q $TEXT $SUDO;then +# echo "already enabled" +# else +# sudo echo $TEXT >> $SUDO +# echo "done" +# fi +# echo "Enabling facerec... Done" +# +# +#elif [ "$1" = "disable" ]; then +# if grep -q $TEXT $SUDO;then +# sed -i $TEXT $SUDO +# else +# echo "Note" +# fi +# echo "Disabling facerec... Done" + + +elif [ "$1" = "remove" ]; then + if test -f "$FILE"; then + sudo rm /usr/share/pam-configs/Facerec + fi + echo "Removing CLI... Done" + sudo python3 /usr/lib/Auth/Facerec/remove_cli.py + sudo chattr -R -i /usr/lib/Auth/ + sudo rm -r /usr/lib/Auth + + sudo rm /usr/share/bash-completion/completions/facerec + echo "Removing facerec file system... Done" + + echo "Resetting pam-auth... Done" + sudo pam-auth-update --package + echo "facerec has been removed completely!" + + +elif [ "$1" = "--help" ]; then + python3 /usr/lib/Auth/Facerec/cli_info.py + + +elif [ "$1" = "--version" ]; then + python3 /usr/lib/Auth/Facerec/_version.py + +fi +} +