Edit

IABSD.fr/ports/infrastructure/fetch/link-checksums

Branch :

  • Show log

    Commit

  • Author : espie
    Date : 2000-05-17 12:33:36
    Hash : e27d8c51
    Message : Script to run after mirroring to populate the {sha1,md5,rmd160}/ subdirectories and guard against shifting checksums.

  • infrastructure/fetch/link-checksums
  • #!/bin/sh
    # Written by Marc Espie, 2000
    # Public domain
    
    # Sets up hard links under a distfiles mirror, so that 
    # files will be preserved against checksum changes as a last
    # ditch attempt.
    
    # Also see REFETCH in bsd.port.mk, and mirroring-ports (7)
    
    DISTDIR=${DISTDIR:-/usr/ports/distfiles}
    cd ${DISTDIR}
    CIPHERS=${CIPHERS:-sha1 md5 rmd160}
    
    # Build the find so that existing cipher dirs are avoided
    exclude=''
    conn=''
    for ci in ${CIPHERS}
    do
    	mkdir -p $ci
    	exclude="${exclude}${conn}-type d -name $ci -prune"
    	conn=" -o "
    done
    echo "find . \( $exclude \) -o -type f -print"
    find . \( $exclude \) -o -type f -print | while read i
    do
    	for ci in ${CIPHERS}
    	do
    		result=`$ci <$i`
    		file=`basename $i`
    		mkdir -p $ci/$result
    		ln -f $i $ci/$result/$file
    	done
    done