-
Notifications
You must be signed in to change notification settings - Fork 251
/
update-fasttext.sh
30 lines (27 loc) · 1.2 KB
/
update-fasttext.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
NEW_VERSION=9bfa32d
CURRENT_VERSION=$(cat fasttext/cpp/LAST_COMMIT)
if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then
echo "fastText: The source code is uptodate!"
else
echo "fastText: Updating ... "
mv fasttext/cpp facebookresearch-fastText-${CURRENT_VERSION}
if [ -d "facebookresearch-fastText-${NEW_VERSION}" ]; then
cp -r facebookresearch-fasttext-${NEW_VERSION} fasttext/cpp
echo $NEW_VERSION >> fasttext/cpp/LAST_COMMIT
else
if [ ! -d "${NEW_VERSION}.tar.gz" ]; then
echo "fastText: Downloading the new version ... "
wget https://api.github.com/repos/facebookresearch/fasttext/tarball/${NEW_VERSION}\
-O ${NEW_VERSION}.tar.gz
tar xzfv ${NEW_VERSION}.tar.gz
cp -r facebookresearch-fasttext-${NEW_VERSION} fasttext/cpp
echo $NEW_VERSION >> fasttext/cpp/LAST_COMMIT
else
echo "fastText: ${NEW_VERSION}.tar.gz exists"
tar xzfv ${NEW_VERSION}.tar.gz
cp -r facebookresearch-fasttext-${NEW_VERSION} fasttext/cpp
echo $NEW_VERSION >> fasttext/cpp/LAST_COMMIT
fi
echo "fastText: ${CURRENT_VERSION} updated to ${NEW_VERSION}"
fi
fi