Updates to update.pl
Creating needed files on first run. Refreshing files needed for update check and updating automatically now.
This commit is contained in:
parent
c7c2cbcf90
commit
14c74543f7
1 changed files with 18 additions and 0 deletions
18
update.pl
18
update.pl
|
@ -85,14 +85,32 @@ sub do_update ($mod,$ver,$author) {
|
||||||
# print "Update info $mod $ver $author\n";
|
# 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
|
# Maybe get ready and check update should be called every time
|
||||||
|
|
||||||
if (-e "mods"){
|
if (-e "mods"){
|
||||||
# load data
|
# load data
|
||||||
print "Loading data\n";
|
print "Loading data\n";
|
||||||
$conf = retrieve('mods');
|
$conf = retrieve('mods');
|
||||||
|
get_file();
|
||||||
chk_update();
|
chk_update();
|
||||||
|
update_files();
|
||||||
}else{
|
}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();
|
get_ready();
|
||||||
# chk_update expects a hash retrived from storables so program needs to be run again after this
|
# chk_update expects a hash retrived from storables so program needs to be run again after this
|
||||||
#chk_update();
|
#chk_update();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue