diff --git a/docs/index.html b/docs/index.html
index f0f714a..070649d 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -33,47 +33,51 @@
export platform="$(uname -s)_$(uname -m)"
export lama=$HOME/.lama
-latestRelease=$(curl -L --silent -s https://api.github.com/repos/csweichel/lama/releases/latest \
- | grep browser_download_url \
- | grep $platform \
- | cut -d : -f 2,3)
+setup_lama() {
+ latestRelease=$(curl -L --silent -s https://api.github.com/repos/csweichel/lama/releases/latest \
+ | grep browser_download_url \
+ | grep $platform \
+ | cut -d : -f 2,3)
-export download=true
-if [ -f $lama ]; then
- installedVersion=$($lama -v)
+ export download=true
+ if [ -f $lama ]; then
+ installedVersion=$($lama -v)
- if echo $latestRelease | grep $installedVersion >/dev/null; then
- download=false
- else
- download=true
+ if echo $latestRelease | grep $installedVersion >/dev/null; then
+ download=false
+ else
+ download=true
+ fi
fi
-fi
-if [ "$download" = "true" ]; then
- echo "Downloading latest lama version from$latestRelease"
- echo $latestRelease | xargs curl -L --output $lama
+ if [ "$download" = "true" ]; then
+ echo "Downloading latest lama version from$latestRelease"
+ echo $latestRelease | xargs curl -L --output $lama
- chmod +x $lama
+ chmod +x $lama
- if [ `which sha256sum` ]; then
- export latestChecksum=$(curl --silent -s https://api.github.com/repos/csweichel/lama/releases/latest \
- | grep browser_download_url \
- | grep checksums.txt \
- | cut -d : -f 2,3 \
- | xargs curl --silent -s -L \
- | grep $platform \
- | cut -d ' ' -f 1)
- currentChecksum=$(sha256sum $lama | cut -d ' ' -f 1)
+ if [ `which sha256sum` ]; then
+ export latestChecksum=$(curl --silent -s https://api.github.com/repos/csweichel/lama/releases/latest \
+ | grep browser_download_url \
+ | grep checksums.txt \
+ | cut -d : -f 2,3 \
+ | xargs curl --silent -s -L \
+ | grep $platform \
+ | cut -d ' ' -f 1)
+ currentChecksum=$(sha256sum $lama | cut -d ' ' -f 1)
- if [ $latestChecksum != $currentChecksum ]; then
- echo "checksum mismatch - will not start downloaded binary"
- rm $lama
+ if [ $latestChecksum != $currentChecksum ]; then
+ echo "checksum mismatch - will not start downloaded binary"
+ rm $lama
+ fi
fi
fi
-fi
-# at least we can start lama itself
-exec $lama $@
+ # at least we can start lama itself
+ exec $lama $@
+}
+
+setup_lama
#
# Why is this called index.html?