2023-08-01 22:47:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SAMPLE_NAME=crawl-${1:-m}
|
2023-10-16 17:37:26 +02:00
|
|
|
SAMPLE_DIR="node-1/samples/${SAMPLE_NAME}/"
|
2023-08-01 22:47:37 +02:00
|
|
|
|
|
|
|
function download_model {
|
|
|
|
model=$1
|
|
|
|
url=$2
|
|
|
|
|
|
|
|
if [ ! -f $model ]; then
|
|
|
|
echo "** Downloading $url"
|
|
|
|
wget -O $model $url
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pushd $(dirname $0)
|
|
|
|
|
|
|
|
if [ -d ${SAMPLE_DIR} ]; then
|
|
|
|
echo "${SAMPLE_DIR} already exists; remove it if you want to re-download the sample"
|
|
|
|
fi
|
|
|
|
|
2023-10-16 17:37:26 +02:00
|
|
|
mkdir -p node-1/samples/
|
2023-08-01 22:47:37 +02:00
|
|
|
SAMPLE_TARBALL=samples/${SAMPLE_NAME}.tar.gz
|
|
|
|
download_model ${SAMPLE_TARBALL} https://downloads.marginalia.nu/${SAMPLE_TARBALL} || rm ${SAMPLE_TARBALL}
|
|
|
|
|
|
|
|
if [ ! -f ${SAMPLE_TARBALL} ]; then
|
|
|
|
echo "!! Failed"
|
|
|
|
exit 255
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p ${SAMPLE_DIR}
|
|
|
|
tar zxf ${SAMPLE_TARBALL} --strip-components=1 -C ${SAMPLE_DIR}
|
|
|
|
|
|
|
|
cat > "${SAMPLE_DIR}/marginalia-manifest.json" <<EOF
|
|
|
|
{ "description": "Sample data set ${SAMPLE_NAME}", "type": "CRAWL_DATA" }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
popd
|