Lua

From GeilThings

Jump to: navigation, search
Lua
General
Version 5.2.2
Stable 5.2.2
Function Programming Language
Name means Moon for Portuguese
Scripts
Version Script lua -v


Contents

General

  • Available in CentOS 6.2 base repository: 5.1.4

Installing Lua

APPNAME=lua
RAWNEWVERSION=`curl -d "action=ask&query=[[Lua]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
DOWNLOADURL=http://www.lua.org/ftp/lua-${NEWVERSION}.tar.gz
 
cd /opt
wget ${DOWNLOADURL}
tar -zxvf lua-${NEWVERSION}.tar.gz
cd /opt/lua-${NEWVERSION}
# Check if there are new installation instructions,
# look at the change log.
vi /opt/lua-${NEWVERSION}/doc/readme.html
:q
make linux test
make local
 
# Create softlink to facilitate administration.
cd /opt
ln -s lua-${NEWVERSION} /opt/lua
 
# The lua binary and compiler are under
# /opt/lua/install/bin
/opt/lua/install/bin/lua -v

Upgrading Lua

APPNAME=lua
 
RAWOLDVERSION=`/opt/lua/install/bin/lua -v`
# Format:
# Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio
OLDVERSION=`echo "$RAWOLDVERSION" | grep -Po '^.*?\K(?<=Lua ).*?(?= C)'`
echo $OLDVERSION
 
RAWNEWVERSION=`curl -d "action=ask&query=[[Lua]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
if [[ ${OLDVERSION} != ${NEWVERSION} ]]; then
  echo ${APPNAME}: installed: ${OLDVERSION}, actual: ${NEWVERSION}
  echo "You could update ${APPNAME} to ${NEWVERSION}"
  echo "Would you like to install ${APPNAME} ${NEWVERSION} y/n?"
  read item
  if [[ "$item" == "y" || "$item" == "Y" ]]; then
    echo "Installing ${APPNAME} ${NEWVERSION}. Follow instructions."
  else
    echo "Exit"
  fi
else
  echo "You don't need to update ${APPNAME}; it is uptodate (${NEWVERSION})"
fi
 
DOWNLOADURL=http://www.lua.org/ftp/lua-${NEWVERSION}.tar.gz
 
cd /opt
wget ${DOWNLOADURL}
tar -zxvf lua-${NEWVERSION}.tar.gz
cd /opt/lua-${NEWVERSION}
# Check if there are new installation instructions,
# look at the change log.
vi /opt/lua-${NEWVERSION}/doc/readme.html
:q
make linux test
make local
 
# Update softlink.
cd /opt
rm -f /opt/lua
ln -s lua-${NEWVERSION} /opt/lua
 
# The lua binary and compiler are under
# /opt/lua/install/bin
/opt/lua/install/bin/lua -v
 
mv /opt/lua-${OLDVERSION} /opt/old_lua-${OLDVERSION}

Versions

Software name Version number Version date
Lua 5.2.2 29 March 2013