Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ArchLinux package support #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions archlinux/facerec-git/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pkg
src
*.tar.gz
*.zip
*.tar.xz
*.patch
*.dat.bz2
88 changes: 88 additions & 0 deletions archlinux/facerec-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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 <sarbeshsarkarsks@gmail.com>
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 ~

}
27 changes: 27 additions & 0 deletions archlinux/facerec/.SRCINFO
Original file line number Diff line number Diff line change
@@ -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

7 changes: 7 additions & 0 deletions archlinux/facerec/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pkg
src
*.tar.gz
*.zip
*.tar.xz
*.patch
*.dat.bz2
73 changes: 73 additions & 0 deletions archlinux/facerec/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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 <sarbeshsarkarsks@gmail.com>
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 ~
}
11 changes: 11 additions & 0 deletions src/cli/arch/build.py
Original file line number Diff line number Diff line change
@@ -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")
Comment on lines +1 to +10
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the build.py that is already there?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need common-auth for ArchLinux instead, it should be done manually by adding or removing auth sufficient pam_python.so /lib/Auth/Facerec/pam_ptn.py from /etc/pam.d/sudo to enable and disable respectively.


Empty file added src/cli/arch/cli.py
Empty file.
57 changes: 57 additions & 0 deletions src/cli/arch/cli.sh
Original file line number Diff line number Diff line change
@@ -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
}