Fix more Lua download script issues

develop
lethosor 2017-06-22 11:24:37 -04:00
parent 808835f149
commit a718aae994
1 changed files with 16 additions and 13 deletions

@ -2,9 +2,10 @@
set -e
LUA_ROOT="$HOME/lua53"
LUA_URL="http://www.lua.org/ftp/lua-5.3.3.tar.gz"
LUA_TAR=$(basename "$LUA_URL")
LUA_DIR="${LUA_TAR%.tar.*}"
LUA_DIR="$LUA_ROOT/${LUA_TAR%.tar.*}"
LUA_SHA1="a0341bc3d1415b814cc738b2ec01ae56045d64ef"
echo $LUA_TAR
@ -16,8 +17,8 @@ sha1() {
download() {
echo "Downloading $LUA_URL"
wget -O "$LUA_TAR" "$LUA_URL"
tar xvf "$LUA_TAR"
wget -O "$LUA_ROOT/$LUA_TAR" "$LUA_URL"
tar xvf "$LUA_ROOT/$LUA_TAR"
}
build() {
@ -26,25 +27,27 @@ build() {
}
main() {
mkdir -p "$HOME/lua53"
cd "$HOME/lua53"
mkdir -p "$LUA_ROOT"
cd "$LUA_ROOT"
mkdir -p bin
if [ "$(sha1 "$LUA_TAR" 2>/dev/null)" != "$LUA_SHA1" ]; then
if [ "$(sha1 "$LUA_ROOT/$LUA_TAR" 2>/dev/null)" != "$LUA_SHA1" ]; then
download
build
else
echo "Already downloaded"
fi
if [ -x "$LUA_DIR/src/luac" ]; then
echo "Already built"
else
build
if [ -x "$LUA_DIR/src/luac" ]; then
echo "Already built"
else
build
fi
fi
ln -sf "$(pwd)/$LUA_DIR/src/lua" bin/lua5.3
ln -sf "$(pwd)/$LUA_DIR/src/luac" bin/luac5.3
echo "Linking"
ln -sf "$LUA_DIR/src/lua" "$LUA_ROOT/bin/lua5.3"
ln -sf "$LUA_DIR/src/luac" "$LUA_ROOT/bin/luac5.3"
echo "Done"
}
main