Bug #219294 - Fix 'date' and 'cut' arguments for BSD userland. Thanks to
authorZac Medico <zmedico@gentoo.org>
Sat, 3 May 2008 04:17:57 +0000 (04:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 3 May 2008 04:17:57 +0000 (04:17 -0000)
RB <aoz.syn@gmail.com> for this patch. (trunk r10126)

svn path=/main/branches/2.1.2/; revision=10128

bin/emerge-webrsync

index 24733840bbfbd70070b3f65cbb3dbc96b03cf76b..b977359096f3a3e93bf0fb3d47df48cfb23161cf 100755 (executable)
@@ -91,7 +91,11 @@ get_date_part() {
 
 get_utc_second_from_string() {
        local s="$1"
-       date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s"
+       if [[ ${USERLAND} == BSD ]] ; then
+               date -juf "%Y%m%d" "$s" +"%s"
+       else
+               date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s"
+       fi
 }
 
 get_portage_timestamp() {
@@ -133,7 +137,7 @@ check_file_digest() {
        if type -P md5sum > /dev/null; then
                md5sum -c $digest && r=0
        elif type -P md5 > /dev/null; then
-               [ "$(md5 -q $file)" == "$(cut -d \ -f 1 \"$digest\")" ] && r=0
+               [ "$(md5 -q "${file}")" == "$(cut -d ' ' -f 1 "${digest}")" ] && r=0
        else
                eecho "cannot check digest: no suitable md5/md5sum binaries found"
        fi