3a1268d790
- use cksum -c, be careful about directories in fetch-all. - also create links for the base64 version of the links.
38 lines
862 B
Bash
38 lines
862 B
Bash
#!/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 sha256}
|
|
|
|
# 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
|
|
file=`basename $i`
|
|
for ci in ${CIPHERS}
|
|
do
|
|
result=`cksum -a $ci <$i`
|
|
mkdir -p $ci/$result
|
|
ln -f $i $ci/$result/$file
|
|
result=`cksum -a $ci -b <$i`
|
|
mkdir -p $ci/$result
|
|
ln -f $i $ci/$result/$file
|
|
done
|
|
done
|