#!/bin/sh set -e umask 022 prog=setup binfiles='genpkg mkpkgmeta modpkg pbfields putpkgtree getpkgtree injectdigs' metas='perl perl.d/ perl.d/fetchcpan perl.d/perl-dist perl.d/perl-pkgbuild perl.d/scrapecore' md() { d="$1" case "$d" in '') return 1 ;; */) ;; *) d="$d/" # mostly for pretty printing esac [ -d "$d" ] || mkdir -p "$d" echo "$d" } ins() { case "$1" in */) md "$2/$1" ;; *) install -m 755 "$1" "$2/$1" echo "$2/$1" esac } case "$1" in '') cat <&2 Run "$prog genpkg" to install genpkg & friends into ~/genpkg and ~/bin. Run "$prog tweaks" to install tweaks into ~/pkg/tweaks. EOF ;; genpkg) md ~/bin for pkg in $binfiles do ins "bin/$pkg" ~ done md ~/.genpkg md ~/.genpkg/metas for m in $metas do ins "metas/$m" ~/.genpkg done md ~/.genpkg/var ;; tweaks) md ~/pkg/tweaks/ for t in tweaks/* do case $t in *~) continue ;; esac echo ~/pkg/"$t" cp "$t" ~/pkg/"$t" done ;; *) echo "$prog: unrecognized argument: $1" 1>&2 exit 1 esac exit 0