How do you pass command-line parameters to a .deb install package?

Comments

2 comments

  • Avatar
    wojciechka

    It is not possible to pass parameters when installing as .deb/.rpm file. Also, as the files are pre-packaged in the archive, it is not possible to change installation directory - what is provided as the default value for the project will always be used.

    InstallBuilder does not provide support for user interaction that rpm/dpkg interfaces provide. However, you can set environment variables and access them in the installer - for example:

    <postInstallationActionList>
      <setInstallerVariable>
        <name>remote_hostname</name>
        <value>${ENV(REMOTE_HOSTNAME)}</value>
        <ruleList>
          <compareTextLength>
            <length>0</length>
            <logic>does_not_equal</logic>
            <text>${ENV(REMOTE_HOSTNAME)}</text>
          </compareTextLength>
        </ruleList>
      </setInstallerVariable>
    </postInstallationActionList>
    

    This will set InstallBuilder's remote_hostname variable if environment variable REMOTE_HOSTNAME is set. You can then install it using:

    REMOTE_HOSTNAME=1.2.3.4 dpkg -i package.deb
    

    However, it is not something that can be relied upon not to change in the future and can mainly be used as a workaround.

  • Avatar
    Bhavesh Patel

    Try this code on Post-installation actons

    <runProgram>
    <program>dpkg</program>
    <programArguments>-i YorFile.deb</programArguments>
    <runAs>root</runAs>
    <useMSDOSPath>0</useMSDOSPath>
    <workingDirectory>YourApplicationPath</workingDirectory></runProgram>
    

Please sign in to leave a comment.