Raised This Month: $7 Target: $400
 1% 

[Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-11-2020 , 05:27   [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #1

I've modified compile.sh and created update.sh to simplify the process of compiling plugins and updating AMXX on unix based operating systems.
More information and examples shown below.

compile.sh >
  • Compile single or multiple files
  • Compile all source files
  • Check compiler version

- Compile single or multiple files
Single file: ./compile.sh admin.sma
Multiple files: ./compile.sh admin.sma adminchat.sma admincmd.sma

- Compile all source files
./compile.sh
All compiled plugins are located at addons/amxmodx/scripting/compiled

- Display help menu
Code:
./compile.sh --help

  Usage:
--help    (-h) : This menu
--version (-v) : AMX MOD X Compiler version

To compile all source files in the directory
  execute the script without any parameters
To compile specific or multiple source files
  execute the script with parameters set as source files' name
  e.g ./compile.sh admin.sma admincmd.sma adminchat.sma
- Check compiler version
Code:
./compile.sh --version

AMX Mod X Compiler 1.9.0.5270
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team
update.sh >
  • Get latest version of AMX MOD X
  • Update game files to either 1.9 or 1.10 based on your choice
  • Autoupdate the game files
  • Setup the autoupdater
  • File backup
  • Update specific files for configs folder, default: hamdata.ini (version 1.9 only)

- Display help menu
Code:
./update.sh --help

  Usage:
--help    (-h) : This menu
--latest  (-l) : Latest AMX MOD X version
--update  (-u) : Update files
--auto    (-a) : Autoupdates AMXX
--setup   (-s) : Set up autoupdater
- Check latest version of AMX MOD X
Code:
./update.sh --latest

Latest AMX MOD X version
1.9 Build: 5270
1.10 Build: 5401
- Get latest version of AMX MOD X
Spoiler


- Setup the autoupdater
Run ./update.sh --setup and specify the game that the server is currently running.
To setup the autoupdate the current version of AMXX must be either 1.9 or 1.10, which you can see it at ./compile.sh --version
If you get an error saying amxxpc does not exists then the only option is to update the game files using ./update.sh --update
The autoupdater loads a hidden file (addons/amxmodx/scripting/.save_data) that this file is created after successfully updating using ./update.sh --update.
The scripts checks if there's a new version and if so it automatically updates without user interaction.
Note: You must run --update then use --auto

- How to lauch autoupdater every server restart?
Firstly you need the .save_data file to load the configurations.
If you are missing the file, you can create one yourself or get it from updating the files: ./update.sh --update
If you are not able to use the terminal, you can create a dummy file and set the build version to a random number which will cause the autoupdater think that this is an old version and updated the files for you
Dummy file
Code:
.save_data >
game=cstrike
amxx=1.9
build=1234
configs=0000000100000000
The numbers in the configs are the files listed alphabetically, which 0 stands for 'to not replace' and 1 'to replace'.
The autoupdater will loop through each value and compare it with the files and decide if this file should be replaced or not.

After setting up .save_data modify the server start options as shown below:
bash <gamemod>/addons/amxmodx/scripting/update.sh --auto && <your-current-server-start-script>
e.g: bash cstrike/addons/amxmodx/compile.sh --auto && screen -S server ./hlds_run -game cstrike -port 27015 +map de_dust2 +maxplayers 32 +sys_tickrate 512 +fps_max 512

Or your can run a side bash script to auto update
Note: Repacing modules meanwhile the server is running may cause the server to crash.
screen -S autoupdate ./autoupdate.sh
Code:
autoupdate.sh >
#!/bin/bash

while [ true ]; then
    bash cstrike/addons/amxmodx/update.sh --auto
    sleep 24h # execute the script every 24 hours
done
How to use the commands?
If your server is running either 1.9 or 1.10, you can setup the autoupdater and run the autoupdate.sh script.
./update.sh --setup
If your server is on a older version, you can update to 1.9 or 1.10 and lauch the autoupdate.sh script.
./update.sh --update

* compile.sh Pull Request
https://github.com/alliedmodders/amxmodx/pull/870
* update.sh Pull Request
https://github.com/alliedmodders/amxmodx/pull/871
* Download compile.sh (CTRL + S)
https://raw.githubusercontent.com/Cr...ins/compile.sh
* Download update.sh (CTRL + S)
https://raw.githubusercontent.com/Cr...gins/update.sh

Stat counting
Spoiler
__________________

Last edited by Relaxing; 06-19-2020 at 00:40.
Relaxing is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-11-2020 , 05:35   Re: [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #2

Nice job mate.
thEsp is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-11-2020 , 05:40   Re: [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #3

Quote:
Originally Posted by thEsp View Post
Nice job mate.
__________________
Relaxing is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-11-2020 , 21:16   Re: [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #4

Seems like a completely inappropriate place to put auto-update code for the entirety of AMX Mod X. I think that if something like this existed, it would need to be its own script since it's has absolutely nothing to do with compiling a plugin.
__________________
fysiks is offline
Old 06-12-2020, 06:00
Relaxing
This message has been deleted by Relaxing.
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-17-2020 , 23:50   Re: [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #5

Updated.
__________________
Relaxing is offline
XoNix
Junior Member
Join Date: Jul 2021
Location: Algeria
Old 07-26-2021 , 17:10   Re: [Bash] Autoupdate the AMXX to the latest version [1.9 / 1.10]
Reply With Quote #6

Nice God Job Man
XoNix is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode