diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..4ecc39d9486c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Mark Wagie <mark dot wagie at tutanota dot com> +pkgname=kmdr +pkgver=0.4.3 +pkgrel=1 +pkgdesc="The CLI tool for explaining commands from your terminal" +arch=('any') +url="https://kmdr.sh" +license=('MIT') +depends=('nodejs') +makedepends=('npm' 'jq') +source=("$pkgname-$pkgver.tar.gz::https://github.com/ediardo/kmdr-cli/archive/v$pkgver.tar.gz") +sha256sums=('93bc650332fd3bc47ed8b9fde7a1baa898b5ed8562c77ee887ad0d343235dca3') + +package() { + cd "kmdr-cli-$pkgver" + npm install kmdr@latest \ + --cache "$srcdir/npm-cache" \ + -g \ + --user root \ + --prefix "$pkgdir"/usr + + # Non-deterministic race in npm gives 777 permissions to random directories. + # See https://github.com/npm/npm/issues/9359 for details. + find "$pkgdir"/usr -type d -exec chmod 755 {} + + + # Remove references to $pkgdir + find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d" + + # Remove references to $srcdir + local tmppackage="$(mktemp)" + local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json" + jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + + install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname" +} |