-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
download-lifat
executable file
·29 lines (23 loc) · 915 Bytes
/
download-lifat
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
#!/bin/bash -e
# that's how I like to update the commit:
# sed -i -r "s/^commit=.+$/commit=$(cat ~/lifat/.git/refs/heads/master)/" ~/lila/bin/download-lifat && git add bin/download-lifat && git commit -m "bump lifat"
commit=dcf0daa20e4e1f58c6aec6c09f643c7ba3b21d11
origin=https://github.com/lichess-org/lifat
lifat_dir="${LIFAT_DIR:-lifat}"
mkdir -p "$lifat_dir"
lifat_commit_dir=$(realpath "$lifat_dir")/lifat-$commit
mkdir -p "$lifat_dir"
if [ ! -d "$lifat_commit_dir" ]; then
echo "lifat new git repo at $lifat_commit_dir"
git init "$lifat_commit_dir"
cd "$lifat_commit_dir"
echo "lifat fetching repo data from $origin"
git remote add origin $origin
git fetch --depth 1 origin "$commit"
git checkout --detach "$commit"
git log -n 1 --pretty="oneline" >"commit.txt"
echo "lifat done fetching $(cat commit.txt)"
cd -
fi
ln -sfn "$lifat_commit_dir" "public/lifat"
cat "$lifat_commit_dir/commit.txt"