Multiple choice of IP addresses in parameter

Answered

Comments

2 comments

  • Avatar
    juanjo

    You could use the below code:

        <setInstallerVariableFromScriptOutput>
          <exec>ifconfig</exec>
          <execArgs> | grep "inet add"  | grep -v 127.0.0.1 | awk '{print $2}' | awk 'BEGIN { FS=":" } { print $2 }'</execArgs>
          <name>ips</name>
        </setInstallerVariableFromScriptOutput>
         <setInstallerVariable name="ipsText" value=""/>
     <foreach variables="ip" values="${ips}">
        <actionList>
            <setInstallerVariable name="ipsText" value="${ipsText}&#xA;${ip}=${ip}"/>
        </actionList>
     </foreach>
     <addChoiceOptionsFromText>
        <name>ip</name>
        <text>${ipsText}</text>
     </addChoiceOptionsFromText>
    

    To populate an existing parameter:

    <choiceParameter>
      <name>ip</name>
      ...
      <optionList>
      </optionList>
    </choiceParameter>
    

    In any case, you could still use a packed script an unpack it manually under /tmp as explained here.

  • Avatar
    creamuser

    Well 1 I would like to add another code snippet to find ip address :

    proc ip:address {} { # find out localhost's IP address # courtesy David Gravereaux, Heribert Dahms set TheServer [socket -server none -myaddr [info hostname] 0] set MyIP [lindex [fconfigure $TheServer -sockname] 0] close $TheServer return $MyIP }

    you can also implement Ip-details.com to find your public ip address .

Please sign in to leave a comment.