+ #### Download sources from repo.
+ gitdir=`finddir git`
+ if [ "$gitdir" ]; then
+ #### Use git repo.
+ [ "$verbose" -eq 0 ] && git_opts=--quiet
+ [ "$branch" == master ] ||
+ git_opts="${git_opts:+$git_opts }--branch $branch"
+ if "$gitdir"/git clone --depth 1 $git_opts "git://$gitrepo/nmh.git"; then
+ cd nmh || die "failed to clone nmh"
+ printf "commit %s\n" `git log --max-count=1 --pretty=format:%H`
+ else
+ die 'failed to clone git repo'
+ fi
+ else
+ [ -e nmh-"$branch" ] && die "nmh-$branch exists, will not overrwrite"
+
+ #### Use snapshot.
+ tarball="nmh-$branch.tar.gz"
+ repo="http://$gitrepo/cgit/nmh.git/snapshot"
+ snapshot="$repo/$tarball"
+ if [ "`finddir wget`" ]; then
+ [ "$verbose" -eq 0 ] && wget_opts='--quiet'
+ wget --output-document - $wget_opts "$snapshot" | gzip -d | tar xf -
+ elif [ "`finddir curl`" ]; then
+ [ "$verbose" -eq 0 ] && curl_opts='--silent --show-error'
+ curl --location $curl_opts "$snapshot" | gzip -d | tar xf -
+ else
+ die 'unable to find program to download nmh sources'
+ fi
+
+ if [ -d nmh-"$branch" ]; then
+ cd nmh-"$branch" || die "failed to download and extract nmh-$branch"
+ else
+ die "failed to download nmh-$branch sources"
+ fi
+ fi