From 099cacd3e388ecd2f26960b88168ce178af1ed30 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 20 May 2019 11:07:46 +0000 Subject: [PATCH] Installer: Fix -console install for izpack 5 (ticket #2492) Switch to izpack 5 for non-windows release installer --- build.properties | 2 + build.xml | 20 ++-- installer/install5.xml | 3 + installer/lib/izpack5/patches/java/build.xml | 65 +++++++++++ .../panels/xinfo/XInfoConsolePanel.java | 109 ++++++++++++++++++ 5 files changed, 192 insertions(+), 7 deletions(-) create mode 100644 installer/lib/izpack5/patches/java/build.xml create mode 100644 installer/lib/izpack5/patches/java/src/com/izforge/izpack/panels/xinfo/XInfoConsolePanel.java diff --git a/build.properties b/build.properties index 8d0b90f3c2..e7dc330351 100644 --- a/build.properties +++ b/build.properties @@ -36,6 +36,8 @@ sloccount.report.file=sloccount.sc # IzPack 5.1.x install dir # Default is $HOME/IzPack #izpack5.home=/PATH/TO/IzPack +# Default is 5.1.3 +#izpack5.version=5.1.3 # Change this to false if you don't have gettext or you want to prevent it from running during the build require.gettext=true diff --git a/build.xml b/build.xml index 27ad8784fa..6ae5d06bb0 100644 --- a/build.xml +++ b/build.xml @@ -1050,6 +1050,7 @@ + @@ -1091,6 +1092,7 @@ + - + @@ -1873,7 +1879,7 @@ - + @@ -1931,7 +1937,7 @@ - + @@ -2152,10 +2158,10 @@ - + diff --git a/installer/install5.xml b/installer/install5.xml index f6e3183553..d42720b3ac 100644 --- a/installer/install5.xml +++ b/installer/install5.xml @@ -136,6 +136,9 @@ https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491730/GUI+Preferences + + + diff --git a/installer/lib/izpack5/patches/java/build.xml b/installer/lib/izpack5/patches/java/build.xml new file mode 100644 index 0000000000..4b30018087 --- /dev/null +++ b/installer/lib/izpack5/patches/java/build.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installer/lib/izpack5/patches/java/src/com/izforge/izpack/panels/xinfo/XInfoConsolePanel.java b/installer/lib/izpack5/patches/java/src/com/izforge/izpack/panels/xinfo/XInfoConsolePanel.java new file mode 100644 index 0000000000..811d400d3a --- /dev/null +++ b/installer/lib/izpack5/patches/java/src/com/izforge/izpack/panels/xinfo/XInfoConsolePanel.java @@ -0,0 +1,109 @@ +/* + * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved. + * + * http://izpack.org/ + * http://izpack.codehaus.org/ + * + * Copyright 2002 Jan Blok + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.izforge.izpack.panels.xinfo; + +import java.util.Properties; + +import com.izforge.izpack.api.data.InstallData; +import com.izforge.izpack.api.resource.Resources; +import com.izforge.izpack.installer.console.AbstractConsolePanel; +import com.izforge.izpack.installer.console.ConsolePanel; +import com.izforge.izpack.installer.panel.PanelView; +import com.izforge.izpack.util.Console; + +/** + * Modified from HelloConsolePanel and XInfoPanel + * + * https://trac.i2p2.de/ticket/2492 + * https://izpack.atlassian.net/browse/IZPACK-1631 + */ +public class XInfoConsolePanel extends AbstractConsolePanel +{ + private final Resources resources; + + /** + * The info to display. + */ + private String info; + + /** + * Constructs an {@code XInfoConsolePanel}. + * + * @param panel the parent panel/view. May be {@code null} + */ + public XInfoConsolePanel(Resources resources, PanelView panel) + { + super(panel); + this.resources = resources; + } + + public boolean run(InstallData installData, Properties properties) + { + return true; + } + + /** + * Runs the panel using the specified console. + * + * @param installData the installation data + * @param console the console + * @return true if the panel ran successfully, otherwise false + */ + @Override + public boolean run(InstallData installData, Console console) + { + display(installData, console); + return promptEndPanel(installData, console); + } + + /** + * Loads the info text. + */ + private void loadInfo() + { + info = resources.getString("XInfoPanel.info", null, "Error : could not load the info text !"); + } + + /** + * Parses the text for special variables. + */ + private void parseText(InstallData installData) + { + // Parses the info text + info = installData.getVariables().replace(info); + } + + /** + * Displays the panel. + * + * @param installData the installation data + * @param console the console + */ + protected void display(InstallData installData, Console console) + { + // Text handling + loadInfo(); + parseText(installData); + // UI handling + console.println(info); + } +}