summaryrefslogtreecommitdiffstats
path: root/bin/misc-functions.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-24 18:28:15 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-24 18:28:15 +0000
commit7d5694628eb9d28f5fece8fb152e6931cc84722c (patch)
tree4c8896e05e845f799604be09b6b503abf8488ed9 /bin/misc-functions.sh
parentdc35b3d263cff436e1fbded1cc840eb3b44a9073 (diff)
downloadportage-7d5694628eb9d28f5fece8fb152e6931cc84722c.tar.gz
portage-7d5694628eb9d28f5fece8fb152e6931cc84722c.tar.bz2
portage-7d5694628eb9d28f5fece8fb152e6931cc84722c.zip
Use `md5` if `md5sum` is not available (useful for FreeBSD users).
svn path=/main/trunk/; revision=8643
Diffstat (limited to 'bin/misc-functions.sh')
-rwxr-xr-xbin/misc-functions.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index e13e1ea76..2e860453e 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -527,8 +527,16 @@ dyn_package() {
rm -f "${PORTAGE_BINPKG_TMPFILE}"
die "Failed to append metadata to the tbz2 file"
fi
- local md5sum_output=$(md5sum "${PORTAGE_BINPKG_TMPFILE}")
- echo ${md5sum_output%% *} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
+ local md5_hash=""
+ if type md5sum &>/dev/null ; then
+ md5_hash=$(md5sum "${PORTAGE_BINPKG_TMPFILE}")
+ md5_hash=${md5_hash%% *}
+ elif type md5 &>/dev/null ; then
+ md5_hash=$(md5 "${PORTAGE_BINPKG_TMPFILE}")
+ md5_hash=${md5_hash##* }
+ fi
+ [ -n "${md5_hash}" ] && \
+ echo ${md5_hash} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
vecho ">>> Done."
cd "${PORTAGE_BUILDDIR}"
touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}"