Jump to content

[REL] Recursive compiler (Linux)


Mr_Moose

Recommended Posts

In case you are running your server on Linux over SSH and getting sick of people constantly stealing your client side scripts, this might be the solution you're looking for. With this recursive compiling script you can compile your entire resource catalogue, even multiple servers at once (on shared hosts for instance).

Requirements:

Installation:

  • Download the official compiler application
  • Copy below script sand save it to a *.sh file in the same directory as 'luac_mta'
  • Change '' on line 4 to the directory where your resources are located
  • Make it executable by running 'chmod +x *.sh'
  • Run the script './*.sh'

Features:

  • Compiles every .lua file recursively
  • Update 'meta.xml' by replacing the '.lua' extension with '.luac'
  • Takes a backup of every file before doing anything to them.
  • Saves you time since you don't have to compile every file individually.

#!/bin/bash 
# Grand Theft Walrus: auto compiler v.1.4.132 
# Global settings 
FILES=<resource_directory> 
EXT="c" 
BAK=".bak" 
recurse() { 
  for i in "$1"/*; do 
    if [ -d "$i" ]; then 
      sleep 1  # Do not remove! 
      recurse "$i" 
    elif [ -f "$i" ]; then 
      # Compile if lua file 
      if [ ${i: -4} == ".lua" ]; then 
        cp $i $i$BAK 
        ./luac_mta -s -e -o $i$EXT $i 
        echo "[Compiling] $i" 
        sudo chown nobody:nogroup $i 
      # Replace lua with luac in meta.xml 
      elif [ ${i: -8} == "meta.xml" ]; then 
        cp $i $i$BAK 
        sed -i 's/.lua/.luac/g' $i 
      fi 
    fi 
  done 
} 
  
# Information and status 
./luac_mta -v 
recurse $FILES 
echo "Compiler finished successfully!" 

Note that line 10 has a sleep of 1 second, that's when we switch to the next resource. It has noting to do with this script itself but saves bandwidth for luac.multitheftauto.com, also avoid running this to often since it may have negative effects on performance if to many files are compiled at the same time.

License:

Grand Theft Walrus, Recursive lua compiler system. Copyright © 2011-2014 MrBrutus

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program. If not, see .

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...