Using curl for download scripts

This commit is contained in:
Michael Hansen
2019-05-03 20:41:29 -04:00
parent 629d762a4b
commit 7212566eef
2 changed files with 29 additions and 49 deletions
+8 -33
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Directory of *this* script
DIR="$( cd "$( dirname "$0" )" && pwd )"
@@ -46,7 +47,7 @@ sudo apt-get install -y python3 python3-pip python3-venv python3-dev \
gfortran libfst-dev \
sphinxbase-utils sphinxtrain pocketsphinx \
jq checkinstall unzip xz-utils \
libfst-dev
libfst-dev curl
# -----------------------------------------------------------------------------
# Python 3.6
@@ -62,7 +63,7 @@ if [[ -z "$(which python3.6)" ]]; then
python_file="${download_dir}/Python-3.6.8.tar.xz"
if [[ ! -f "${python_file}" ]]; then
python_url='https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz'
wget -O "${python_file}" -q "${python_url}"
curl -sSfL-o "${python_file}" "${python_url}"
fi
tar -C "${temp_dir}" -xf "${python_file}"
@@ -94,17 +95,15 @@ source "${VENV_PATH}/bin/activate"
"${PYTHON}" -m pip install wheel
"${PYTHON}" -m pip install -r requirements.txt
# Download dependencies
echo "Downloading dependencies"
bash download-dependencies.sh
# -----------------------------------------------------------------------------
# Pocketsphinx for Python
# -----------------------------------------------------------------------------
pocketsphinx_file="${download_dir}/pocketsphinx-python.tar.gz"
if [[ ! -f "${pocketsphinx_file}" ]]; then
pocketsphinx_url='https://github.com/synesthesiam/pocketsphinx-python/releases/download/v1.0/pocketsphinx-python.tar.gz'
echo "Downloading pocketsphinx (${pocketsphinx_url})"
wget -q -O "${pocketsphinx_file}" "${pocketsphinx_url}"
fi
"${PYTHON}" -m pip install "${pocketsphinx_file}"
# -----------------------------------------------------------------------------
@@ -117,7 +116,7 @@ case $CPU_ARCH in
if [[ ! -f "${snowboy_file}" ]]; then
snowboy_url='https://github.com/Kitt-AI/snowboy/archive/v1.3.0.tar.gz'
echo "Downloading snowboy (${snowboy_url})"
wget -q -O "${snowboy_file}" "${snowboy_url}"
curl -sSfL-o "${snowboy_file}" "${snowboy_url}"
fi
"${PYTHON}" -m pip install "${snowboy_file}"
@@ -135,12 +134,6 @@ if [[ -z "$(which precise-engine)" ]]; then
case $CPU_ARCH in
x86_64|armv7l)
precise_file="${download_dir}/precise-engine_0.2.0_${CPU_ARCH}.tar.gz"
if [[ ! -f "${precise_file}" ]]; then
precise_url="https://github.com/MycroftAI/mycroft-precise/releases/download/v0.2.0/precise-engine_0.2.0_${CPU_ARCH}.tar.gz"
echo "Downloading Mycroft Precise (${precise_url})"
wget -q -O "${precise_file}" "${precise_url}"
fi
precise_install='/usr/lib'
sudo tar -C "${precise_install}" -xf "${precise_file}"
sudo ln -s "${precise_install}/precise-engine/precise-engine" '/usr/bin/precise-engine'
@@ -157,12 +150,6 @@ fi
if [[ -z "$(which ngramcount)" ]]; then
opengrm_file="${download_dir}/opengrm-ngram-1.3.3.tar.gz"
if [[ ! -f "${opengrm_file}" ]]; then
opengrm_url='https://www.opengrm.org/twiki/pub/GRM/NGramDownload/opengrm-ngram-1.3.3.tar.gz'
echo "Download Opengrm (${opengrm_url})"
wget -q -O "${opengrm_file}" "${opengrm_url}"
fi
echo "Building Opengrm ${opengrm_file}"
tar -C "${temp_dir}" -xf "${opengrm_file}" && \
cd "${temp_dir}/opengrm-ngram-1.3.3" && \
@@ -181,12 +168,6 @@ if [[ -z "$(which phonetisaurus-apply)" ]]; then
x86_64|armv7l|arm64v8)
# Install pre-built package
phonetisaurus_file="${download_dir}/phonetisaurus-2019_${FRIENDLY_ARCH}.deb"
if [[ ! -f "${phonetisaurus_file}" ]]; then
phonetisaurus_url="https://github.com/synesthesiam/phonetisaurus-2019/releases/download/v1.0/phonetisaurus-2019_${FRIENDLY_ARCH}.deb"
echo "Downloading phonetisaurus (${phonetisaurus_url})"
wget -q -O "${phonetisaurus_file}" "${phonetisaurus_url}"
fi
echo "Installing phonetisaurus (${phonetisaurus_file})"
sudo dpkg -i "${phonetisaurus_file}"
;;
@@ -194,12 +175,6 @@ if [[ -z "$(which phonetisaurus-apply)" ]]; then
*)
# Build from source
phonetisaurus_file="${download_dir}/phonetisaurus-2019.zip"
if [[ ! -f "${phonetisaurus_file}" ]]; then
phonetisaurus_url="https://github.com/synesthesiam/phonetisaurus-2019/releases/download/v1.0/phonetisaurus-2019_${FRIENDLY_ARCH}.deb"
echo "Downloading phonetisaurus source (${phonetisaurus_url})"
wget -q -O "${phonetisaurus_file}" "${phonetisaurus_url}"
fi
echo "Building phonetisaurus (${phonetisaurus_file})"
unzip -d "${temp_dir}" "${phonetisaurus_file}" && \
cd "${temp_dir}/phonetisaurus" && \
+21 -16
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Directory of *this* script
DIR="$( cd "$( dirname "$0" )" && pwd )"
@@ -24,7 +25,7 @@ pocketsphinx_file="${download_dir}/pocketsphinx-python.tar.gz"
if [[ ! -f "${pocketsphinx_file}" ]]; then
pocketsphinx_url='https://github.com/synesthesiam/pocketsphinx-python/releases/download/v1.0/pocketsphinx-python.tar.gz'
echo "Downloading pocketsphinx (${pocketsphinx_url})"
wget -q -O "${pocketsphinx_file}" "${pocketsphinx_url}"
curl -sSfL -o "${pocketsphinx_file}" "${pocketsphinx_url}"
fi
# -----------------------------------------------------------------------------
@@ -33,9 +34,20 @@ fi
pyjsgf_file="${download_dir}/pyjsgf-1.6.0.tar.gz"
if [[ ! -f "${pyjsgf_file}" ]]; then
pyjsgf_url='https://github.com/synesthesian/pyjsgf/archive/v1.6.0.tar.gz'
pyjsgf_url='https://github.com/synesthesiam/pyjsgf/archive/v1.6.0.tar.gz'
echo "Downloading pyjsgf (${pyjsgf_url})"
wget -q -O "${pyjsgf_file}" "${pyjsgf_url}"
curl -sSfL -o "${pyjsgf_file}" "${pyjsgf_url}"
fi
# -----------------------------------------------------------------------------
# jsgf2fst
# -----------------------------------------------------------------------------
jsgf2fst_file="${download_dir}/jsgf2fst-0.1.0.tar.gz"
if [[ ! -f "${jsgf2fst_file}" ]]; then
jsgf2fst_url='https://github.com/synesthesiam/jsgf2fst/releases/download/v0.1.0/jsgf2fst-0.1.0.tar.gz'
echo "Downloading jsgf2fst (${jsgf2fst_url})"
curl -sSfL -o "${jsgf2fst_file}" "${jsgf2fst_url}"
fi
# -----------------------------------------------------------------------------
@@ -46,7 +58,7 @@ snowboy_file="${download_dir}/snowboy-1.3.0.tar.gz"
if [[ ! -f "${snowboy_file}" ]]; then
snowboy_url='https://github.com/Kitt-AI/snowboy/archive/v1.3.0.tar.gz'
echo "Downloading snowboy (${snowboy_url})"
wget -q -O "${snowboy_file}" "${snowboy_url}"
curl -sSfL -o "${snowboy_file}" "${snowboy_url}"
fi
# -----------------------------------------------------------------------------
@@ -59,7 +71,7 @@ do
if [[ ! -f "${precise_file}" ]]; then
precise_url="https://github.com/MycroftAI/mycroft-precise/releases/download/v0.2.0/precise-engine_0.2.0_${CPU_ARCH}.tar.gz"
echo "Downloading Mycroft Precise (${precise_url})"
wget -q -O "${precise_file}" "${precise_url}"
curl -sSfL -o "${precise_file}" "${precise_url}"
fi
done
@@ -72,7 +84,7 @@ if [[ -z "$(which ngramcount)" ]]; then
if [[ ! -f "${opengrm_file}" ]]; then
opengrm_url='https://www.opengrm.org/twiki/pub/GRM/NGramDownload/opengrm-ngram-1.3.3.tar.gz'
echo "Download Opengrm (${opengrm_url})"
wget -q -O "${opengrm_file}" "${opengrm_url}"
curl -sSfL -o "${opengrm_file}" "${opengrm_url}"
fi
fi
@@ -87,23 +99,16 @@ do
if [[ ! -f "${phonetisaurus_file}" ]]; then
phonetisaurus_url="https://github.com/synesthesiam/phonetisaurus-2019/releases/download/v1.0/phonetisaurus-2019_${FRIENDLY_ARCH}.deb"
echo "Downloading phonetisaurus (${phonetisaurus_url})"
wget -q -O "${phonetisaurus_file}" "${phonetisaurus_url}"
curl -sSfL -o "${phonetisaurus_file}" "${phonetisaurus_url}"
fi
done
# Build from source
openfst_file="${download_dir}/openfst-1.6.2.tar.gz"
if [[ ! -f "${openfst_file}" ]]; then
openfst_url='http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.2.tar.gz'
echo "Downloading OpenFST source (${openfst_url})"
wget -q -O "${openfst_file}" "${openfst_url}"
fi
phonetisaurus_file="${download_dir}/phonetisaurus-2019.zip"
if [[ ! -f "${phonetisaurus_file}" ]]; then
phonetisaurus_url="https://github.com/synesthesiam/phonetisaurus-2019/releases/download/v1.0/phonetisaurus-2019_${FRIENDLY_ARCH}.deb"
echo "Downloading phonetisaurus source (${phonetisaurus_url})"
wget -q -O "${phonetisaurus_file}" "${phonetisaurus_url}"
curl -sSfL -o "${phonetisaurus_file}" "${phonetisaurus_url}"
fi
echo "Done"
@@ -119,6 +124,6 @@ do
if [[ ! -f "${kaldi_file}" ]]; then
kaldi_url="https://github.com/synesthesiam/kaldi-docker/releases/download/v1.0/kaldi_${FRIENDLY_ARCH}.tar.gz"
echo "Downloading kaldi (${kaldi_url})"
wget -q -O "${kaldi_file}" "${kaldi_url}"
curl -sSfL -o "${kaldi_file}" "${kaldi_url}"
fi
done