[izpack-user] Install using properties file.

388 views
Skip to first unread message

Maduri Narasimhan

unread,
Mar 6, 2014, 1:55:07 PM3/6/14
to us...@izpack.codehaus.org

Thanks Paul.

Another question related to Automated Installers. According to documentation -

 

java -jar myinstaller.jar -options-template myinstaller.properties

Generates a properties file myinstaller.properties with all user-changeable variables provided by my myinstaller. The property INSTALL_PATH is always exported. There will be only the property keys, the names are left empty and must be added manually.

What should the keys look like if I have to select/deselect packs? Looking at PacksConsolePanel.java, it seems to just return true. Is there implementation needed to deselect certain packs to install with a properties file?

public boolean run(InstallData installData, Properties properties)

    {

        return true;

    }

 

 

 

Thanks.

From: Paul Bors [mailto:pa...@bors.ws]
Sent: Friday, February 28, 2014 2:26 PM
To: us...@izpack.codehaus.org
Subject: Re: [izpack-user] PacksPanel not working.. and some other questions.

 

1.I have a targetPanel declared with a condition always evaluated to false, so it does not display to get around some other problems.

  However, my packspanel does not display. I do see an issue logged -http://jira.codehaus.org/browse/IZPACK-952.

Is there a workaround for the time being?

 

Since IZPACK-952 seems to be in your way, why not extend TargetPanel and in your implementation you make it show and navigate to the next panel. That way it will flash by quite fast. Although I don’t see why you would not allow the user verify what folder your application is being installed to.

 

2. I need to determine an unsupported platform(in my case 64 bit windows) and display a message (popup) to the user at some point – how can this be achieved?

 

Create your own custom condition if one of the build in izPack does not work for you. Simply check the windows registry for a x64 well known key and if it exits it must be a x64 then update your condition variable. Here’s an example on how to do this:

 

public class RegKeyCondition {

    private static final transient Logger logger = Logger.getLogger(RegKeyCondition.class.getName());

    

    public static String REG_KEY = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\bla\\bla\\bla\\";

    public static boolean regKeyExists = false;

    

    static {

        String regKeyValue = "";

        try {

            regKeyValue = RegistryUtil.regQuery(REG_KEY, null);

            regKeyExists = !regKeyValue.startsWith("ERROR");

        } catch(Throwable t) {

            if(Debug.isSTACKTRACE()) {

                t.printStackTrace();

            }

            regKeyExists = false;

            logger.warning("An error occurred while checking for the registry key " + t.getMessage());

        }

    }

}

 

Then in your install.xml you define the installer variable:

    <conditions>

        <condition type="java" id=“x64RegKeyCondition">

            <java>

                <class>com.mycomp.my.installer.package.conditions.RegKeyCondition</class>

                <field>regKeyExists</field>

            </java>

            <returnvalue type="boolean">true</returnvalue>

        </condition>

    </conditions>

 

Then use x64RegKeyCondition in your installer for whatever you need.

 

Hint: run “java -DTRACE=true -DDEBUG=true myInstaller.jar” to see the variables and the conditions tab.

 

3. I see the word “Izpack” being displayed on the title of the console, and as a footer (made with izpack), is there a way to get rid of this?

 

Yes, you need to create your own CustomLanguagePack.eng.xml and overrider the labels as you please. You need to do so for all the supported languages you want to use. Ie, override:

    <str id="installer.title" txt="Installation of "/>

    <str id="installer.madewith" txt="”/>

 

For more of those string, look over izPack’s source code and figure out what else you want to override.

 

4. I am also looking to enable silent install (i.e no GUI), is this possible?

 

Yes, izPack supports GUI, Automated installers (given the XML input) and CLI (command line, header less).

To do so, for each of your panels make sure you implement all the GUI, CLI and Auto interfaces.

Read more about it through the docs at:

 

 

On Feb 24, 2014, at 11:20 AM, Maduri Narasimhan <Maduri_N...@datacard.com> wrote:



No, it’s a dotnet application, and it has third party dependencies as well. Hence the restriction. Thanks much for your responses so far.

 

From: Paul Bors [mailto:pa...@bors.ws] 
Sent: Monday, February 24, 2014 10:17 AM
To: us...@izpack.codehaus.org
Subject: Re: [izpack-user] PacksPanel not working.. and some other questions.

 

Your application is not in Java?

As far as I recall the JVM is implemented on both x32 and x64…

 

~ Thank you,

   Paul Bors

 

On Feb 24, 2014, at 11:15 AM, Maduri Narasimhan <Maduri_N...@datacard.com> wrote:




There is a requirement to display a message on a 64 bit platform, as my application runs only on 32 bit. So I need to notify the user.

I do see with <os> tags , the installation of files can be controlled, but I need a proactive notification.

 

 

From: Paul Bors [mailto:pa...@bors.ws] 
Sent: Monday, February 24, 2014 9:53 AM
To: us...@izpack.codehaus.org
Subject: Re: [izpack-user] PacksPanel not working.. and some other questions.

 

What's the problem here? izPack 5.0 works fine on Windows x32 and x64.

 

What are you trying to do and what have you tried so far?

 

On Thu, Feb 20, 2014 at 3:14 PM, Maduri Narasimhan <Maduri_N...@datacard.com> wrote:

Hello,

 

I have a few questions -

1.I have a targetPanel declared with a condition always evaluated to false, so it does not display to get around some other problems.

  However, my packspanel does not display. I do see an issue logged -http://jira.codehaus.org/browse/IZPACK-952.

Is there a workaround for the time being?

 

2. I need to determine an unsupported platform(in my case 64 bit windows) and display a message (popup) to the user at some point – how can this be achieved?

3. I see the word “Izpack” being displayed on the title of the console, and as a footer (made with izpack), is there a way to get rid of this?

4. I am also looking to enable silent install (i.e no GUI), is this possible?

 

Izpack- 5.0

 

Thanks,

Maduri

 

Paul Bors

unread,
Mar 7, 2014, 2:29:47 PM3/7/14
to us...@izpack.codehaus.org
Do yourself a favor and create a simple installer (or in your own installer) use the FinishPanel.
It has a “Generate Auto-script” button on it which you can see it in action. It will write the XML you’re referring to to playback that installation you just went through.

Then you can look over the source code of it:

Fork or checkout the project and look over its code:

Make sure each of your custom panel has the GUI, CLI and Auto helper classes.
I normally delegate everything to the CLI and then call it from the GUI and Auto.

My auto panel helper will look like this:
    @Override
    public void runAutomated(InstallData installData, IXMLElement panelRoot) throws InstallerException {
        emitNotification("[ Starting <bla bla bla> ]");
        ***PanelConsoleHelper panelHelper = new ***PanelConsoleHelper();
        panelHelper.runConsole(installData);
        emitNotification("[ Ended <bla bla bla   ]");
    }

My GUI would look like:
@Override
    public void panelActivate() {
        super.panelActivate();
        // GUI STUFF
            new Thread(new Runnable() {
                public void run() {
                    try {
                        ***PanelConsoleHelper panelHelper = new ***PanelConsoleHelper();
                        panelHelper.runConsole(installData);
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                stopAction(false);
                            }
                        });
                    } catch(Exception e) {
                        if(Debug.isSTACKTRACE()) {
                            e.printStackTrace();
                        }
                        logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                stopAction(true);
                            }
                        });
                    }
                }
            }).start();
        }
    }

And finally the real implementation is at the CLI level:
public class ***PanelConsoleHelper extends AbstractPanelConsole {
    // More stuff
    public boolean runConsole(InstallData installData) {
        // Perform the actual work by reading the user input and other variables of the installData
    }
    // More stuff
}

For more examples, take a look at this:

Where UserInputPanel.java is the GUI that extends IzPanel, UserInputConsolePanel.java is the CLI one and of course UserInputPanelAutomationHelper.java is the Auto one.

Hope that helps.
~ Thank you,
   Paul Bors

Reply all
Reply to author
Forward
0 new messages