From 0583cab97143e1b823d93641d59cb9b0884871ec Mon Sep 17 00:00:00 2001 From: sarbesh Date: Tue, 17 Nov 2020 18:08:27 +0530 Subject: [PATCH 1/3] ARCH package-dev init --- archlinux/facerec-git/PKGBUILD | 82 ++++++++++++++++++++++++++++++++++ archlinux/facerec/PKGBUILD | 63 ++++++++++++++++++++++++++ src/cli/arch/build.py | 11 +++++ src/cli/arch/cli.py | 0 src/cli/arch/cli.sh | 57 +++++++++++++++++++++++ 5 files changed, 213 insertions(+) create mode 100644 archlinux/facerec-git/PKGBUILD create mode 100644 archlinux/facerec/PKGBUILD create mode 100644 src/cli/arch/build.py create mode 100644 src/cli/arch/cli.py create mode 100644 src/cli/arch/cli.sh diff --git a/archlinux/facerec-git/PKGBUILD b/archlinux/facerec-git/PKGBUILD new file mode 100644 index 0000000..c064be5 --- /dev/null +++ b/archlinux/facerec-git/PKGBUILD @@ -0,0 +1,82 @@ +# 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: Your Name +pkgname=facerec-git +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=('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/${pkgname%-VCS}" + + #preinstall + mkdir -p "$pkgdir/usr/lib/Auth/Facerec/roots" + + #install + cp src/cli/facerec "$pkgdir/usr/share/bash-completion/completions/facerec" + 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 + + # setup + cd '$pkgdir/usr/lib/Auth/Facerec/' + sudo python3 ./build.py + chmod +x cli.sh + cd ~ + +} diff --git a/archlinux/facerec/PKGBUILD b/archlinux/facerec/PKGBUILD new file mode 100644 index 0000000..6fa789c --- /dev/null +++ b/archlinux/facerec/PKGBUILD @@ -0,0 +1,63 @@ +# 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: Your Name +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=() +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=("$pkgname-$pkgver.tar.gz" + "$pkgname-$pkgver.patch") +noextract=() +md5sums=() +validpgpkeys=() + +prepare() { + cd "$pkgname-$pkgver" + patch -p1 -i "$srcdir/$pkgname-$pkgver.patch" +} + +build() { + cd "$pkgname-$pkgver" + ./configure --prefix=/usr + make +} + +check() { + cd "$pkgname-$pkgver" + make -k check +} + +package() { + cd "$pkgname-$pkgver" + make DESTDIR="$pkgdir/" install +} 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..5143a24 --- /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.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 "alred" + 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 +} + From d4aed9ec3fe5ed76a548731c0582040668b52e31 Mon Sep 17 00:00:00 2001 From: sarbesh Date: Sat, 12 Dec 2020 08:53:51 +0530 Subject: [PATCH 2/3] Added arch support --- archlinux/facerec-git/.gitignore | 7 ++++ archlinux/facerec-git/PKGBUILD | 26 +++++++++------ archlinux/facerec/.SRCINFO | 27 +++++++++++++++ archlinux/facerec/.gitignore | 7 ++++ archlinux/facerec/PKGBUILD | 56 +++++++++++++++++++------------- 5 files changed, 90 insertions(+), 33 deletions(-) create mode 100644 archlinux/facerec-git/.gitignore create mode 100644 archlinux/facerec/.SRCINFO create mode 100644 archlinux/facerec/.gitignore 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 index c064be5..1e03c49 100644 --- a/archlinux/facerec-git/PKGBUILD +++ b/archlinux/facerec-git/PKGBUILD @@ -7,8 +7,8 @@ # Other VCS sources are not natively supported by makepkg yet. # Maintainer: Your Name -pkgname=facerec-git -pkgver=1.1 +pkgname=facerec +pkgver=r225.0583cab pkgrel=1 pkgdesc="A face authentication system for Linux." arch=('x86_64') @@ -43,7 +43,7 @@ md5sums=('SKIP') # a description of each element in the source array. pkgver() { - cd "$srcdir/${pkgname%-VCS}" +# 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 @@ -57,24 +57,30 @@ pkgver() { } package() { - cd "$srcdir/${pkgname%-VCS}" + 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 src/cli/facerec "$pkgdir/usr/share/bash-completion/completions/facerec" - 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' + 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/' + 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 index 6fa789c..db1f1ce 100644 --- a/archlinux/facerec/PKGBUILD +++ b/archlinux/facerec/PKGBUILD @@ -25,7 +25,11 @@ depends=( 'python-execnet' 'python-terminaltables' ) -makedepends=() +makedepends=( + 'python2-sphinx' + 'cmake' + 'pkgfile' +) checkdepends=() optdepends=() provides=() @@ -35,29 +39,35 @@ backup=() options=() install= changelog= -source=("$pkgname-$pkgver.tar.gz" - "$pkgname-$pkgver.patch") -noextract=() -md5sums=() -validpgpkeys=() - -prepare() { - cd "$pkgname-$pkgver" - patch -p1 -i "$srcdir/$pkgname-$pkgver.patch" -} +source=("https://github.com/rushabh-v/linux_face_unlock/archive/v$pkgver.zip") +sha256sums=('7eb1085e03aa6e66ac91269ac46fb9fede9e5da6dea89a3978efdd2e7b9bd73b') -build() { - cd "$pkgname-$pkgver" - ./configure --prefix=/usr - make -} +package() { + cd "$srcdir/linux_face_unlock-$pkgver" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" -check() { - cd "$pkgname-$pkgver" - make -k check -} + #preinstall + mkdir -p "$pkgdir/usr/lib/Auth/Facerec/roots" -package() { - cd "$pkgname-$pkgver" - make DESTDIR="$pkgdir/" install + #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 ~ } From 35e75c46be05f32d650830980d44847361750606 Mon Sep 17 00:00:00 2001 From: sarbesh Date: Sat, 19 Dec 2020 10:07:47 +0530 Subject: [PATCH 3/3] removed enable and disable --- archlinux/facerec-git/PKGBUILD | 4 ++-- archlinux/facerec/PKGBUILD | 2 +- src/cli/arch/cli.sh | 36 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/archlinux/facerec-git/PKGBUILD b/archlinux/facerec-git/PKGBUILD index 1e03c49..286cac4 100644 --- a/archlinux/facerec-git/PKGBUILD +++ b/archlinux/facerec-git/PKGBUILD @@ -6,9 +6,9 @@ # The following guidelines are specific to BZR, GIT, HG and SVN packages. # Other VCS sources are not natively supported by makepkg yet. -# Maintainer: Your Name +# Maintainer: Sarbesh Kumar Sarkar pkgname=facerec -pkgver=r225.0583cab +pkgver=r226.d4aed9e pkgrel=1 pkgdesc="A face authentication system for Linux." arch=('x86_64') diff --git a/archlinux/facerec/PKGBUILD b/archlinux/facerec/PKGBUILD index db1f1ce..d41be74 100644 --- a/archlinux/facerec/PKGBUILD +++ b/archlinux/facerec/PKGBUILD @@ -3,7 +3,7 @@ # NOTE: Please fill out the license field for your package! If it is unknown, # then please put 'unknown'. -# Maintainer: Your Name +# Maintainer: Sarbesh Kumar Sarkar pkgname=facerec pkgver=1.1 pkgrel=1 diff --git a/src/cli/arch/cli.sh b/src/cli/arch/cli.sh index 5143a24..2d7efcd 100644 --- a/src/cli/arch/cli.sh +++ b/src/cli/arch/cli.sh @@ -2,30 +2,30 @@ FILE=/usr/share/pam-configs/Facerec SUDO=/etc/pam.d/sudo -TEXT='auth sufficient pam_python.so /lib/Auth/Facerec/pam.py' +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 "alred" - 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" = "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