mkpack (597B)
1 #!/bin/sh -x 2 # vim: set ft=bash: 3 DISTDIR=$(grep '^PROG[[:space:]]\{1,\}=' config.mk | 4 sed -E 's,.*=[[:space:]]+([[:alpha:]]+),\1,')-$(cat version) 5 mkdir "$DISTDIR" 6 if [ -d .got ] && command -v got >/dev/null 2>&1; then 7 files=$(got tree -R | sed -e 's,[@/*$]$,,g') 8 elif [ -d .git ] && command -v git >/dev/null 2>&1; then 9 files=$(git ls-files) 10 else 11 printf "Either got or git are required for 'make pack'\n" >&2 12 exit 1 13 fi 14 for f in $files; do 15 d="$DISTDIR"/"$(dirname "$f")" 16 mkdir -p "$d" 17 [ -f "$f" ] && cp "$f" "$d"/ 18 done 19 tar -cf - "$DISTDIR" | xz -9v - > "$DISTDIR".tar.xz 20 rm -fr "$DISTDIR"