# * Unless the -y option is provided, this script then interactively
# walks you through confirmation of common configuration settings.
#
+# This file can be downloaded and immediately run using, e.g.,
+# wget http://git.savannah.gnu.org/cgit/nmh.git/plain/docs/contrib/build_nmh
+# sh build_nmh
+#
# Typical usage:
# The first time you invoke this script, use the -i option to install
# nmh in the specified location. The script will walk you through the
[ "$verbose" -eq 0 ] && git_opts=--quiet
[ "$branch" == master ] ||
git_opts="${git_opts:+$git_opts }--branch $branch"
- if "$gitdir"/git clone $git_opts "git://$gitrepo/nmh.git"; then
+ if "$gitdir"/git clone --depth 1 $git_opts "git://$gitrepo/nmh.git"; then
cd nmh || die "failed to clone nmh"
- git log --max-count=1 --pretty-format:%H
+ printf "commit %s\n" `git log --max-count=1 --pretty=format:%H`
else
die 'failed to clone git repo'
fi
snapshot="$repo/$tarball"
if [ "`finddir wget`" ]; then
[ "$verbose" -eq 0 ] && wget_opts='--quiet'
- wget --output-document - $wget_opts "$snapshot" | tar xzf -
+ wget --output-document - $wget_opts "$snapshot" | gzip -d | tar xf -
elif [ "`finddir curl`" ]; then
- [ "$verbose" -eq 0 ] && curl_opts=--silent
- curl --location $curl_opts "$snapshot" | tar xzf -
+ [ "$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
fi
fi
-tools/showbuildenv | grep -Ev 'PID=|SHLVL'
+[ -x tools/showbuildenv ] && tools/showbuildenv | grep -Ev 'PID=|SHLVL'
####
grep -E 'Error|warn' "$tmpfile"
if [ $status -eq 0 ]; then
- [ $verbose -ge 1 ] && echo build completed successfully
+ [ $verbose -ge 1 ] && echo build completed successfully >&3
else
echo build failed!
[ "$logfile" = - ] || echo "build failed, build log is in $logfile" >&3