From c51c8a5a58bf62e655a26ffee951a7a860f778e2 Mon Sep 17 00:00:00 2001 From: s7x <33422344+s7x@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:28:12 +0000 Subject: [PATCH] ghauri: fix package. (#4429) * ghauri: fix package. * Update ghauri.install Removed comments on the post_install() procedure. * Update PKGBUILD Increased the pkgrel version to 2 * Update ghauri.install Added \n on the last line. * Update ghauri.install Fix last line (normally --- lists/to-release | 1 + packages/ghauri/PKGBUILD | 37 ++++++++++++++++++++++++---------- packages/ghauri/ghauri.install | 18 +++++++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 packages/ghauri/ghauri.install diff --git a/lists/to-release b/lists/to-release index e69de29bb2d..308baff922f 100644 --- a/lists/to-release +++ b/lists/to-release @@ -0,0 +1 @@ +ghauri diff --git a/packages/ghauri/PKGBUILD b/packages/ghauri/PKGBUILD index 4c97cb7840a..a517a13d651 100644 --- a/packages/ghauri/PKGBUILD +++ b/packages/ghauri/PKGBUILD @@ -3,33 +3,48 @@ pkgname=ghauri pkgver=1.4.1.r0.g316410a -pkgrel=1 +pkgrel=2 pkgdesc='An advanced cross-platform tool that automates the process of detecting and exploiting SQL injection security flaws.' arch=('any') groups=('blackarch' 'blackarch-webapp' 'blackarch-exploitation') url='https://github.com/r0oth3x49/ghauri' license=('MIT') -depends=('python' 'python-chardet' 'python-tldextract' 'python-colorama' - 'python-requests') -makedepends=('git' 'python-setuptools') +depends=('python') +makedepends=('git' 'python-setuptools' 'python-pip') source=("git+https://github.com/r0oth3x49/$pkgname.git") sha512sums=('SKIP') +install="$pkgname.install" pkgver() { cd $pkgname - git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/#/\./g' + ( set -o pipefail + git describe --long --tags --abbrev=7 2>/dev/null | + sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "%s.%s" "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short=7 HEAD)" + ) } -build() { +package() { cd $pkgname - python setup.py build -} + install -dm 755 "$pkgdir/usr/bin" + install -Dm 644 requirements.txt "$pkgdir/usr/share/$pkgname/requirements.txt" + install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md -package() { - cd $pkgname + install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + rm -rf LICENSE *.md docs/*.md .gitignore .github/ + + cp -a * "$pkgdir/usr/share/$pkgname/" + + cat > "$pkgdir/usr/bin/$pkgname" << EOF +#!/bin/sh +source /usr/share/$pkgname/venv/bin/activate +exec $pkgname "\$@" +EOF - python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build + chmod a+x "$pkgdir/usr/bin/$pkgname" } diff --git a/packages/ghauri/ghauri.install b/packages/ghauri/ghauri.install new file mode 100644 index 00000000000..bc29515ba6a --- /dev/null +++ b/packages/ghauri/ghauri.install @@ -0,0 +1,18 @@ +post_install() { + set -e + cd /usr/share/ghauri + python -m venv venv + source venv/bin/activate && + pip install --isolated --root="/usr/share/ghauri" --prefix='venv' \ + -r requirements.txt + pip install -e . +} + +post_upgrade() { + post_install "$@" +} + +post_remove() { + # /usr/share/ghauri/venv + rm -r /usr/share/ghauri +}