Compare commits

..

10 commits
main ... dev

Author SHA1 Message Date
c35742a24d Update 'update.pl'
Proper fetching of index2.json as part of the update process. Also proper rotating and re indexing of index.json as part of the update check.
2023-01-05 18:36:01 +00:00
kake26
75e8629de2 Working version of mod updater
This is a fully working version of the mod updater. I've used it serveral times and it does work.
2022-11-18 21:50:29 +00:00
kake26
234fd090ca Server build script
Builds the stable version from source.
2022-11-18 21:47:26 +00:00
kake26
96dd09948c server control script
A small bash script to start and stop the server. I also have cron run it check if minetest is running and if it isn't then start it again. Kind of a babysitter as well.
2022-11-18 21:41:12 +00:00
Paul M
92c157110c readme notes updated 2022-08-21 21:12:32 -05:00
Paul M
ec8b3b498e index2.json updated and find command argument order changed 2022-08-21 21:00:31 -05:00
Paul M
5164ab6e8f readme updated and come comments in the code 2022-08-12 11:40:36 -05:00
Paul M
5f7cceafb3 removed bash version 2022-08-12 11:19:44 -05:00
Paul M
48f1a0f6fd clean up and a bug fix 2022-08-12 11:16:25 -05:00
Paul M
00ffcbc05a initial working copy 2022-08-11 22:08:58 -05:00
8 changed files with 31 additions and 61 deletions

2
LICENSE Executable file → Normal file
View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Paul Malcher
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

42
README.md Executable file → Normal file
View file

@ -1,39 +1,13 @@
# Luanti (Formerly Minetest)
# Minetest
Luanti related code.
My Dev branch for minetest server related code. Currently it contains a mod updater for a minetest server. This is a work in progress, use at your own risk.
# Branches
# Notes
MAIN
Version checking and comparing works. index.json is the current index of all avaialble minetest mods as pulled from content.minecraft.net. index2.json should be
a current copy from the aforementioned site using the API. index.json can be kept as is after your first run, only index2.json really needs to change for the version
detection to work. I suggest setting up a cron job to refresh index2.jon and rotate out index2.json to index.json if you want the script out put to properly reflect the old version numbers. I'll proably include a small bash script you can run to handle that later.
Will have the most recent working tools. Testing dual branches.
# Update as of 8/21/22
DEV
Contains works in progress and the latest testing code.
# What these scripts are
buildstable.bash - Builds the latest stable version of the minetest server. I use this on my VPS where I host my minetest server.
server.bash - Script to start/stop and baby sit the server. Runs via cron to restart it in case of crash.
update.pl - Perl script can be run in the mods folder to update mods. Wrote this because manually checking and doing it was a massive pain. It does require jq to be installed. Its best installed after a fresh setup as it uses index.json to keep track of what mods need to be updated when new versions are released.
# Status
As of 1/12/25:
Got around to updating things to 5.10 finally. I'me using it again to manage my Minetest server. I am going to go through with the plans of updating and expanding this finally. I know I've been saying that a while, but since I'm using it again its time to finally do this.
As of 4/15/23:
Some minor updates for minetest 5.7.0. All code was given a test as part of my server's update to minetest 5.7.0. Seems to work just fine for what I made it for. Expanding the script to include more mod management realted functions is certainly something that will happen as I'm tired of adding new mods manually. Additional updates to the build script for optimized building.
As of 1/5/23:
Dev branch updated to the latest version of the update script. It should work for the most part, but use at your own risk. I'll push it to the main branch once I've tested it.
# Current items
Currently there is a mod updater in works. This is meant for running minetest in server mode on a vps. This is something that is being developed for my own uses and might nbe useful.
Needs a potential functions to rescan installed mods as needed. Needs to proably have some sort of a backup for existing mods, before updating. Also this program isn't meant to install mods off the main minetest content db site, its purpose is to make updating easy. Also hopefully I can make that safe as well. Maybe this will be expanded in the future into a tool to fully manage mods install/update/remove included and maybe full server backups as well. Thus far though its just centered around updating mods easily. I'm open to expanding this into a full tool set for minetest servers though.

8
buildstable.bash Executable file → Normal file
View file

@ -1,8 +1,8 @@
#!/bin/bash
# wget https://github.com/minetest/minetest/archive/master.tar.gz
wget https://github.com/minetest/minetest/archive/refs/tags/5.10.0.tar.gz
tar xf 5.10.0.tar.gz
cd minetest-5.10.0
wget https://github.com/minetest/minetest/archive/refs/tags/5.6.1.tar.gz
tar xf 5.6.1.tar.gz
cd minetest-5.6.1
cd games/
wget https://github.com/minetest/minetest_game/archive/master.tar.gz
tar xf master.tar.gz
@ -13,5 +13,5 @@ wget https://github.com/minetest/irrlicht/archive/master.tar.gz
tar xf master.tar.gz
mv irrlicht-master irrlichtmt
cd ..
cmake . -DRUN_IN_PLACE=TRUE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE -DCMAKE_BUILD_TYPE=Release
cmake . -DRUN_IN_PLACE=TRUE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE
make -j$(nproc)

2
index.json Executable file → Normal file

File diff suppressed because one or more lines are too long

1
index2.json Normal file

File diff suppressed because one or more lines are too long

BIN
mods Executable file → Normal file

Binary file not shown.

10
server.bash Executable file → Normal file
View file

@ -1,18 +1,14 @@
#!/bin/bash
basedir=/home/kake26/minetest-5.10.0
worlddir=/home/kake26/minetest/minetest-server/.minetest/worlds/world2
confdir=/home/kake26/minetest
# script to start and stop minetest server
if [[ $1 == "start" ]]
then
echo "STARTING"
$basedir/bin/minetestserver --quiet --logfile $basedir/minetest.log --config $confdir/conf/minetest.conf --world $worlddir &
/home/kake26/minetest-5.6.1/bin/minetestserver --quiet --logfile /home/kake26/minetest/minetest.log --config /home/kake26/minetest/conf/minetest.conf --world /home/kake26/minetest/minetest-server/.minetest/worlds/world2/ &
pid=$!
echo $pid > $basedir/mintest.pid
echo $pid > /home/kake26/minetest/mintest.pid
fi
if pidof minetestserver
@ -21,7 +17,7 @@ then
echo "OK"
else
# Seriously why not
$basedir/bin/minetestserver --quiet --logfile $confdir/minetest.log --config $confdir/conf/minetest.conf --world $worlddir &
/home/kake26/minetest-5.6.1/bin/minetestserver --quiet --logfile /home/kake26/minetest/minetest.log --config /home/kake26/minetest/conf/minetest.conf --world /home/kake26/minetest/minetest-server/.minetest/worlds/world2/ &
fi
if [[ $1 == "stop" ]]

25
update.pl Executable file → Normal file
View file

@ -1,19 +1,17 @@
#!/usr/bin/perl
# This script will check and update minetest mods as needed. It is not 100% perfect, but it does work.
# Currently, any version checking is done against the mod file generated from a previous run.
# This was a bash script until I determined the level of invoking the ancient gods of the console required to make
# that work would be just too much
use Storable;
#use Data::Dumper;
# I know declaring a empty hash is 100% unnessecary but I am anyway
%conf = {}; # this will be stored used to keep track of stuff
$updfile = "index.json"; # I could use JSON here, but it might be easier to abuse jq
$updlsturl = "https://content.minetest.net/api/packages/"; # give use a json file of everything available
$modpath = "/home/kake26/minetest-5.10.0/mods"; # where your server stores its mods
$modpath = "/home/kake26/.minetest/mods/"; # where your server stores its mods
sub chk_update () {
@ -69,6 +67,12 @@ store \%conf, 'mods';
return;
}
sub get_file () {
# get the
system("wget -O index2.json $updlsturl");
return;
}
sub do_update ($mod,$ver,$author) {
# https://content.minetest.net/packages/TenPlus1/mob_horse/download/
# https://content.minetest.net/packages/jp/i3/releases/14157/download/
@ -90,22 +94,17 @@ undef(%conf);
&get_ready();
return;
}
# Maybe get ready and check update should be called every time
if (-e "mods"){
# load data and business as usual
# load data
print "Loading data\n";
$conf = retrieve('mods');
system("wget -O index2.json $updlsturl"); # Don't need a whole sub for one command
get_file();
chk_update();
update_files();
}else{
# if the mods file doesn't exist then we need to create it
print "Creating mods file\n";
system("wget -O index.json $updlsturl");
get_ready();
print "Done. You will need to run me again to update mods.\n";
# chk_update expects a hash retrived from storables so program needs to be run again after this
#chk_update();
}