blob: 5b871756537eb7d883c4a3ff758fa4c482dd7f55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env bash
#
# gethash.sh
#
# Get the hash of a js file for use in the librejs database.
# Output a JSON object to be included in script-libraries.json
url=$1
t=$(mktemp)
wget --quiet -O $t $url
if [ $? -ne 0 ]
then
echo $url not found
exit 1
fi
s=$(iconv -f LATIN1 -t UTF8 $t | sha1sum | awk '{print $1}')
cat <<EOF
"$s": {
"filename": "$url",
"result": "[freelib]"
}
EOF
rm -f $t
|