Compare commits
18 commits
Author | SHA1 | Date | |
---|---|---|---|
21605e9319 | |||
0c8eb5bfe6 | |||
0f5b6e227b | |||
acb67edf25 | |||
![]() |
46548688bf | ||
![]() |
1064c06902 | ||
![]() |
49321f2de7 | ||
![]() |
311b76c734 | ||
![]() |
3331ea9251 | ||
![]() |
10babf2014 | ||
![]() |
49270c9924 | ||
4cc9159c08 | |||
![]() |
14c74543f7 | ||
c7c2cbcf90 | |||
16f906859c | |||
![]() |
f0a547242d | ||
![]() |
bf4e7fc555 | ||
![]() |
db76f525d7 |
7 changed files with 201 additions and 3 deletions
2
LICENSE
Normal file → Executable file
2
LICENSE
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) <year> <copyright holders>
|
Copyright (c) 2022 Paul Malcher
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
|
|
40
README.md
Normal file → Executable file
40
README.md
Normal file → Executable file
|
@ -1,3 +1,39 @@
|
||||||
# Minetest
|
# Luanti (Formerly Minetest)
|
||||||
|
|
||||||
Minetest related code
|
Luanti related code.
|
||||||
|
|
||||||
|
# Branches
|
||||||
|
|
||||||
|
MAIN
|
||||||
|
|
||||||
|
Will have the most recent working tools. Testing dual branches.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
17
buildstable.bash
Executable file
17
buildstable.bash
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/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
|
||||||
|
cd games/
|
||||||
|
wget https://github.com/minetest/minetest_game/archive/master.tar.gz
|
||||||
|
tar xf master.tar.gz
|
||||||
|
mv minetest_game-master minetest_game
|
||||||
|
cd ..
|
||||||
|
cd lib/
|
||||||
|
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
|
||||||
|
make -j$(nproc)
|
1
index.json
Executable file
1
index.json
Executable file
File diff suppressed because one or more lines are too long
BIN
mods
Executable file
BIN
mods
Executable file
Binary file not shown.
33
server.bash
Executable file
33
server.bash
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/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 &
|
||||||
|
pid=$!
|
||||||
|
echo $pid > $basedir/mintest.pid
|
||||||
|
fi
|
||||||
|
|
||||||
|
if pidof minetestserver
|
||||||
|
then
|
||||||
|
# Horribly cheap but works
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
# Seriously why not
|
||||||
|
$basedir/bin/minetestserver --quiet --logfile $confdir/minetest.log --config $confdir/conf/minetest.conf --world $worlddir &
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "stop" ]]
|
||||||
|
then
|
||||||
|
echo "STOPING"
|
||||||
|
$(pidof minetestserver | xargs kill -s INT)
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
111
update.pl
Executable file
111
update.pl
Executable file
|
@ -0,0 +1,111 @@
|
||||||
|
#!/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;
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
sub chk_update () {
|
||||||
|
|
||||||
|
print "Checking for updates...\n";
|
||||||
|
|
||||||
|
foreach my $key (keys %{ $conf->{"mods"}}) { # the fing arrow -> sigh could have saved so much time
|
||||||
|
|
||||||
|
print "Checking mod $key \n";
|
||||||
|
|
||||||
|
# So we can now check against index2.json
|
||||||
|
|
||||||
|
$author2 = `jq -c '.[] | select(.name =="$key") | .author' index2.json`;
|
||||||
|
$author2 =~ s/\"//g;
|
||||||
|
|
||||||
|
$release2 = `jq -c '.[] | select(.name =="$key") | .release' index2.json`;
|
||||||
|
$release2 =~ s/\"//g;
|
||||||
|
|
||||||
|
chomp($author2);
|
||||||
|
chomp($release2);
|
||||||
|
|
||||||
|
if ($conf->{"mods"}{$key}{"release"} != $release2) {
|
||||||
|
print "Mod $key current release: " . $release2 . " installed: " . $conf->{"mods"}{$key}{"release"} ."!\n";
|
||||||
|
# we should trigger the updater here
|
||||||
|
|
||||||
|
&do_update($key,$release2,$author2);
|
||||||
|
}else{
|
||||||
|
print "Mod $key up to date\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_ready (){
|
||||||
|
$mods = `find $modpath -type d -maxdepth 1 -print`; # -print is there for a reason, find saved a huge amount of time
|
||||||
|
@mods = split("\n",$mods);
|
||||||
|
foreach(@mods){
|
||||||
|
@tmods = split("\/",$_);
|
||||||
|
$tmname = pop(@tmods);
|
||||||
|
if ($tmname eq "mods"){
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
# At this point we should have a mod's name
|
||||||
|
$author = `jq -c '.[] | select(.name =="$tmname") | .author' index.json`; #jq is a time saver
|
||||||
|
$author =~ s/\"//g;
|
||||||
|
chomp($author);
|
||||||
|
$release = `jq -c '.[] | select(.name =="$tmname") | .release' index.json`;
|
||||||
|
$release =~ s/\"//g;
|
||||||
|
chomp($release);
|
||||||
|
$conf{"mods"}{$tmname}{"author"} = $author;
|
||||||
|
$conf{"mods"}{$tmname}{"release"} = $release;
|
||||||
|
}
|
||||||
|
store \%conf, 'mods';
|
||||||
|
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/
|
||||||
|
$mod = $_[0];
|
||||||
|
$ver = $_[1];
|
||||||
|
$author = $_[2];
|
||||||
|
|
||||||
|
system("wget -O $mod.zip https://content.minetest.net/packages/$author/$mod/releases/$ver/download/");
|
||||||
|
system("unzip -o $mod.zip");
|
||||||
|
# print "Update info $mod $ver $author\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub update_files () {
|
||||||
|
# This is triggered when mod updates are detected
|
||||||
|
system("rm index.json");
|
||||||
|
system("cp index2.json index.json");
|
||||||
|
system("rm mods");
|
||||||
|
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
|
||||||
|
|
||||||
|
print "Loading data\n";
|
||||||
|
$conf = retrieve('mods');
|
||||||
|
system("wget -O index2.json $updlsturl"); # Don't need a whole sub for one command
|
||||||
|
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";
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue