From 14c74543f7491ca92449dc509a801f91e3c23610 Mon Sep 17 00:00:00 2001 From: kake26 Date: Tue, 10 Jan 2023 13:55:36 -0600 Subject: [PATCH] Updates to update.pl Creating needed files on first run. Refreshing files needed for update check and updating automatically now. --- update.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/update.pl b/update.pl index 7128678..dc6c216 100644 --- a/update.pl +++ b/update.pl @@ -85,14 +85,32 @@ sub do_update ($mod,$ver,$author) { # 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 print "Loading data\n"; $conf = retrieve('mods'); + get_file(); chk_update(); + update_files(); }else{ + # check if index.json exists if not then create it + if (-e "index.json") { + # do noothing + }else{ + system("wget -O index.json $updlsturl"); + } get_ready(); # chk_update expects a hash retrived from storables so program needs to be run again after this #chk_update();