我有一个autoinst.xml,它将在系统安装过程中使用,用于安装arp连接,它被配置为接收用户有关ip、网关和网络掩码的输入,如下所示
<path>networking,dns,hostname</path>
<title>INS Server Network Settings</title>
<question>Enter Hostname</question>
<stage>cont</stage>
<default></default>
</ask>
<ask>
<dialog config:type="integer">2</dialog>
<element config:type="integer">2</element>
<path>networking,interfaces,0,ipaddr</path>
<title>INS Server Network Settings</title>
<question>Enter the server IP address:</question>
<stage>cont</stage>
<default>1.2.3.4</default>
</ask>
<ask>
<dialog config:type="integer">2</dialog>
<element config:type="integer">3</element>
<path>networking,interfaces,0,netmask</path>
<question>Enter the server netmask:</question>
<stage>cont</stage>
<default>255.255.255.0</default>
</ask>
<ask>
<dialog config:type="integer">2</dialog>
<element config:type="integer">4</element>
<path>networking,routing,routes,0,gateway</path>
<question>Enter the server default gateway:</question>
<stage>cont</stage>
<default>1.2.3.1</default>在这里,我想使用上面"Gateway“一节中提供的值,以便在下面使用。假设用户在上面提供了192.168.10.100作为网关,它应该存储在一个变量中,并且我可以将变量名放在下面的arp_ip_target中,以便使用默认网关作为目标。但我不知道该怎么做呢?
<interfaces config:type="list">
<interface>
<device>bond0</device>
<startmode>onboot</startmode>
<bonding_master>yes</bonding_master>
<bonding_module_opts>arp_interval=1000 arp_ip_target="**gateway**" mode=1 arp_validate=all</bonding_module_opts>
<bonding_slave0>eth0</bonding_slave0>
<bonding_slave1>eth1</bonding_slave1>
<ipaddr></ipaddr>
<netmask></netmask>
</interface>
</interfaces>发布于 2015-07-15 09:16:50
XML不支持引用其他元素或值。
因此,你想要达到的目标是不可能的。如果您想要创建这样的解决方案,您必须将其合并到用于读取和解释该文件的软件中。您可以为它提供自己的语法。
https://stackoverflow.com/questions/31426191
复制相似问题