clean up and a bug fix
This commit is contained in:
parent
00ffcbc05a
commit
48f1a0f6fd
2 changed files with 5 additions and 22 deletions
BIN
mods
BIN
mods
Binary file not shown.
27
update.pl
27
update.pl
|
@ -4,11 +4,10 @@
|
|||
# that work would be just too much
|
||||
|
||||
use Storable;
|
||||
use Data::Dumper;
|
||||
#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
|
||||
%conf2 = {};
|
||||
|
||||
$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
|
||||
|
@ -18,10 +17,6 @@ sub chk_update () {
|
|||
|
||||
print "Checking for updates...\n";
|
||||
|
||||
#print Dumper($conf);
|
||||
|
||||
|
||||
|
||||
foreach my $key (keys %{ $conf->{"mods"}}) { # the fing arrow -> sigh could have saved so much time
|
||||
|
||||
print "Checking mod $key \n";
|
||||
|
@ -37,10 +32,8 @@ foreach my $key (keys %{ $conf->{"mods"}}) { # the fing arrow -> sigh could have
|
|||
chomp($author2);
|
||||
chomp($release2);
|
||||
|
||||
#print "Current release $release2 author $author2 installed ". $conf->{"mods"}{$key}{"release"} ." \n";
|
||||
|
||||
if ($conf->{"mods"}{$key}{"release"} != $release2) {
|
||||
print "Mod $key current release: " . $release2 . " installed: " . $conf{"mods"}{$key}{"release"} ."!\n";
|
||||
if ($conf->{"mods"}{$key}{"release"} != $release2) {
|
||||
print "Mod $key current release: " . $release2 . " installed: " . $conf->{"mods"}{$key}{"release"} ."!\n";
|
||||
}else{
|
||||
print "Mod $key up to date\n";
|
||||
}
|
||||
|
@ -58,14 +51,12 @@ foreach(@mods){
|
|||
next;
|
||||
}
|
||||
# At this point we should have a mod's name
|
||||
#print "Mod name $tmname\n";
|
||||
$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);
|
||||
#print "$author\n";
|
||||
$conf{"mods"}{$tmname}{"author"} = $author;
|
||||
$conf{"mods"}{$tmname}{"release"} = $release;
|
||||
}
|
||||
|
@ -87,16 +78,8 @@ if (-e "mods"){
|
|||
# load data
|
||||
print "Loading data\n";
|
||||
$conf = retrieve('mods');
|
||||
#print "Saved...\n";
|
||||
#print Dumper($conf2);
|
||||
#print "Freash...\n";
|
||||
#get_ready();
|
||||
#print Dumper($conf);
|
||||
chk_update();
|
||||
}else{
|
||||
get_ready();
|
||||
chk_update();
|
||||
}
|
||||
|
||||
#get_ready();
|
||||
|
||||
#chk_update();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue