24 lines
519 B
Plaintext
24 lines
519 B
Plaintext
|
#!/bin/bash
|
||
|
find . -regex ".*\.\(tar\.bz2\|tar\.gz\|bz2\|rar\|gz\|tar\|tbz2\|tgz\|zip\|Z\|7z\)" -size +2M | sort | while read file;
|
||
|
do
|
||
|
res=`sha1sum "$file"`
|
||
|
sha=( $res )
|
||
|
if [ -d "$1/$sha" ]
|
||
|
then
|
||
|
filename=`ls "$1/$sha"`
|
||
|
else
|
||
|
filename=${file:2}
|
||
|
mkdir -p $1/$sha
|
||
|
cp -n "$file" "$1/$sha/"
|
||
|
fi
|
||
|
|
||
|
echo " \"${filename}\": $sha" >> abf_temp_temp.yml
|
||
|
rm -rf "$file"
|
||
|
done
|
||
|
if [ -e abf_temp_temp.yml ]
|
||
|
then
|
||
|
echo 'sources:' > abf.yml
|
||
|
cat abf_temp_temp.yml >> abf.yml
|
||
|
rm -rf abf_temp_temp.yml
|
||
|
fi
|