Skip to content

Instantly share code, notes, and snippets.

@brendenhoffman
Last active September 7, 2025 05:02
Show Gist options
  • Save brendenhoffman/d8b17e55d164bb0ec3d00f95048aa76a to your computer and use it in GitHub Desktop.
Save brendenhoffman/d8b17e55d164bb0ec3d00f95048aa76a to your computer and use it in GitHub Desktop.
Repack Arch's bind into a tiny package with just dig/host/nslookup + needed ISC libs. No server, no daemons. Re-run whenever you want to refresh.
#!/usr/bin/env bash
set -euo pipefail
pkgname=bind-tools-min-bin
verrel=$(pacman -Si bind | awk -F': *' '/^Version/{print $2}')
pkgver=${verrel%-*}; pkgrel=${verrel##*-}
work="$(mktemp -d)"; trap 'rm -rf "$work"' EXIT
cd "$work"
cache_dir="$(pacman-conf CacheDir | head -n1)"
sudo pacman -Sw --noconfirm bind >/dev/null
pkgfile="$(ls -t "$cache_dir"/bind-*.pkg.tar.* 2>/dev/null | head -n1)" || true
[ -n "$pkgfile" ] && [ -f "$pkgfile" ] || { echo "No cached bind pkg found in $cache_dir"; exit 1; }
cp -- "$pkgfile" bind.pkg.tar.zst
cat > PKGBUILD <<PKG
pkgname=$pkgname
pkgver=$pkgver
pkgrel=$pkgrel
pkgdesc='dig/host/nslookup from BIND (repacked; no server)'
arch=(x86_64)
url='https://www.isc.org/bind/'
license=(MPL2)
depends=(glibc libuv openssl liburcu libmaxminddb)
provides=(dnsutils)
conflicts=(bind)
source=('bind.pkg.tar.zst')
sha256sums=('SKIP')
package() {
bsdtar -xf "\$srcdir/bind.pkg.tar.zst" \
usr/bin/dig usr/bin/host usr/bin/nslookup \
usr/lib/libisc*.so* usr/lib/libdns*.so* usr/lib/libisccfg*.so* \
usr/lib/libirs*.so* usr/lib/libbind9*.so* || true
install -d "\$pkgdir/usr/bin" "\$pkgdir/usr/lib" "\$pkgdir/usr/share/licenses/\$pkgname"
mv usr/bin/{dig,host,nslookup} "\$pkgdir/usr/bin/"
mv usr/lib/lib*.so* "\$pkgdir/usr/lib/" || true
printf '%s\n' 'MPL-2.0: https://www.mozilla.org/MPL/2.0/' > "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
}
PKG
makepkg -fcsi
@brendenhoffman
Copy link
Author

brendenhoffman commented Sep 7, 2025

Run to install:
bash <(curl -fsSL https://gist.githubusercontent.com/brendenhoffman/d8b17e55d164bb0ec3d00f95048aa76a/raw/a970d8a37f56ab589ee2aa22360fa4fdf4f7c624/mk-bind-tools-min-bin.sh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment