From ccb53f0f91e06a297afdf25e77987f24aef715d5 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 7 Jan 2025 13:18:37 +0100 Subject: [PATCH] Added zauth (2FA andOTP compatible cli tool) --- ap/zauth/SlackBuild | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 ap/zauth/SlackBuild diff --git a/ap/zauth/SlackBuild b/ap/zauth/SlackBuild new file mode 100755 index 00000000..52e199c3 --- /dev/null +++ b/ap/zauth/SlackBuild @@ -0,0 +1,69 @@ +#!/bin/bash + +# variables +CWD=$(pwd) + +PRGNAM=$(basename "$CWD") +GITHUB_REPO=RijulGulati/zauth +VERSION=${VERSION:-latest} +ARCH=${ARCH:-noarch} +BUILD=1 + +TAG=gwh +TMP=/tmp/$TAG +PKG=$TMP/pkg-$PRGNAM +OUTPUT=/tmp + +REPOSITORY=/var/cache/SlackBuilds.gwh/$PRGNAM + +PREFIX=/usr + +# nettoyage préalable +rm -fr "$PKG" "${TMP:?}/$PRGNAM" + +mkdir -p "$PKG" + +# mise en place +cd $TMP || exit 1 +[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO}.git "$REPOSITORY" +cd $REPOSITORY +git pull --all + +cp -R "$REPOSITORY" "$TMP/$PRGNAM" +cd "$TMP/$PRGNAM" || exit 1 +[ "$VERSION" == "latest" ] && VERSION=$(git tag --sort=-version:refname | head -n1) +[ "$VERSION" == "" ] && VERSION=trunk +[ "$VERSION" == "trunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout "$VERSION" + +go build . + +# installation +mkdir -p "$PKG$PREFIX"/bin/ +cp zauth "$PKG$PREFIX"/bin/ + +mkdir -p "$PKG$PREFIX/doc/$PRGNAM" +cp -a assets/ LICENSE README.md "$PKG$PREFIX/doc/$PRGNAM" + +# correction +cd "$PKG" || exit 1 +chown -R root:root ./* + +[ -d "$PKG"/usr/man ] && find "$PKG"/usr/man -type f -name "*.?" -exec gzip -9f {} \; + +# embaumement +mkdir -p "$PKG/install" +cat < "$PKG"/install/slack-desc +$PRGNAM: $PRGNAM (2FA application for CLI) +$PRGNAM: +$PRGNAM: 2FA (Two-Factor Authentication) application for CLI terminal with support +$PRGNAM: to import/export andOTP files. +$PRGNAM: +$PRGNAM: +$PRGNAM: +$PRGNAM: +$PRGNAM: +$PRGNAM: https://github.com/${GITHUB_REPO} +EOF + +# empaquetage +/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-${VERSION//-/}-$ARCH-$BUILD$TAG.txz"