diff --git a/tools/mk_deb_fpmdir b/tools/mk_deb_fpmdir index 9deb068..636679a 100755 --- a/tools/mk_deb_fpmdir +++ b/tools/mk_deb_fpmdir @@ -25,6 +25,11 @@ shift # If there is no iteration set, default to use the number of commits in the repository: if [[ -z "${PKGRELEASE}" ]]; then PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi fi # If there is no epoch, assume 0 diff --git a/tools/mk_rpm_fpmdir b/tools/mk_rpm_fpmdir index c7d50c2..9683d6f 100755 --- a/tools/mk_rpm_fpmdir +++ b/tools/mk_rpm_fpmdir @@ -25,6 +25,11 @@ shift # If there is no iteration set, default to use the number of commits in the repository: if [[ -z "${PKGRELEASE}" ]]; then PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi fi # If there is no epoch, assume 0