[Mod] ModUpdateSystem/AutoUpdater - cURL required system-wid

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

[Mod] ModUpdateSystem/AutoUpdater - cURL required system-wid

by Traxie21 » Tue Apr 23, 2013 20:19

ModUpdateSystem by Traxie21

What is it?
This mod allows mod makers to specify download urls for their mods, and then download them and future updates from this mod, automatically if preferred.

How does it work?
You specify INITIAL_URL (the parent directory for version.txt and updatelists.txt)
--This tells the mod to look here for the list of files to download and version. (must be a parent directory, ompldr will not work. It needs specific filenames.

You can then specify UPDATE_ON_NEW_VERSION.
--If this is true, this mod downloads updatechecker, creates a config file for it, and allows it to run with other mods. This makes a full-cycle auto-update system.

When you run the mod, it downloads all the files found in updatelists.txt and places them in their respective directories as a modpack.
If UPDATE_ON_NEW_VERSION is set to true, then it also installes updatechecker and adds a config file that specifies the LOCAL_VERSION (for comparing versions) and SOURCE_URL that has the orignal URL.

When the updatechecker is run, if there is a new version, it deletes modpack.txt which causes UpdateSystem to be run again.

Safety:
This mod is not malicious, but it does demonstrate how other mods could take advantage of cURL to be malicious.

Config files:
If a filename has "config" in it's name, it is not replaced when updating. This will allow you to preserve configurations.

Download:
Download: https://github.com/Traxie21/updatesystem/archive/master.zip
Github: https://github.com/Traxie21/updatesystem
NOTE: by default, this downloads the unstable version of ServerExtended. It can be changed by modifying INITIAL_URL in init.lua


Compatability:
This will work on any Linux system that has cURL installed.
It should also work on Windows if cURL is in the PATH variable, but no promises.

License:
Code: WTFPL

Modders:
Feel free to include this with your mods, using a custom INITIAL_URL, I'd actually recommend it!
This works best with GitHub.

FILE HIREARCHY, MUST BE CORRECT:

-INITIAL_URL
|-updatelists.txt
|-version.txt

Format for updatelists.txt:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local url, file, dir = ""

url = "https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_api/init.lua"
file = "init.lua"
dir = "/se_api/"
add_file(url, file, dir)

url = "https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_startup/init.lua"
file = "init.lua"
dir = "/se_startup/"
add_file(url, file, dir)
etc...

url is location of file you are downloading.
file is the name of the file you will write to.
dir is the name of the directory "file" will be created in.


If you want auto-updating to work, you must also add version.txt:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
version = 1.0

if you add a variable called never_update, then you can also prevent auto-updating this mod.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
version = 1.0
never_update = true


Example output (/update downloading default ServerExtended)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
[Updater]: Current version is: 0.5
[Updater]: Server up to date!
[ServerExtended] ServerExtended Version 0.5 Loaded!
[ServerExtended] Loading ServerExtended Modules...
[ServerExtended] Ranks Module Loaded
[ServerExtended] TeleportRequest Module Loaded
[ServerExtended] Homes Module Loaded
[ServerExtended] Warps Module Loaded
[ServerExtended] Player Extras Commands Module Loaded
[ServerExtended] Admin Tools Commands Module Loaded
[ServerExtended] Gui Module Loaded
creative inventory size: 220
Font size: 8 17
[Updater]: Removing (/home/traxie21/Minetest/minetest/bin/../mods/minetest/serverextended/updater/../modpack.txt)
[Updater]: Getting update lists from (https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/updatelists.txt) ...
[Updater]: Downloading (/se_api/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_api/init.lua.
[Updater]: Downloading (/se_startup/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_startup/init.lua.
[Updater]: Downloading (/se_ranks/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_ranks/init.lua.
[Updater]: Downloading (/se_homes/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_homes/init.lua.
[Updater]: Downloading (/se_warps/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_warps/init.lua.
[Updater]: Downloading (/se_tpr/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_tpr/init.lua.
[Updater]: Downloading (/se_gui/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_gui/init.lua.
[Updater]: Downloading (/se_admin_tools/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_admin_tools/init.lua.
[Updater]: Downloading (/se_player_extras/init.lua) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_player_extras/init.lua.
[Updater]: Downloading (/se_api/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_api/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_startup/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_startup/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_ranks/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_ranks/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_homes/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_homes/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_warps/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_warps/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_tpr/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_tpr/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_gui/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_gui/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_admin_tools/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_admin_tools/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_player_extras/config.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_player_extras/config.txt.
Not overwriting file (config.txt)
[Updater]: Downloading (/se_api/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_api/depends.txt.
[Updater]: Downloading (/se_startup/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_startup/depends.txt.
[Updater]: Downloading (/se_ranks/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_ranks/depends.txt.
[Updater]: Downloading (/se_homes/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_homes/depends.txt.
[Updater]: Downloading (/se_warps/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_warps/depends.txt.
[Updater]: Downloading (/se_tpr/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_tpr/depends.txt.
[Updater]: Downloading (/se_gui/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_gui/depends.txt.
[Updater]: Downloading (/se_admin_tools/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_admin_tools/depends.txt.
[Updater]: Downloading (/se_player_extras/depends.txt) from https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/se_player_extras/depends.txt.
[Updater]: Getting update lists from (https://raw.github.com/Traxie21/ServerExtended--Unstable-/master/version.txt) ...
version = 0.5


Thats all for now! Updates coming soon!
Last edited by Traxie21 on Tue Apr 23, 2013 20:40, edited 1 time in total.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Apr 24, 2013 15:31

Great, I like it!
I was also planning to make something similar once this gets merged, now you were faster... It would be safer than the current system because URL request would be reported.
I may add and updatelist to mesecons one I find some time for it.
Last edited by Jeija on Wed Apr 24, 2013 15:32, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Wed Apr 24, 2013 15:49

I think it would be better if updatelists.txt was some kind of list file with one filename per line. Some mods have tons of files (think about mesecons and technic for example).
Otherwise, excellent work!
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Wed Apr 24, 2013 16:36

Jeija wrote:Great, I like it!
I was also planning to make something similar once this gets merged, now you were faster... It would be safer than the current system because URL request would be reported.
I may add and updatelist to mesecons one I find some time for it.


Precisely why I made this, I wanted to demonstrate what would be possible if your pull request was merged. This is kind of unsafe and hacky (although it does report all url requests). Don't add updatelist to mesecons yet, images do not work properly, and will cause crashes.

kaeza wrote:I think it would be better if updatelists.txt was some kind of list file with one filename per line. Some mods have tons of files (think about mesecons and technic for example).
Otherwise, excellent work!

That would be nice, and I will work on it. all I have to do is detect the folder and filenames from the url string, but that is a bit less flexible.

What would be best is for the mod to be able to browse the folder and find all files, but that is even more os-dependant.
Last edited by Traxie21 on Wed Apr 24, 2013 16:37, edited 1 time in total.
 

User avatar
RAPHAEL
Member
 
Posts: 627
Joined: Tue Nov 01, 2011 09:09

by RAPHAEL » Sun May 05, 2013 19:59

I'm not a Windows user but seems curl can be installed on Windows:
http://8tut.com/how-to-install-curl-command-utility-on-windows-7-64-bit/

That is for Windows 7 64bit but there are other downloads on the curl download page:
http://curl.haxx.se/download.html

Some more info:
http://stackoverflow.com/questions/2710748/run-curl-commands-from-windows-console

EDIT: Forgot to ask, how exactly is this mod used? From the looks of it, you would need to include the code from this mod into each mod. Correct me if I'm wrong.

I think there should be SOME kind of mod updater setup. The current mod setup as best I can tell needs a LOT of improvement lol. Forums are nice but there should be an in game based updater and repo.
Last edited by RAPHAEL on Sun May 05, 2013 20:10, edited 1 time in total.
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Mon May 06, 2013 00:27

This can be used with any mod that is hosted in a folder setting with updatelists.txt eg: Github.

Also, I've wanted to ask you how to compile MT for Linux with all the libraries included in the excecutable. No one else seems to know how.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Mon May 06, 2013 12:54

Awesome.
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 7 guests

cron