What's new

amtm Automatic script updates - a guide for script developers of how to add 'amtmupdate' support into scripts.

thelonelycoder

Part of the Furniture
Introduction
Since version 6.4, amtm can update compatible scripts directly when using the u update option. This gives users one place to update all amtm scripts instead of opening each individually and run their own update function. All scripts can certainly keep their own update function, I just need to be able to run it directly from amtm.
I hope that the majority of amtm supported scripts will support the amtmupdate command. All AMTM-OSR scripts have already added the function.
For new scripts added to amtm, this is now a requirement.

How to add 'amtmupdate' support into scripts
You will need to add a command parameter called amtmupdate into your script. amtm will grep for that exact term to determine if a script supports the automatic script updates function.
If the word amtmupdate is found, amtm runs a check using two positional parameters:
/path/to/script amtmupdate check
Script developers can manually or automatically disallow amtm to update their scripts with amtmupdate. For example, MerlinAU disables updating its script via amtm when its own built-in 'automatic script update' feature is enabled.

If a script has amtmupdate enabled, amtm expects an exit code of 0 when it runs /path/to/script amtmupdate check while when it's disabled the exit code shall be 1.

In case the exit code is 0 and an update is available for the script, amtm will ask the user if he/she wants to update it through amtm.
To run the update, amtm will then send the update command with /path/to/script amtmupdate.

I expect minimal output from a script during the update. Diversion prints two lines:
Code:
  i  Running function amtmupdate
  ✔  Diversion 5.7 amtmupdate complete
If the update is successful, the scripts exit code shall be 0, if it was not, the exit code shall be 1.

amtm will only use amtmupdate if the remote version of a script is higher than the local version. Scripts with a version higher than the remote version or an MD5 change need to be updated through the scripts own update function.

Let me know if you need help. If uncertain how to do all that, the AMTM-OSR scripts have easy to read code to peruse ;)
 
Last edited:

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Back
Top