Skip to content
Snippets Groups Projects
Commit 31a90141 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Change the "md5" key to an array of sections [md5:<sum>]

... instead of a comma-separated list. .ini lines are limited in length,
MD5sums are kind of long and would limit the number of .exe versions we
could support. Also, no we now have a way to correlate and report version
numbers/strings and URLs with each exe version. The "ver" and "url" keys
are not yet displayed or used for anything and are thus optional.
parent 3be46bcb
Branches
Tags
No related merge requests found
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// The additional install-xtrn.ini keys are: // The additional install-xtrn.ini keys are:
// exe = filename of door's executable // exe = filename of door's executable
// md5 = comma-separated list of md5-sums (in lowercase hexadecimal)
// The additional install-xtrn.ini sections are:
// [md5:<md5-sum>] where <md5-sum> is a hex md5-sum of a version of the exe file
// ver = <optional version information, don't start with "v" or "version">
// url = <optional location to find corresponding distribution/install archive>
"use strict"; "use strict";
...@@ -32,22 +37,24 @@ function scan(options) ...@@ -32,22 +37,24 @@ function scan(options)
return; return;
} }
const ini = f.iniGetObject(/* lowercase: */true); const ini = f.iniGetObject(/* lowercase: */true);
const md5 = f.iniGetAllObjects("sum", "md5:", /* lowercase: */true);
f.close(); f.close();
if (!ini.exe) { if (!ini.exe) {
out.push("!No executable filename specified in " + f.name); out.push("!No executable filename specified in " + f.name);
return; return;
} }
if (!ini.md5) { if (!md5) {
out.push("!No md5 list specified in " + f.name); out.push("!No md5 list specified in " + f.name);
return; return;
} }
if (!exe_list[ini.exe]) if (!exe_list[ini.exe])
exe_list[ini.exe] = {}; exe_list[ini.exe] = {};
var md5_list = ini.md5.split(','); for(var i in md5) {
for(var i in md5_list) exe_list[ini.exe][md5[i].sum] = md5;
exe_list[ini.exe][md5_list[i]] = f.name; exe_list[ini.exe][md5[i].sum].ini_fname = f.name;
}
}); });
for(var i in exe_list) { for(var i in exe_list) {
directory(options.xtrn_dir + '*').forEach(function (e) { directory(options.xtrn_dir + '*').forEach(function (e) {
const f = new File(e + i); const f = new File(e + i);
...@@ -57,8 +64,10 @@ function scan(options) ...@@ -57,8 +64,10 @@ function scan(options)
var md5 = f.md5_hex; var md5 = f.md5_hex;
f.close(); f.close();
if(!exe_list[i][md5]) { if(!exe_list[i][md5]) {
if(options.debug) if(options.debug) {
out.push("!MD5 sum of " + f.name + " (" + md5 + ") not found."); out.push("!MD5 sum of " + f.name + " (" + md5 + ") not found.");
out.push(JSON.stringify(exe_list, null, 4));
}
return; return;
} }
var startup_dir = f.name.substr(0, Math.max(f.name.lastIndexOf("/"), f.name.lastIndexOf("\\"), 0)); var startup_dir = f.name.substr(0, Math.max(f.name.lastIndexOf("/"), f.name.lastIndexOf("\\"), 0));
...@@ -68,11 +77,12 @@ function scan(options) ...@@ -68,11 +77,12 @@ function scan(options)
out.push(ini_fname + " already exists"); out.push(ini_fname + " already exists");
return; return;
} }
if (!file_copy(exe_list[i][md5], ini_fname)) { var src = exe_list[i][md5].ini_fname;
out.push("!Error copying " + exe_list[i][md5] + " to " + ini_fname); if (!file_copy(src, ini_fname)) {
out.push("!Error copying " + src + " to " + ini_fname);
return; return;
} }
out.push(exe_list[i][md5] + " copied to " + ini_fname); out.push(src + " copied to " + ini_fname);
}); });
} }
return out; return out;
......
...@@ -4,10 +4,13 @@ The `.ini` files in this directory are in the Synchronet `install-xtrn.ini` ...@@ -4,10 +4,13 @@ The `.ini` files in this directory are in the Synchronet `install-xtrn.ini`
format with base filenames reflecting the door they are intended to help format with base filenames reflecting the door they are intended to help
install into a Synchronet system. install into a Synchronet system.
The additional keys expected are: The additional keys/sections expected are:
~~~ ~~~
exe = name of the executable file exe = name of the executable file (in the root/unnamed section) [one]
md5 = comma-separated list of MD5-sums for supported executable file versions
[md5:<sum>] Hex MD5-sum for a supported executable file version [multiple]
ver = <optional version information - start with a number, not 'v')
url = <optional distribution/install package location - start with scheme://>
~~~ ~~~
MD5-sums are presented in lowercase hexadecimal (e.g. same format returned by MD5-sums are presented in lowercase hexadecimal (e.g. same format returned by
*nix `md5sum` utility). *nix `md5sum` utility).
...@@ -5,7 +5,7 @@ By: RhythmNp (Evan Elias) ...@@ -5,7 +5,7 @@ By: RhythmNp (Evan Elias)
Cats: Games Cats: Games
Subs: Multiplayer, Adventure, MUD, Native Subs: Multiplayer, Adventure, MUD, Native
exe: dmud32.exe exe: dmud32.exe
md5: b92fe52e1883ad8502cb2ea9de75173f [md5:b92fe52e1883ad8502cb2ea9de75173f]
[prog:DOORMUD] [prog:DOORMUD]
cmd = dmud32 cmd = dmud32
......
...@@ -6,17 +6,26 @@ By: Mike Wilson ...@@ -6,17 +6,26 @@ By: Mike Wilson
Cats: Games Cats: Games
Subs: Multiplayer, RPG Subs: Multiplayer, RPG
exe: FOODFITE.EXE exe: FOODFITE.EXE
; 591c73daff36feb8ba36ebb8b322307e 4.61 [md5:591c73daff36feb8ba36ebb8b322307e]
; 591c73daff36feb8ba36ebb8b322307e 4.6 ver = 4.61
; b42ed4a7d5cb0689d835def10a86b67b 4.5 [md5:591c73daff36feb8ba36ebb8b322307e]
; bde3e380329a902c5fcf1391ec06f440 4.4 ver = 4.6
; b8a9e177e208df0b496cad7f7c77aec2 4.0 [md5:b42ed4a7d5cb0689d835def10a86b67b]
; 939bb5189d4535f6388e6c35b96cc45f 3.3 ver = 4.5
; 33cd35708a5cf17ce2415636f715f196 3.2 [md5:bde3e380329a902c5fcf1391ec06f440]
; 36be50db6c3ef653ff1024bdd4e8f0dc 3.0 ver = 4.4
; fe15a026d4fd10db3f67997c2ac146d2 2.5 [md5:b8a9e177e208df0b496cad7f7c77aec2]
; 94ba5e82ab234124ddad72eaa7dc4658 2.0 ver = 4.0
md5: 591c73daff36feb8ba36ebb8b322307e,bde3e380329a902c5fcf1391ec06f440,b42ed4a7d5cb0689d835def10a86b67b,591c73daff36feb8ba36ebb8b322307e,b8a9e177e208df0b496cad7f7c77aec2,939bb5189d4535f6388e6c35b96cc45f,33cd35708a5cf17ce2415636f715f196,36be50db6c3ef653ff1024bdd4e8f0dc,fe15a026d4fd10db3f67997c2ac146d2,94ba5e82ab234124ddad72eaa7dc4658 [md5:939bb5189d4535f6388e6c35b96cc45f]
ver = 3.3
[md5:33cd35708a5cf17ce2415636f715f196]
ver = 3.2
[md5:36be50db6c3ef653ff1024bdd4e8f0dc]
ver = 3.0
[md5:fe15a026d4fd10db3f67997c2ac146d2]
ver = 2.5
[md5:94ba5e82ab234124ddad72eaa7dc4658]
ver = 2.0
[prog:FOODFITE] [prog:FOODFITE]
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment