Merge pull request #88 from prometheus/feature/scraping/named-target-state

Update embedding script to support BSD find.
This commit is contained in:
Matt T. Proud 2013-03-21 03:55:57 -07:00
commit 33c855e9bd

View file

@ -1,25 +1,28 @@
#!/bin/sh #!/bin/sh
set -e
cat <<EOF cat <<EOF
package blob package blob
var files = map [string] map [string] []byte { var files = map [string] map [string] []byte {
EOF EOF
CDIR=`pwd` ORIGINAL_PWD=${PWD}
for dir in $@ for dir in $@
do do
cd "$dir" cd "${dir}"
echo "\"`basename $dir`\": {" echo "\"$(basename ${dir})\": {"
find -type f | while read file find . -type f | while read file
do do
name=`echo "$file"|sed 's|\.\/||'` name=$(echo "${file}"|sed 's|\.\/||')
echo "\"$name\": {" echo "\"$name\": {"
gzip -9 -c "$file" | xxd -p |sed 's/\(..\)/0x\1, /g' gzip -9 -c "${file}" | xxd -p |sed 's/\(..\)/0x\1, /g'
echo "}," echo "},"
echo echo
done done
echo "}," echo "},"
cd $CDIR cd "${ORIGINAL_PWD}"
done done
echo '}' echo '}'