|
|
@ -5,34 +5,21 @@ package blob
|
|
|
|
var files = map [string] map [string] []byte {
|
|
|
|
var files = map [string] map [string] []byte {
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
type_file=`tempfile`
|
|
|
|
|
|
|
|
cat <<EOF > $type_file
|
|
|
|
|
|
|
|
var types = map [string] map [string] string {
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CDIR=`pwd`
|
|
|
|
CDIR=`pwd`
|
|
|
|
for dir in $@
|
|
|
|
for dir in $@
|
|
|
|
do
|
|
|
|
do
|
|
|
|
cd "$dir"
|
|
|
|
cd "$dir"
|
|
|
|
echo -e "\t\"`basename $dir`\": {"
|
|
|
|
echo -e "\t\"`basename $dir`\": {"
|
|
|
|
echo -e "\t\"`basename $dir`\": {" >> $type_file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find -type f | while read file
|
|
|
|
find -type f | while read file
|
|
|
|
do
|
|
|
|
do
|
|
|
|
mime=`mimetype -b "$file"`
|
|
|
|
|
|
|
|
name=`echo "$file"|sed 's|\.\/||'`
|
|
|
|
name=`echo "$file"|sed 's|\.\/||'`
|
|
|
|
echo -e "\t\t\"$name\": \"$mime\"," >> $type_file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\t\t\"$name\": {"
|
|
|
|
echo -e "\t\t\"$name\": {"
|
|
|
|
gzip -9 -c "$file" | xxd -p |sed 's/\(..\)/0x\1, /g'
|
|
|
|
gzip -9 -c "$file" | xxd -p |sed 's/\(..\)/0x\1, /g'
|
|
|
|
echo -e "\t\t},"
|
|
|
|
echo -e "\t\t},"
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
done
|
|
|
|
echo -e "\t}," >> $type_file
|
|
|
|
|
|
|
|
echo -e "\t},"
|
|
|
|
echo -e "\t},"
|
|
|
|
cd $CDIR
|
|
|
|
cd $CDIR
|
|
|
|
done
|
|
|
|
done
|
|
|
|
echo '}'
|
|
|
|
echo '}'
|
|
|
|
cat $type_file
|
|
|
|
|
|
|
|
echo '}'
|
|
|
|
|
|
|
|
rm $type_file
|
|
|
|
|
|
|
|