<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<div dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi, </p>
<p><br>
</p>
<p>I'm trying to show different boot options, based on the memory of the computer: PCs with less than 1GB will not be allowed to install some operating systems.</p>
<p><br>
</p>
<p>I know that it can be made by sending {memsize} to a web server PHP script, and return the PXE script with the correct boot options. But we have lots of remote sites that use PXE and don't have a local web server in them, nor a good network access to our
central servers. So I'm trying to put all the logic inside the PXE boot script.</p>
<p><br>
</p>
<p>I looked at the 'iseq' (is equal) command source code, and cloned it into a new command: 'islo' (is lower). <span style="font-size:12pt">It seems to work ok with positive numbers.</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt">I think that it could be interesting to add this operator: with `iseq' and 'islo' you can express any integer comparison.</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt">I copy the 'git diff' here:</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt"></span></p>
<div>diff --git a/src/core/exec.c b/src/core/exec.c</div>
<div>index a13884b..ee19d1b 100644</div>
<div>--- a/src/core/exec.c</div>
<div>+++ b/src/core/exec.c</div>
<div>@@ -549,6 +549,48 @@ struct command iseq_command __command = {</div>
<div> .exec = iseq_exec,</div>
<div> };</div>
<div><br>
</div>
<div>+/** "islo" options */</div>
<div>+struct islo_options {};</div>
<div>+</div>
<div>+/** "islo" option list */</div>
<div>+static struct option_descriptor islo_opts[] = {};</div>
<div>+</div>
<div>+/** "islo" command descriptor */</div>
<div>+static struct command_descriptor islo_cmd =</div>
<div>+ COMMAND_DESC ( struct islo_options, islo_opts, 2, 2,</div>
<div>+ "<value1> <value2>" );</div>
<div>+</div>
<div>+/**</div>
<div>+ * "islo" command</div>
<div>+ *</div>
<div>+ * @v argc Argument count</div>
<div>+ * @v argv Argument list</div>
<div>+ * @ret rc Return status code</div>
<div>+ */</div>
<div>+static int islo_exec ( int argc, char **argv ) {</div>
<div>+ struct islo_options opts;</div>
<div>+ unsigned int operand0, operand1;</div>
<div>+ int rc;</div>
<div>+</div>
<div>+ /* Parse options */</div>
<div>+ if ( ( rc = parse_options ( argc, argv, &islo_cmd, &opts ) ) != 0 )</div>
<div>+ return rc;</div>
<div>+</div>
<div>+ if ( ( rc = parse_integer ( argv[optind], &operand0 ) ) != 0 )</div>
<div>+ return rc;</div>
<div>+ if ( ( rc = parse_integer ( argv[optind+1], &operand1 ) ) != 0 )</div>
<div>+ return rc;</div>
<div>+</div>
<div>+ /* Return success if operand0 is lower than operand1 */</div>
<div>+ return ( ( operand0 < operand1 ) ? 0 : -ERANGE );</div>
<div>+}</div>
<div>+</div>
<div>+/** "islo" command */</div>
<div>+struct command islo_command __command = {</div>
<div>+ .name = "islo",</div>
<div>+ .exec = islo_exec,</div>
<div>+};</div>
<div>+</div>
<div>
<div> /** "sleep" options */</div>
<div> struct sleep_options {};</div>
<div><br>
</div>
<br>
</div>
<br>
<p></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><br>
</p>
<p><br>
</p>
</div>
</div>
</body>
</html>