summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorzoorat2021-12-04 23:08:23 +0600
committerzoorat2021-12-04 23:08:23 +0600
commit7c3832947a505b59d7d777f26cfb795c243b8f2b (patch)
treeb0cfe61dc9e523da4f76c9c4d98e4f507fbc1c5a /PKGBUILD
downloadaur-7c3832947a505b59d7d777f26cfb795c243b8f2b.tar.gz
adding ezshare v1.9.0 in AUR
Signed-off-by: zoorat <78788887+z00rat@users.noreply.github.com>
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD50
1 files changed, 50 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..a2aaf3c89cd9
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: zoorat <zoorat [at] protonmail [dot] com>
+
+_npmname=ezshare
+pkgname=$_npmname
+pkgver=1.9.0
+pkgrel=1
+
+pkgdesc="Parse a torrent identifier (magnet uri, .torrent file, info hash)"
+arch=(any)
+url="https://github.com/mifi/ezshare"
+license=("MIT")
+
+depends=("nodejs")
+makedepends=("npm" "jq")
+# provides=("$_npmname")
+# conflicts=("$_npmname")
+options=(strip emptydirs zipman)
+
+source=("https://registry.npmjs.org/${_npmname}/-/${_npmname}-${pkgver}.tgz")
+noextract=("${_npmname}-${pkgver}.tgz")
+b2sums=('a46df8031c223da4158bb0b88003675c87644ccddd0e1725b8e8455da99dab607b1d8c4ddc3cc56efc667d66a9822734bc6c50f3ff5e5fc5d34749fe53a5c6ab')
+
+# Document: https://wiki.archlinux.org/title/Node.js_package_guidelines
+package() {
+ # Install using Using npm
+ npm install -s -g \
+ --cache "${srcdir}/npm-cache" \
+ --prefix "${pkgdir}/usr" \
+ "${srcdir}/${_npmname}-${pkgver}.tgz"
+
+ # Fix ownership of ALL FILES
+ find "${pkgdir}/usr" -type d -exec chmod 755 {} +
+ chown -R root:root "${pkgdir}"
+
+ # Remove references to $pkgdir
+ find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
+
+ local tmppackage="$(mktemp)"
+ local pkgjson="$pkgdir/usr/lib/node_modules/$_npmname/package.json"
+ jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" >"$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+
+ find "$pkgdir" -type f -name package.json | while read pkgjson; do
+ local tmppackage="$(mktemp)"
+ jq 'del(.man)' "$pkgjson" >"$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+ done
+}