summaryrefslogtreecommitdiffstats
path: root/bin/misc-functions.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-24 18:32:26 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-24 18:32:26 +0000
commit3a57e1eee3ceafa2e969cb6406b4844d0014943c (patch)
tree5d54c5ad6288834b38782e8a53208f69a0a36bba /bin/misc-functions.sh
parentda6c2632570de352e4d262c20198f6d306cbbf30 (diff)
downloadportage-3a57e1eee3ceafa2e969cb6406b4844d0014943c.tar.gz
portage-3a57e1eee3ceafa2e969cb6406b4844d0014943c.tar.bz2
portage-3a57e1eee3ceafa2e969cb6406b4844d0014943c.zip
Use `md5` if `md5sum` is not available (useful for FreeBSD users).
(trunk r8643) svn path=/main/branches/2.1.2/; revision=8644
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 b0e1a42ed..31ad9d8e8 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -521,8 +521,16 @@ dyn_package() {
fi
mv -f "${pkg_tmp}" "${pkg_dest}" || die "Failed to move tbz2 to ${pkg_dest}"
ln -sf "../All/${PF}.tbz2" "${PKGDIR}/${CATEGORY}/${PF}.tbz2" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}"
- local md5sum_output=$(md5sum "${pkg_dest}")
- echo ${md5sum_output%% *} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
+ local md5_hash=""
+ if type md5sum &>/dev/null ; then
+ md5_hash=$(md5sum "${pkg_dest}")
+ md5_hash=${md5_hash%% *}
+ elif type md5 &>/dev/null ; then
+ md5_hash=$(md5 "${pkg_dest}")
+ 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}"