#!/usr/bin/env sh # Install EasyDNS binaries. Short tool names (ed, eh, ...) are only linked when they do # not collide with existing commands (e.g. the classic `ed` editor); long names # (easydig, easyhost, ...) are always installed. # usage: deploy/install.sh [PREFIX] [--force-short-names] set -eu PREFIX="${1:-/usr/local}" FORCE="${2:-}" BIN="$PREFIX/bin" SRC="${EASYDNS_BUILD_DIR:-target/release}" mkdir -p "$BIN" install -m 0755 "$SRC/easydns" "$BIN/easydns" for pair in edns:easydns ed:easydig eh:easyhost ens:easynslookup etrace:easytrace ednssec:easydnssec eptr:easyptr \ ezone:easyzone econf:easyconf ebench:easybench ewhois:easywhois edoh:easydoh edot:easydot ediff:easydiff; do short="${pair%%:*}"; long="${pair##*:}" install -m 0755 "$SRC/$long" "$BIN/$long" existing="$(command -v "$short" 2>/dev/null || true)" if [ -n "$existing" ] && [ "$existing" != "$BIN/$short" ] && [ "$FORCE" != "--force-short-names" ]; then echo "skip: '$short' already exists at $existing – use '$long' (or --force-short-names)" continue fi ln -sf "$long" "$BIN/$short" done echo "installed into $BIN" for sh in bash zsh fish; do "$BIN/easydns" completions "$sh" > "easydns.$sh" 2>/dev/null && echo "completion: easydns.$sh" || true done