Skip to content

Instantly share code, notes, and snippets.

@britzl
Created August 25, 2014 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save britzl/60145e7179b66eb2d4e9 to your computer and use it in GitHub Desktop.
Save britzl/60145e7179b66eb2d4e9 to your computer and use it in GitHub Desktop.
Shell script to download an OS specific Lua 5.1 binary
#!/bin/bash
# Downloads an OS specific Lua 5.1 binary
if [[ "$OSTYPE" == "linux-gnu" ]]; then
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/lua-5.1.5_Linux32_64_bin.tar.gz/download"
LUA_BINARY=lua5.1
elif [[ "$OSTYPE" == "darwin"* ]]; then
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/lua-5.1.5_MacOS109_bin.tar.gz/download"
LUA_BINARY=lua5.1
elif [[ "$OSTYPE" == "win32" ]]; then
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Executables/lua5_1_5_Win32_bin.zip/download"
LUA_BINARY=lua5.1.exe
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/lua-5.1.5_Win32_cygw17_bin.zip/download"
LUA_BINARY=lua5.1.exe
else
echo "No Lua binary available for OS $OSTYPE"
exit 1
fi
echo "Downloading Lua binary from $LUA_DOWNLOAD_URL"
curl -o lua.tar.gz -L $LUA_DOWNLOAD_URL
tar -xzf lua.tar.gz $LUA_BINARY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment