summaryrefslogtreecommitdiffstats
path: root/src/test/encoding/import.sh
blob: eea96e353a98ff539a78332bdb334710ff4d3553 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh -e

src=$1
ver=$2
archive=$3

[ -d "$archive" ] && [ -d "$src" ] || echo "usage: $0 <srcdir> <version> <archive>"

[ -d "$archive/$ver" ] || mkdir "$archive/$ver"

dest_dir="$archive/$ver/objects"

[ -d "$dest_dir" ] || mkdir "$dest_dir"

for f in `find $src -type f`
do
    n=`basename $f`
    type=`echo $n | sed 's/__.*//'`
    md=`md5sum $f | awk '{print $1}'`

    [ -d "$dest_dir/$type" ] || mkdir $dest_dir/$type
    [ -e "$dest_dir/$type/$md" ] || cp $f $dest_dir/$type/$md
done