Fixed file eol-style problems as well as issues introduced in the
makesystem with the Windows Install check-in.
This commit is contained in:
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = ClientKeyStoreSetup.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = ClientKeystoreSetup
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = ClientKeystoreSetup.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = ClientKeystoreSetup
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = InitConfigFile.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = InitConfigFile
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = InitConfigFile.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = InitConfigFile
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,442 +1,442 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package InitConfigFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -1;
|
||||
final static int ERROR_MISSING_TEMPLATE = -3;
|
||||
final static int ERROR_MISSING_TEMPLATE_FILE = -8;
|
||||
final static int ERROR_OUTPUT_PROPERTY_MISSING = -9;
|
||||
final static int ERROR_OUTPUT_COPY_FAILED = -12;
|
||||
final static int ERROR_IO_EXCEPTION = -13;
|
||||
final static int ERROR_MISSING_PROPERTIES = -15;
|
||||
final static int ERROR_UNABLE_TO_READ_PROPERTIES = -16;
|
||||
final static int ERROR_PROPERTIES_FILE_IS_EMPTY = -17;
|
||||
final static int ERROR_MISSING_INSTALL_DIR = -18;
|
||||
final static int ERROR_INSTALL_DIR_NOT_A_DIR = -19;
|
||||
final static int ERROR_BAD_INSTALL_DIR_PARAM = -20;
|
||||
final static int ERROR_BAD_PROPERTY_FILE_PARAM = -21;
|
||||
final static int ERROR_MISSING_PROPERTIES_FILE = -22;
|
||||
final static int ERROR_MISSING_INSTALL_DIR_PARAM = -23;
|
||||
final static int ERROR_MISSING_PROPERTY_FILE_PARAM = -24;
|
||||
final static int ERROR_BAD_TEMPLATE_FILE_PARAM = -25;
|
||||
final static int ERROR_BAD_OUTPUT_FILE_PARAM = -26;
|
||||
final static int ERROR_MISSING_TEMPLATE_FILE_PARAM = -27;
|
||||
final static int ERROR_MISSING_OUTPUT_FILE_PARAM = -28;
|
||||
final static int ERROR_BAD_PROPERTY_PARAM = -29;
|
||||
|
||||
final static String TEMPLATE_FILE_PARAM = "template=";
|
||||
final static String OUTPUT_FILE_PARAM = "output=";
|
||||
final static String INSTALL_DIR_PARAM = "ATS_INSTALL_DIR=";
|
||||
final static String INSTALL_DIR_PROPERTY = "ATS_INSTALL_DIR";
|
||||
final static String PROPERTY_FILE_PARAM = "propertyfile=";
|
||||
|
||||
Properties properties;
|
||||
File fileProperties;
|
||||
FileInputStream fisProperties;
|
||||
File fileTemplate;
|
||||
File fileOutput;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
String[] rgsSearchFor;
|
||||
String[] rgsReplaceWith;
|
||||
String sInstallDir;
|
||||
String sTemplate;
|
||||
String sOutput;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
properties = new Properties();
|
||||
fileProperties = null;
|
||||
fisProperties = null;
|
||||
fileTemplate = null;
|
||||
fileOutput = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Process the properties
|
||||
if (ERROR_NO_ERROR == (rc = processProperties()))
|
||||
{
|
||||
rc = createOutputFile();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
String sProperties;
|
||||
File fileInstallDir = null;
|
||||
int i;
|
||||
int iEquals;
|
||||
String sKey;
|
||||
String sValue;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length < 3)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " +args[i]);
|
||||
|
||||
// is this the install dir param?
|
||||
if (args[i].startsWith(INSTALL_DIR_PARAM))
|
||||
{
|
||||
// Make sure it is more the the param tag
|
||||
if (args[i].length() <= INSTALL_DIR_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
sInstallDir = args[i].substring(INSTALL_DIR_PARAM.length()).trim();
|
||||
fileInstallDir = new File(sInstallDir);
|
||||
|
||||
// Make sure the install dir can be found
|
||||
if (!fileInstallDir.exists())
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR;
|
||||
}
|
||||
|
||||
// Make sure the install dir is a directory
|
||||
if (!fileInstallDir.isDirectory())
|
||||
{
|
||||
return ERROR_INSTALL_DIR_NOT_A_DIR;
|
||||
}
|
||||
|
||||
properties.setProperty(INSTALL_DIR_PROPERTY, sInstallDir);
|
||||
}
|
||||
|
||||
// is this the properties file param?
|
||||
else if (args[i].startsWith(PROPERTY_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= PROPERTY_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_PROPERTY_FILE_PARAM;
|
||||
}
|
||||
|
||||
sProperties = args[i].substring(PROPERTY_FILE_PARAM.length()).trim();
|
||||
fileProperties = new File(sProperties);
|
||||
|
||||
// Make sure the properties file can be found
|
||||
if (!fileProperties.exists())
|
||||
{
|
||||
return ERROR_MISSING_PROPERTIES_FILE;
|
||||
}
|
||||
|
||||
// Read the properties
|
||||
try
|
||||
{
|
||||
fisProperties = new FileInputStream(fileProperties);
|
||||
properties.load(fisProperties);
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
return ERROR_UNABLE_TO_READ_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(TEMPLATE_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= TEMPLATE_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_TEMPLATE_FILE_PARAM;
|
||||
}
|
||||
|
||||
sTemplate = args[i].substring(TEMPLATE_FILE_PARAM.length()).trim();
|
||||
fileTemplate = new File(sTemplate);
|
||||
|
||||
// Make sure the template file can be found
|
||||
if (!fileTemplate.exists())
|
||||
{
|
||||
log(ERROR_MISSING_TEMPLATE_FILE, sTemplate);
|
||||
return ERROR_MISSING_TEMPLATE_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(OUTPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= OUTPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sOutput = args[i].substring(OUTPUT_FILE_PARAM.length()).trim();
|
||||
fileOutput = new File(sOutput);
|
||||
}
|
||||
|
||||
// Handle additional parameters
|
||||
else
|
||||
{
|
||||
if (-1 == (iEquals = args[i].indexOf("=")) ||
|
||||
0 == iEquals ||
|
||||
args[i].length() == iEquals)
|
||||
{
|
||||
return ERROR_BAD_PROPERTY_PARAM;
|
||||
}
|
||||
sKey = args[i].substring(0, iEquals);
|
||||
sValue = args[i].substring(iEquals + 1);
|
||||
properties.setProperty(sKey, sValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an install dir
|
||||
if (null == fileInstallDir)
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got a template file
|
||||
if (null == fileTemplate)
|
||||
{
|
||||
return ERROR_MISSING_TEMPLATE_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got an output file
|
||||
if (null == fileOutput)
|
||||
{
|
||||
return ERROR_MISSING_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Note: the properties file parameter is optional
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int processProperties()
|
||||
{
|
||||
try
|
||||
{
|
||||
Enumeration e;
|
||||
String sKey;
|
||||
String sValue;
|
||||
int i = 0;
|
||||
|
||||
e = properties.propertyNames();
|
||||
|
||||
rgsSearchFor = new String[properties.size()];
|
||||
rgsReplaceWith = new String[properties.size()];
|
||||
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
sKey = (String)e.nextElement();
|
||||
sValue = (String)properties.get(sKey);
|
||||
|
||||
log("Property key = " + sKey + " Value = " + sValue);
|
||||
|
||||
rgsSearchFor[i] = sKey;
|
||||
rgsReplaceWith[i] = sValue;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
return -111;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createOutputFile()
|
||||
{
|
||||
LineNumberReader lnr = null;
|
||||
FileWriter fwOutput = null;
|
||||
String sLineTemplate;
|
||||
String sLineOutput;
|
||||
int iSearchFor;
|
||||
int i;
|
||||
|
||||
try
|
||||
{
|
||||
// Open the files
|
||||
lnr = new LineNumberReader(new FileReader(fileTemplate));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -40;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fwOutput = new FileWriter(fileOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -41;
|
||||
}
|
||||
try
|
||||
{
|
||||
// For each line of text in the template file...
|
||||
while (null != (sLineTemplate = lnr.readLine()))
|
||||
{
|
||||
sLineOutput = sLineTemplate;
|
||||
log("<-- " + sLineOutput);
|
||||
|
||||
// For each term to be replaced...
|
||||
for (i = 0; i < rgsSearchFor.length; i++)
|
||||
{
|
||||
log("searching for " + rgsSearchFor[i]);
|
||||
// Replace all instances of the term on the line
|
||||
while (-1 != (iSearchFor = sLineOutput.indexOf(rgsSearchFor[i])))
|
||||
{
|
||||
log("replacing " + rgsSearchFor[i] + " at position " + iSearchFor + " with " + rgsReplaceWith[i]);
|
||||
sLineOutput = sLineOutput.substring(0, iSearchFor) + rgsReplaceWith[i] +
|
||||
sLineOutput.substring(iSearchFor + rgsSearchFor[i].length());
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
fwOutput.write(sLineOutput + "\r\n");
|
||||
log("--> " + sLineOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -42;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
fwOutput.flush();
|
||||
fwOutput.close();
|
||||
lnr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_OUTPUT_COPY_FAILED;
|
||||
}
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 4 expected";
|
||||
break;
|
||||
case ERROR_MISSING_TEMPLATE:
|
||||
sMessage = "Template file not found";
|
||||
break;
|
||||
// case ERROR_TEMPLATE_PROPERTY_MISSING:
|
||||
// sMessage = "Template file parameter missing";
|
||||
// break;
|
||||
case ERROR_OUTPUT_PROPERTY_MISSING:
|
||||
sMessage = "Output file parameter missing";
|
||||
break;
|
||||
case ERROR_OUTPUT_COPY_FAILED:
|
||||
sMessage = "Unable to create output file";
|
||||
break;
|
||||
case ERROR_IO_EXCEPTION:
|
||||
sMessage = "IOException";
|
||||
break;
|
||||
case ERROR_MISSING_PROPERTIES:
|
||||
sMessage = "Properties file not found";
|
||||
break;
|
||||
case ERROR_UNABLE_TO_READ_PROPERTIES:
|
||||
sMessage = "Unable to read properties file";
|
||||
break;
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package InitConfigFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -1;
|
||||
final static int ERROR_MISSING_TEMPLATE = -3;
|
||||
final static int ERROR_MISSING_TEMPLATE_FILE = -8;
|
||||
final static int ERROR_OUTPUT_PROPERTY_MISSING = -9;
|
||||
final static int ERROR_OUTPUT_COPY_FAILED = -12;
|
||||
final static int ERROR_IO_EXCEPTION = -13;
|
||||
final static int ERROR_MISSING_PROPERTIES = -15;
|
||||
final static int ERROR_UNABLE_TO_READ_PROPERTIES = -16;
|
||||
final static int ERROR_PROPERTIES_FILE_IS_EMPTY = -17;
|
||||
final static int ERROR_MISSING_INSTALL_DIR = -18;
|
||||
final static int ERROR_INSTALL_DIR_NOT_A_DIR = -19;
|
||||
final static int ERROR_BAD_INSTALL_DIR_PARAM = -20;
|
||||
final static int ERROR_BAD_PROPERTY_FILE_PARAM = -21;
|
||||
final static int ERROR_MISSING_PROPERTIES_FILE = -22;
|
||||
final static int ERROR_MISSING_INSTALL_DIR_PARAM = -23;
|
||||
final static int ERROR_MISSING_PROPERTY_FILE_PARAM = -24;
|
||||
final static int ERROR_BAD_TEMPLATE_FILE_PARAM = -25;
|
||||
final static int ERROR_BAD_OUTPUT_FILE_PARAM = -26;
|
||||
final static int ERROR_MISSING_TEMPLATE_FILE_PARAM = -27;
|
||||
final static int ERROR_MISSING_OUTPUT_FILE_PARAM = -28;
|
||||
final static int ERROR_BAD_PROPERTY_PARAM = -29;
|
||||
|
||||
final static String TEMPLATE_FILE_PARAM = "template=";
|
||||
final static String OUTPUT_FILE_PARAM = "output=";
|
||||
final static String INSTALL_DIR_PARAM = "ATS_INSTALL_DIR=";
|
||||
final static String INSTALL_DIR_PROPERTY = "ATS_INSTALL_DIR";
|
||||
final static String PROPERTY_FILE_PARAM = "propertyfile=";
|
||||
|
||||
Properties properties;
|
||||
File fileProperties;
|
||||
FileInputStream fisProperties;
|
||||
File fileTemplate;
|
||||
File fileOutput;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
String[] rgsSearchFor;
|
||||
String[] rgsReplaceWith;
|
||||
String sInstallDir;
|
||||
String sTemplate;
|
||||
String sOutput;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
properties = new Properties();
|
||||
fileProperties = null;
|
||||
fisProperties = null;
|
||||
fileTemplate = null;
|
||||
fileOutput = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Process the properties
|
||||
if (ERROR_NO_ERROR == (rc = processProperties()))
|
||||
{
|
||||
rc = createOutputFile();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
String sProperties;
|
||||
File fileInstallDir = null;
|
||||
int i;
|
||||
int iEquals;
|
||||
String sKey;
|
||||
String sValue;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length < 3)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " +args[i]);
|
||||
|
||||
// is this the install dir param?
|
||||
if (args[i].startsWith(INSTALL_DIR_PARAM))
|
||||
{
|
||||
// Make sure it is more the the param tag
|
||||
if (args[i].length() <= INSTALL_DIR_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
sInstallDir = args[i].substring(INSTALL_DIR_PARAM.length()).trim();
|
||||
fileInstallDir = new File(sInstallDir);
|
||||
|
||||
// Make sure the install dir can be found
|
||||
if (!fileInstallDir.exists())
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR;
|
||||
}
|
||||
|
||||
// Make sure the install dir is a directory
|
||||
if (!fileInstallDir.isDirectory())
|
||||
{
|
||||
return ERROR_INSTALL_DIR_NOT_A_DIR;
|
||||
}
|
||||
|
||||
properties.setProperty(INSTALL_DIR_PROPERTY, sInstallDir);
|
||||
}
|
||||
|
||||
// is this the properties file param?
|
||||
else if (args[i].startsWith(PROPERTY_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= PROPERTY_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_PROPERTY_FILE_PARAM;
|
||||
}
|
||||
|
||||
sProperties = args[i].substring(PROPERTY_FILE_PARAM.length()).trim();
|
||||
fileProperties = new File(sProperties);
|
||||
|
||||
// Make sure the properties file can be found
|
||||
if (!fileProperties.exists())
|
||||
{
|
||||
return ERROR_MISSING_PROPERTIES_FILE;
|
||||
}
|
||||
|
||||
// Read the properties
|
||||
try
|
||||
{
|
||||
fisProperties = new FileInputStream(fileProperties);
|
||||
properties.load(fisProperties);
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
return ERROR_UNABLE_TO_READ_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(TEMPLATE_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= TEMPLATE_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_TEMPLATE_FILE_PARAM;
|
||||
}
|
||||
|
||||
sTemplate = args[i].substring(TEMPLATE_FILE_PARAM.length()).trim();
|
||||
fileTemplate = new File(sTemplate);
|
||||
|
||||
// Make sure the template file can be found
|
||||
if (!fileTemplate.exists())
|
||||
{
|
||||
log(ERROR_MISSING_TEMPLATE_FILE, sTemplate);
|
||||
return ERROR_MISSING_TEMPLATE_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(OUTPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= OUTPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sOutput = args[i].substring(OUTPUT_FILE_PARAM.length()).trim();
|
||||
fileOutput = new File(sOutput);
|
||||
}
|
||||
|
||||
// Handle additional parameters
|
||||
else
|
||||
{
|
||||
if (-1 == (iEquals = args[i].indexOf("=")) ||
|
||||
0 == iEquals ||
|
||||
args[i].length() == iEquals)
|
||||
{
|
||||
return ERROR_BAD_PROPERTY_PARAM;
|
||||
}
|
||||
sKey = args[i].substring(0, iEquals);
|
||||
sValue = args[i].substring(iEquals + 1);
|
||||
properties.setProperty(sKey, sValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an install dir
|
||||
if (null == fileInstallDir)
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got a template file
|
||||
if (null == fileTemplate)
|
||||
{
|
||||
return ERROR_MISSING_TEMPLATE_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got an output file
|
||||
if (null == fileOutput)
|
||||
{
|
||||
return ERROR_MISSING_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Note: the properties file parameter is optional
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int processProperties()
|
||||
{
|
||||
try
|
||||
{
|
||||
Enumeration e;
|
||||
String sKey;
|
||||
String sValue;
|
||||
int i = 0;
|
||||
|
||||
e = properties.propertyNames();
|
||||
|
||||
rgsSearchFor = new String[properties.size()];
|
||||
rgsReplaceWith = new String[properties.size()];
|
||||
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
sKey = (String)e.nextElement();
|
||||
sValue = (String)properties.get(sKey);
|
||||
|
||||
log("Property key = " + sKey + " Value = " + sValue);
|
||||
|
||||
rgsSearchFor[i] = sKey;
|
||||
rgsReplaceWith[i] = sValue;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
return -111;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createOutputFile()
|
||||
{
|
||||
LineNumberReader lnr = null;
|
||||
FileWriter fwOutput = null;
|
||||
String sLineTemplate;
|
||||
String sLineOutput;
|
||||
int iSearchFor;
|
||||
int i;
|
||||
|
||||
try
|
||||
{
|
||||
// Open the files
|
||||
lnr = new LineNumberReader(new FileReader(fileTemplate));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -40;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fwOutput = new FileWriter(fileOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -41;
|
||||
}
|
||||
try
|
||||
{
|
||||
// For each line of text in the template file...
|
||||
while (null != (sLineTemplate = lnr.readLine()))
|
||||
{
|
||||
sLineOutput = sLineTemplate;
|
||||
log("<-- " + sLineOutput);
|
||||
|
||||
// For each term to be replaced...
|
||||
for (i = 0; i < rgsSearchFor.length; i++)
|
||||
{
|
||||
log("searching for " + rgsSearchFor[i]);
|
||||
// Replace all instances of the term on the line
|
||||
while (-1 != (iSearchFor = sLineOutput.indexOf(rgsSearchFor[i])))
|
||||
{
|
||||
log("replacing " + rgsSearchFor[i] + " at position " + iSearchFor + " with " + rgsReplaceWith[i]);
|
||||
sLineOutput = sLineOutput.substring(0, iSearchFor) + rgsReplaceWith[i] +
|
||||
sLineOutput.substring(iSearchFor + rgsSearchFor[i].length());
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
fwOutput.write(sLineOutput + "\r\n");
|
||||
log("--> " + sLineOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -42;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
fwOutput.flush();
|
||||
fwOutput.close();
|
||||
lnr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_OUTPUT_COPY_FAILED;
|
||||
}
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 4 expected";
|
||||
break;
|
||||
case ERROR_MISSING_TEMPLATE:
|
||||
sMessage = "Template file not found";
|
||||
break;
|
||||
// case ERROR_TEMPLATE_PROPERTY_MISSING:
|
||||
// sMessage = "Template file parameter missing";
|
||||
// break;
|
||||
case ERROR_OUTPUT_PROPERTY_MISSING:
|
||||
sMessage = "Output file parameter missing";
|
||||
break;
|
||||
case ERROR_OUTPUT_COPY_FAILED:
|
||||
sMessage = "Unable to create output file";
|
||||
break;
|
||||
case ERROR_IO_EXCEPTION:
|
||||
sMessage = "IOException";
|
||||
break;
|
||||
case ERROR_MISSING_PROPERTIES:
|
||||
sMessage = "Properties file not found";
|
||||
break;
|
||||
case ERROR_UNABLE_TO_READ_PROPERTIES:
|
||||
sMessage = "Unable to read properties file";
|
||||
break;
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2006 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS = ClientKeystoreSetup InitConfigFile MungeCryptoPropertiesFilePath ServerKeystoreSetup UpdateWarFile server-java_msi
|
||||
|
||||
DIST_SUBDIRS = ClientKeystoreSetup InitConfigFile MungeCryptoPropertiesFilePath ServerKeystoreSetup UpdateWarFile server-java_msi
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall
|
||||
package package-clean package-install package-uninstall:
|
||||
$(MAKE) -C ClientKeystoreSetup $@
|
||||
$(MAKE) -C InitConfigFile $@
|
||||
$(MAKE) -C MungeCryptoPropertiesFilePath $@
|
||||
$(MAKE) -C ServerKeystoreSetup $@
|
||||
$(MAKE) -C UpdateWarFile $@
|
||||
$(MAKE) -C server-java_msi $@
|
||||
|
||||
clean-local:
|
||||
if [ -d lib ]; then rm -rf lib; fi
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
rm -f Makefile
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2006 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS = ClientKeystoreSetup InitConfigFile MungeCryptoPropertiesFilePath ServerKeystoreSetup UpdateWarFile server-java_msi
|
||||
|
||||
DIST_SUBDIRS = ClientKeystoreSetup InitConfigFile MungeCryptoPropertiesFilePath ServerKeystoreSetup UpdateWarFile server-java_msi
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall
|
||||
package package-clean package-install package-uninstall:
|
||||
$(MAKE) -C ClientKeystoreSetup $@
|
||||
$(MAKE) -C InitConfigFile $@
|
||||
$(MAKE) -C MungeCryptoPropertiesFilePath $@
|
||||
$(MAKE) -C ServerKeystoreSetup $@
|
||||
$(MAKE) -C UpdateWarFile $@
|
||||
$(MAKE) -C server-java_msi $@
|
||||
|
||||
clean-local:
|
||||
if [ -d lib ]; then rm -rf lib; fi
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
rm -f Makefile
|
||||
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = MungeCryptoPropertiesFilePath.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = MungeCryptoPropertiesFilePath
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = MungeCryptoPropertiesFilePath.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = MungeCryptoPropertiesFilePath
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,312 +1,312 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package MungeCryptoPropertiesFilePath;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -1;
|
||||
final static int ERROR_MISSING_INPUT_FILE = -2;
|
||||
final static int ERROR_OUTPUT_COPY_FAILED = -3;
|
||||
final static int ERROR_IO_EXCEPTION = -4;
|
||||
final static int ERROR_BAD_INPUT_FILE_PARAM = -5;
|
||||
final static int ERROR_BAD_OUTPUT_FILE_PARAM = -6;
|
||||
final static int ERROR_MISSING_INPUT_FILE_PARAM = -7;
|
||||
final static int ERROR_MISSING_OUTPUT_FILE_PARAM = -8;
|
||||
final static int ERROR_CANNOT_READ_FILE = -9;
|
||||
final static int ERROR_CANNOT_CREATE_FILE = -10;
|
||||
|
||||
final static String INPUT_FILE_PARAM = "input=";
|
||||
final static String OUTPUT_FILE_PARAM = "output=";
|
||||
final static String FILE_KEY = "org.apache.ws.security.crypto.merlin.file=";
|
||||
|
||||
File fileInput;
|
||||
File fileOutput;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
String sInput;
|
||||
String sOutput;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
fileInput = null;
|
||||
fileOutput = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test5.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Process the file
|
||||
rc = createOutputFile();
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length != 2)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " +args[i]);
|
||||
|
||||
if (args[i].startsWith(INPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= INPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sInput = args[i].substring(INPUT_FILE_PARAM.length()).trim();
|
||||
fileInput = new File(sInput);
|
||||
|
||||
// Make sure the input file can be found
|
||||
if (!fileInput.exists())
|
||||
{
|
||||
log(ERROR_MISSING_INPUT_FILE, sInput);
|
||||
return ERROR_MISSING_INPUT_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(OUTPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= OUTPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sOutput = args[i].substring(OUTPUT_FILE_PARAM.length()).trim();
|
||||
fileOutput = new File(sOutput);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an input file
|
||||
if (null == fileInput)
|
||||
{
|
||||
return ERROR_MISSING_INPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got an output file
|
||||
if (null == fileOutput)
|
||||
{
|
||||
return ERROR_MISSING_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createOutputFile()
|
||||
{
|
||||
LineNumberReader lnr = null;
|
||||
FileWriter fwOutput = null;
|
||||
String sLineTemplate;
|
||||
String sLineOutput;
|
||||
int iSearchFor;
|
||||
|
||||
try
|
||||
{
|
||||
// Open the file
|
||||
lnr = new LineNumberReader(new FileReader(fileInput));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_CANNOT_READ_FILE;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fwOutput = new FileWriter(fileOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_CANNOT_CREATE_FILE;
|
||||
}
|
||||
try
|
||||
{
|
||||
// For each line of text in the template file...
|
||||
while (null != (sLineTemplate = lnr.readLine()))
|
||||
{
|
||||
sLineOutput = sLineTemplate;
|
||||
log("<-- " + sLineOutput);
|
||||
|
||||
if (sLineOutput.trim().startsWith(FILE_KEY))
|
||||
{
|
||||
// Replace all instances of the line separator on the line
|
||||
while (-1 != (iSearchFor = sLineOutput.indexOf("\\")))
|
||||
{
|
||||
log("replacing \\ at position " + iSearchFor + " with //");
|
||||
sLineOutput = sLineOutput.substring(0, iSearchFor) + "//" +
|
||||
sLineOutput.substring(iSearchFor + 1);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
fwOutput.write(sLineOutput + "\r\n");
|
||||
log("--> " + sLineOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -42;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
fwOutput.flush();
|
||||
fwOutput.close();
|
||||
lnr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_OUTPUT_COPY_FAILED;
|
||||
}
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 2 expected";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_INPUT_FILE:
|
||||
sMessage = "Invalid number of parameters: 2 expected";
|
||||
break;
|
||||
|
||||
case ERROR_OUTPUT_COPY_FAILED:
|
||||
sMessage = "Unable to create output file";
|
||||
break;
|
||||
|
||||
case ERROR_IO_EXCEPTION:
|
||||
sMessage = "IOException";
|
||||
break;
|
||||
|
||||
case ERROR_BAD_INPUT_FILE_PARAM:
|
||||
sMessage = "Invalid input file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_BAD_OUTPUT_FILE_PARAM:
|
||||
sMessage = "Invalid output file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_INPUT_FILE_PARAM:
|
||||
sMessage = "Missing input file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_OUTPUT_FILE_PARAM:
|
||||
sMessage = "Missing output file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_CANNOT_READ_FILE:
|
||||
sMessage = "Cannot read file";
|
||||
break;
|
||||
|
||||
case ERROR_CANNOT_CREATE_FILE:
|
||||
sMessage = "Cannot create file";
|
||||
break;
|
||||
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package MungeCryptoPropertiesFilePath;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -1;
|
||||
final static int ERROR_MISSING_INPUT_FILE = -2;
|
||||
final static int ERROR_OUTPUT_COPY_FAILED = -3;
|
||||
final static int ERROR_IO_EXCEPTION = -4;
|
||||
final static int ERROR_BAD_INPUT_FILE_PARAM = -5;
|
||||
final static int ERROR_BAD_OUTPUT_FILE_PARAM = -6;
|
||||
final static int ERROR_MISSING_INPUT_FILE_PARAM = -7;
|
||||
final static int ERROR_MISSING_OUTPUT_FILE_PARAM = -8;
|
||||
final static int ERROR_CANNOT_READ_FILE = -9;
|
||||
final static int ERROR_CANNOT_CREATE_FILE = -10;
|
||||
|
||||
final static String INPUT_FILE_PARAM = "input=";
|
||||
final static String OUTPUT_FILE_PARAM = "output=";
|
||||
final static String FILE_KEY = "org.apache.ws.security.crypto.merlin.file=";
|
||||
|
||||
File fileInput;
|
||||
File fileOutput;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
String sInput;
|
||||
String sOutput;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
fileInput = null;
|
||||
fileOutput = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test5.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Process the file
|
||||
rc = createOutputFile();
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length != 2)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " +args[i]);
|
||||
|
||||
if (args[i].startsWith(INPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= INPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sInput = args[i].substring(INPUT_FILE_PARAM.length()).trim();
|
||||
fileInput = new File(sInput);
|
||||
|
||||
// Make sure the input file can be found
|
||||
if (!fileInput.exists())
|
||||
{
|
||||
log(ERROR_MISSING_INPUT_FILE, sInput);
|
||||
return ERROR_MISSING_INPUT_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[i].startsWith(OUTPUT_FILE_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= OUTPUT_FILE_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
sOutput = args[i].substring(OUTPUT_FILE_PARAM.length()).trim();
|
||||
fileOutput = new File(sOutput);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an input file
|
||||
if (null == fileInput)
|
||||
{
|
||||
return ERROR_MISSING_INPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
// Make sure we got an output file
|
||||
if (null == fileOutput)
|
||||
{
|
||||
return ERROR_MISSING_OUTPUT_FILE_PARAM;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createOutputFile()
|
||||
{
|
||||
LineNumberReader lnr = null;
|
||||
FileWriter fwOutput = null;
|
||||
String sLineTemplate;
|
||||
String sLineOutput;
|
||||
int iSearchFor;
|
||||
|
||||
try
|
||||
{
|
||||
// Open the file
|
||||
lnr = new LineNumberReader(new FileReader(fileInput));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_CANNOT_READ_FILE;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fwOutput = new FileWriter(fileOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_CANNOT_CREATE_FILE;
|
||||
}
|
||||
try
|
||||
{
|
||||
// For each line of text in the template file...
|
||||
while (null != (sLineTemplate = lnr.readLine()))
|
||||
{
|
||||
sLineOutput = sLineTemplate;
|
||||
log("<-- " + sLineOutput);
|
||||
|
||||
if (sLineOutput.trim().startsWith(FILE_KEY))
|
||||
{
|
||||
// Replace all instances of the line separator on the line
|
||||
while (-1 != (iSearchFor = sLineOutput.indexOf("\\")))
|
||||
{
|
||||
log("replacing \\ at position " + iSearchFor + " with //");
|
||||
sLineOutput = sLineOutput.substring(0, iSearchFor) + "//" +
|
||||
sLineOutput.substring(iSearchFor + 1);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
fwOutput.write(sLineOutput + "\r\n");
|
||||
log("--> " + sLineOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return -42;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
fwOutput.flush();
|
||||
fwOutput.close();
|
||||
lnr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ERROR_OUTPUT_COPY_FAILED;
|
||||
}
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 2 expected";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_INPUT_FILE:
|
||||
sMessage = "Invalid number of parameters: 2 expected";
|
||||
break;
|
||||
|
||||
case ERROR_OUTPUT_COPY_FAILED:
|
||||
sMessage = "Unable to create output file";
|
||||
break;
|
||||
|
||||
case ERROR_IO_EXCEPTION:
|
||||
sMessage = "IOException";
|
||||
break;
|
||||
|
||||
case ERROR_BAD_INPUT_FILE_PARAM:
|
||||
sMessage = "Invalid input file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_BAD_OUTPUT_FILE_PARAM:
|
||||
sMessage = "Invalid output file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_INPUT_FILE_PARAM:
|
||||
sMessage = "Missing input file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_MISSING_OUTPUT_FILE_PARAM:
|
||||
sMessage = "Missing output file parameter";
|
||||
break;
|
||||
|
||||
case ERROR_CANNOT_READ_FILE:
|
||||
sMessage = "Cannot read file";
|
||||
break;
|
||||
|
||||
case ERROR_CANNOT_CREATE_FILE:
|
||||
sMessage = "Cannot create file";
|
||||
break;
|
||||
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = ServerKeystoreSetup.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = ServerKeystoreSetup
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = ServerKeystoreSetup.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = ServerKeystoreSetup
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = UpdateWarFile.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = UpdateWarFile
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = UpdateWarFile.vjsproj Program.jsl
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = UpdateWarFile
|
||||
TARGET_FILE = $(PACKAGE).exe
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" ../server-java_msi/server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l bin/$(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,417 +1,417 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package UpdateWarFile;
|
||||
|
||||
import java.lang.Throwable;
|
||||
import java.lang.NullPointerException;
|
||||
import com.zerog.ia.api.pub.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.jar.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static String INSTALL_DIR_PARAM = "ATS_INSTALL_DIR=";
|
||||
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_IO_EXCEPTION = -1;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -2;
|
||||
final static int ERROR_BAD_INSTALL_DIR_PARAM = -3;
|
||||
final static int ERROR_MISSING_INSTALL_DIR = -4;
|
||||
final static int ERROR_INSTALL_DIR_NOT_A_DIR = -5;
|
||||
final static int ERROR_MISSING_INSTALL_DIR_PARAM = -6;
|
||||
final static int ERROR_WAR_TEMPLATE_FILE_MISSING = -7;
|
||||
final static int ERROR_NEW_JAR_CANNOT_BE_REPLACED = -8;
|
||||
final static int ERROR_JAR_COPY_FAILED = -9;
|
||||
final static int ERROR_CREATE_WAR_FILE_FAILED = -10;
|
||||
final static int ERROR_CREATE_WAR_FOS_FAILED = -11;
|
||||
final static int ERROR_OPEN_JAR_TEMPLATE_FAILED = -12;
|
||||
final static int ERROR_JOS_FLUSH_FAILED = -13;
|
||||
final static int ERROR_ADD_FILE_TO_JAR_FAILED = -14;
|
||||
final static int ERROR_JOS_CLOSE_FAILED = -15;
|
||||
final static int ERROR_FOS_CLOSE_FAILED = -16;
|
||||
final static int ERROR_JFTEMPLATE_CLOSE_FAILED = -17;
|
||||
|
||||
String sInstallDir;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
sInstallDir = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test3.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Create the modified war file
|
||||
rc = createWarFile();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
File fileInstallDir = null;
|
||||
int i;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length != 1)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " + args[i]);
|
||||
|
||||
// is this the install dir param?
|
||||
if (args[i].startsWith(INSTALL_DIR_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= INSTALL_DIR_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
sInstallDir = args[i].substring(INSTALL_DIR_PARAM.length()).trim();
|
||||
fileInstallDir = new File(sInstallDir);
|
||||
|
||||
// Make sure the install dir can be found
|
||||
if (!fileInstallDir.exists())
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR;
|
||||
}
|
||||
|
||||
// Make sure the install dir is a directory
|
||||
if (!fileInstallDir.isDirectory())
|
||||
{
|
||||
return ERROR_INSTALL_DIR_NOT_A_DIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an install dir
|
||||
if (null == fileInstallDir)
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createWarFile()
|
||||
{
|
||||
String sWarTemplate = sInstallDir + "ats\\etc\\svc\\templates\\CasaAuthTokenSvc.war";
|
||||
String sWarNew = sInstallDir + "ats\\catalinabase\\webapps\\CasaAuthTokenSvc.war";
|
||||
File fileWarTemplate = new File(sWarTemplate);;
|
||||
File fileWarNew = new File(sWarNew);
|
||||
FileOutputStream fosWarNew = null;
|
||||
ZipOutputStream josWarNew = null;
|
||||
ZipFile jfTemplate = null;
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
// Ensure that the war template exists
|
||||
log("looking for war template: " + sWarTemplate);
|
||||
if (!fileWarTemplate.exists())
|
||||
{
|
||||
rc = ERROR_WAR_TEMPLATE_FILE_MISSING;
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Ensure that the new jar name does not exist
|
||||
if (fileWarNew.exists())
|
||||
{
|
||||
log("war file already exists: " + sWarNew);
|
||||
if (!fileWarNew.delete())
|
||||
{
|
||||
log("could not delete war file: " + sWarNew);
|
||||
rc = ERROR_NEW_JAR_CANNOT_BE_REPLACED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Create/open the new jar
|
||||
try
|
||||
{
|
||||
log("create new war file output stream: " + sWarNew);
|
||||
fosWarNew = new FileOutputStream(fileWarNew);
|
||||
josWarNew = new ZipOutputStream(fosWarNew);
|
||||
}
|
||||
catch (IOException ioe0)
|
||||
{
|
||||
log(ioe0.toString());
|
||||
rc = ERROR_CREATE_WAR_FOS_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Open the old jar
|
||||
try
|
||||
{
|
||||
jfTemplate = new ZipFile(sWarTemplate);
|
||||
}
|
||||
catch (IOException ioe1)
|
||||
{
|
||||
rc = ERROR_OPEN_JAR_TEMPLATE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Transfer the files
|
||||
rc = moveFilesFromJarToJar(josWarNew, jfTemplate);
|
||||
}
|
||||
|
||||
// Add the files
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
int i;
|
||||
String [] rgsFilesToAdd = new String[1];
|
||||
rgsFilesToAdd[0] = sInstallDir + "ats\\etc\\svc\\templates\\crypto.properties";
|
||||
String [] rgsNames = new String[1];
|
||||
rgsNames[0] = "WEB-INF/classes/crypto.properties";
|
||||
for (i = 0; i < rgsFilesToAdd.length; i++)
|
||||
{
|
||||
log("Adding file: " + rgsFilesToAdd[i] + " with name " + rgsNames[i]);
|
||||
rc = addFileToJar(rgsFilesToAdd[i], rgsNames[i], josWarNew);
|
||||
}
|
||||
}
|
||||
|
||||
// Close up
|
||||
if (null != josWarNew)
|
||||
{
|
||||
try
|
||||
{
|
||||
josWarNew.flush();
|
||||
}
|
||||
catch (IOException ioe2)
|
||||
{
|
||||
rc = ERROR_JOS_FLUSH_FAILED;
|
||||
}
|
||||
try
|
||||
{
|
||||
josWarNew.close();
|
||||
}
|
||||
catch (IOException ioe3)
|
||||
{
|
||||
rc = ERROR_JOS_CLOSE_FAILED;
|
||||
}
|
||||
try
|
||||
{
|
||||
fosWarNew.close();
|
||||
}
|
||||
catch (IOException ioe4)
|
||||
{
|
||||
rc = ERROR_FOS_CLOSE_FAILED;
|
||||
}
|
||||
}
|
||||
if (null != jfTemplate)
|
||||
{
|
||||
try
|
||||
{
|
||||
jfTemplate.close();
|
||||
}
|
||||
catch (IOException ioe5)
|
||||
{
|
||||
rc = ERROR_JFTEMPLATE_CLOSE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int moveFilesFromJarToJar(ZipOutputStream josDst, ZipFile jfSrc)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
try
|
||||
{
|
||||
Enumeration entries = jfSrc.entries();
|
||||
ZipEntry jeLoop;
|
||||
InputStream isLoop;
|
||||
ZipEntry zeIndex;
|
||||
int bRead;
|
||||
byte [] b = new byte[4096];
|
||||
|
||||
while (entries.hasMoreElements())
|
||||
{
|
||||
jeLoop = (ZipEntry)entries.nextElement();
|
||||
|
||||
// Skip WEB-INF/classes/cypto.properties
|
||||
if (jeLoop.getName().equalsIgnoreCase("WEB-INF/classes/crypto.properties"))
|
||||
{
|
||||
log("skipping: " + "WEB-INF/classes/crypto.properties");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move the rest of the files over
|
||||
else
|
||||
{
|
||||
log("Transferring jar file: " + jeLoop.getName());
|
||||
|
||||
// Create the input stream
|
||||
isLoop = jfSrc.getInputStream(jeLoop);
|
||||
|
||||
// Set up the output stream
|
||||
zeIndex = new ZipEntry(jeLoop.getName());
|
||||
josDst.putNextEntry( zeIndex);
|
||||
|
||||
// Transfer the file contents
|
||||
while (-1 != (bRead = isLoop.read(b)))
|
||||
{
|
||||
josDst.write(b, 0, bRead);
|
||||
}
|
||||
|
||||
// all done
|
||||
josDst.closeEntry();
|
||||
isLoop.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
rc = ERROR_JAR_COPY_FAILED;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int addFileToJar(String sFilename, String sName, ZipOutputStream josJarNew)
|
||||
{
|
||||
FileInputStream fis;
|
||||
ZipEntry je;
|
||||
int bRead;
|
||||
byte [] b = new byte[4096];
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
try
|
||||
{
|
||||
// Create the input stream
|
||||
fis = new FileInputStream(sFilename);
|
||||
|
||||
// Set up the output stream
|
||||
je = new ZipEntry(sName);
|
||||
josJarNew.putNextEntry(je);
|
||||
|
||||
// Tansfer the contents of the file
|
||||
while (-1 != (bRead = fis.read(b)))
|
||||
{
|
||||
josJarNew.write(b, 0, bRead);
|
||||
}
|
||||
|
||||
// All done
|
||||
fis.close();
|
||||
josJarNew.closeEntry();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log(e.toString());
|
||||
rc = ERROR_ADD_FILE_TO_JAR_FAILED;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 4 expected";
|
||||
break;
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
package UpdateWarFile;
|
||||
|
||||
import java.lang.Throwable;
|
||||
import java.lang.NullPointerException;
|
||||
import com.zerog.ia.api.pub.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.jar.*;
|
||||
|
||||
/**
|
||||
* Summary description for Program
|
||||
*/
|
||||
public class Program
|
||||
{
|
||||
final static String INSTALL_DIR_PARAM = "ATS_INSTALL_DIR=";
|
||||
|
||||
final static int ERROR_NO_ERROR = 0;
|
||||
final static int ERROR_IO_EXCEPTION = -1;
|
||||
final static int ERROR_INVALID_NUMBER_OF_PARAMS = -2;
|
||||
final static int ERROR_BAD_INSTALL_DIR_PARAM = -3;
|
||||
final static int ERROR_MISSING_INSTALL_DIR = -4;
|
||||
final static int ERROR_INSTALL_DIR_NOT_A_DIR = -5;
|
||||
final static int ERROR_MISSING_INSTALL_DIR_PARAM = -6;
|
||||
final static int ERROR_WAR_TEMPLATE_FILE_MISSING = -7;
|
||||
final static int ERROR_NEW_JAR_CANNOT_BE_REPLACED = -8;
|
||||
final static int ERROR_JAR_COPY_FAILED = -9;
|
||||
final static int ERROR_CREATE_WAR_FILE_FAILED = -10;
|
||||
final static int ERROR_CREATE_WAR_FOS_FAILED = -11;
|
||||
final static int ERROR_OPEN_JAR_TEMPLATE_FAILED = -12;
|
||||
final static int ERROR_JOS_FLUSH_FAILED = -13;
|
||||
final static int ERROR_ADD_FILE_TO_JAR_FAILED = -14;
|
||||
final static int ERROR_JOS_CLOSE_FAILED = -15;
|
||||
final static int ERROR_FOS_CLOSE_FAILED = -16;
|
||||
final static int ERROR_JFTEMPLATE_CLOSE_FAILED = -17;
|
||||
|
||||
String sInstallDir;
|
||||
File file;
|
||||
FileWriter fw;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Program p = new Program(args);
|
||||
}
|
||||
|
||||
Program(String[] args)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
sInstallDir = null;
|
||||
|
||||
try
|
||||
{
|
||||
file = new File("c:\\test3.log");
|
||||
fw = new FileWriter(file);
|
||||
|
||||
log("Here we go: " + args.length);
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
log("Arg " + i + " = " + args[i]);
|
||||
}
|
||||
|
||||
// Process the arguments
|
||||
if (ERROR_NO_ERROR == (rc = processArgs(args)))
|
||||
{
|
||||
// Create the modified war file
|
||||
rc = createWarFile();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
rc = ERROR_IO_EXCEPTION;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
log("return code = " + rc);
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
int processArgs(String[] args)
|
||||
{
|
||||
File fileInstallDir = null;
|
||||
int i;
|
||||
|
||||
// Validate the number of parameters
|
||||
if (args.length != 1)
|
||||
{
|
||||
return ERROR_INVALID_NUMBER_OF_PARAMS;
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; i++)
|
||||
{
|
||||
log("arg[" + i + "] = " + args[i]);
|
||||
|
||||
// is this the install dir param?
|
||||
if (args[i].startsWith(INSTALL_DIR_PARAM))
|
||||
{
|
||||
// Make sure it is more than the param tag
|
||||
if (args[i].length() <= INSTALL_DIR_PARAM.length())
|
||||
{
|
||||
return ERROR_BAD_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
sInstallDir = args[i].substring(INSTALL_DIR_PARAM.length()).trim();
|
||||
fileInstallDir = new File(sInstallDir);
|
||||
|
||||
// Make sure the install dir can be found
|
||||
if (!fileInstallDir.exists())
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR;
|
||||
}
|
||||
|
||||
// Make sure the install dir is a directory
|
||||
if (!fileInstallDir.isDirectory())
|
||||
{
|
||||
return ERROR_INSTALL_DIR_NOT_A_DIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we got an install dir
|
||||
if (null == fileInstallDir)
|
||||
{
|
||||
return ERROR_MISSING_INSTALL_DIR_PARAM;
|
||||
}
|
||||
|
||||
return ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int createWarFile()
|
||||
{
|
||||
String sWarTemplate = sInstallDir + "ats\\etc\\svc\\templates\\CasaAuthTokenSvc.war";
|
||||
String sWarNew = sInstallDir + "ats\\catalinabase\\webapps\\CasaAuthTokenSvc.war";
|
||||
File fileWarTemplate = new File(sWarTemplate);;
|
||||
File fileWarNew = new File(sWarNew);
|
||||
FileOutputStream fosWarNew = null;
|
||||
ZipOutputStream josWarNew = null;
|
||||
ZipFile jfTemplate = null;
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
// Ensure that the war template exists
|
||||
log("looking for war template: " + sWarTemplate);
|
||||
if (!fileWarTemplate.exists())
|
||||
{
|
||||
rc = ERROR_WAR_TEMPLATE_FILE_MISSING;
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Ensure that the new jar name does not exist
|
||||
if (fileWarNew.exists())
|
||||
{
|
||||
log("war file already exists: " + sWarNew);
|
||||
if (!fileWarNew.delete())
|
||||
{
|
||||
log("could not delete war file: " + sWarNew);
|
||||
rc = ERROR_NEW_JAR_CANNOT_BE_REPLACED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Create/open the new jar
|
||||
try
|
||||
{
|
||||
log("create new war file output stream: " + sWarNew);
|
||||
fosWarNew = new FileOutputStream(fileWarNew);
|
||||
josWarNew = new ZipOutputStream(fosWarNew);
|
||||
}
|
||||
catch (IOException ioe0)
|
||||
{
|
||||
log(ioe0.toString());
|
||||
rc = ERROR_CREATE_WAR_FOS_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Open the old jar
|
||||
try
|
||||
{
|
||||
jfTemplate = new ZipFile(sWarTemplate);
|
||||
}
|
||||
catch (IOException ioe1)
|
||||
{
|
||||
rc = ERROR_OPEN_JAR_TEMPLATE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
// Transfer the files
|
||||
rc = moveFilesFromJarToJar(josWarNew, jfTemplate);
|
||||
}
|
||||
|
||||
// Add the files
|
||||
if (rc == ERROR_NO_ERROR)
|
||||
{
|
||||
int i;
|
||||
String [] rgsFilesToAdd = new String[1];
|
||||
rgsFilesToAdd[0] = sInstallDir + "ats\\etc\\svc\\templates\\crypto.properties";
|
||||
String [] rgsNames = new String[1];
|
||||
rgsNames[0] = "WEB-INF/classes/crypto.properties";
|
||||
for (i = 0; i < rgsFilesToAdd.length; i++)
|
||||
{
|
||||
log("Adding file: " + rgsFilesToAdd[i] + " with name " + rgsNames[i]);
|
||||
rc = addFileToJar(rgsFilesToAdd[i], rgsNames[i], josWarNew);
|
||||
}
|
||||
}
|
||||
|
||||
// Close up
|
||||
if (null != josWarNew)
|
||||
{
|
||||
try
|
||||
{
|
||||
josWarNew.flush();
|
||||
}
|
||||
catch (IOException ioe2)
|
||||
{
|
||||
rc = ERROR_JOS_FLUSH_FAILED;
|
||||
}
|
||||
try
|
||||
{
|
||||
josWarNew.close();
|
||||
}
|
||||
catch (IOException ioe3)
|
||||
{
|
||||
rc = ERROR_JOS_CLOSE_FAILED;
|
||||
}
|
||||
try
|
||||
{
|
||||
fosWarNew.close();
|
||||
}
|
||||
catch (IOException ioe4)
|
||||
{
|
||||
rc = ERROR_FOS_CLOSE_FAILED;
|
||||
}
|
||||
}
|
||||
if (null != jfTemplate)
|
||||
{
|
||||
try
|
||||
{
|
||||
jfTemplate.close();
|
||||
}
|
||||
catch (IOException ioe5)
|
||||
{
|
||||
rc = ERROR_JFTEMPLATE_CLOSE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int moveFilesFromJarToJar(ZipOutputStream josDst, ZipFile jfSrc)
|
||||
{
|
||||
int rc = ERROR_NO_ERROR;
|
||||
try
|
||||
{
|
||||
Enumeration entries = jfSrc.entries();
|
||||
ZipEntry jeLoop;
|
||||
InputStream isLoop;
|
||||
ZipEntry zeIndex;
|
||||
int bRead;
|
||||
byte [] b = new byte[4096];
|
||||
|
||||
while (entries.hasMoreElements())
|
||||
{
|
||||
jeLoop = (ZipEntry)entries.nextElement();
|
||||
|
||||
// Skip WEB-INF/classes/cypto.properties
|
||||
if (jeLoop.getName().equalsIgnoreCase("WEB-INF/classes/crypto.properties"))
|
||||
{
|
||||
log("skipping: " + "WEB-INF/classes/crypto.properties");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move the rest of the files over
|
||||
else
|
||||
{
|
||||
log("Transferring jar file: " + jeLoop.getName());
|
||||
|
||||
// Create the input stream
|
||||
isLoop = jfSrc.getInputStream(jeLoop);
|
||||
|
||||
// Set up the output stream
|
||||
zeIndex = new ZipEntry(jeLoop.getName());
|
||||
josDst.putNextEntry( zeIndex);
|
||||
|
||||
// Transfer the file contents
|
||||
while (-1 != (bRead = isLoop.read(b)))
|
||||
{
|
||||
josDst.write(b, 0, bRead);
|
||||
}
|
||||
|
||||
// all done
|
||||
josDst.closeEntry();
|
||||
isLoop.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
rc = ERROR_JAR_COPY_FAILED;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int addFileToJar(String sFilename, String sName, ZipOutputStream josJarNew)
|
||||
{
|
||||
FileInputStream fis;
|
||||
ZipEntry je;
|
||||
int bRead;
|
||||
byte [] b = new byte[4096];
|
||||
int rc = ERROR_NO_ERROR;
|
||||
|
||||
try
|
||||
{
|
||||
// Create the input stream
|
||||
fis = new FileInputStream(sFilename);
|
||||
|
||||
// Set up the output stream
|
||||
je = new ZipEntry(sName);
|
||||
josJarNew.putNextEntry(je);
|
||||
|
||||
// Tansfer the contents of the file
|
||||
while (-1 != (bRead = fis.read(b)))
|
||||
{
|
||||
josJarNew.write(b, 0, bRead);
|
||||
}
|
||||
|
||||
// All done
|
||||
fis.close();
|
||||
josJarNew.closeEntry();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log(e.toString());
|
||||
rc = ERROR_ADD_FILE_TO_JAR_FAILED;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void log(int err)
|
||||
{
|
||||
log(err, null);
|
||||
}
|
||||
|
||||
void log(int err, String s)
|
||||
{
|
||||
String sMessage = "";
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_NO_ERROR:
|
||||
sMessage = "No error";
|
||||
break;
|
||||
case ERROR_INVALID_NUMBER_OF_PARAMS:
|
||||
sMessage = "Invalid number of parameters: 4 expected";
|
||||
break;
|
||||
default:
|
||||
sMessage = "Unknown error: " + err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (null != s)
|
||||
{
|
||||
sMessage = sMessage + s;
|
||||
}
|
||||
log(sMessage);
|
||||
}
|
||||
|
||||
void log(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.write(this.getClass().getName() + ": " + s + "\r\n");
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = server-java_msi.vdproj
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = server-java_msi
|
||||
TARGET_FILE = $(PACKAGE).msi
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l $(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2004 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Greg Richardson <grichardson@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
EXTRA_DIST = server-java_msi.vdproj
|
||||
|
||||
if DEBUG
|
||||
TARGET_CFG = Debug
|
||||
else
|
||||
TARGET_CFG = Release
|
||||
endif
|
||||
|
||||
PACKAGE = server-java_msi
|
||||
TARGET_FILE = $(PACKAGE).msi
|
||||
LOG_FILE = $(PACKAGE).log
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall devenv
|
||||
|
||||
package: $(TARGET_FILE)
|
||||
|
||||
devenv:
|
||||
@if ! test -x "$(VSINSTALLDIR)/Common7/IDE/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi
|
||||
|
||||
$(TARGET_FILE): devenv
|
||||
@rm -f $(LOG_FILE) $@
|
||||
@CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \
|
||||
echo $$CMD; \
|
||||
if eval $$CMD; then \
|
||||
ls -l $(TARGET_CFG)/$(TARGET_FILE); \
|
||||
else \
|
||||
grep -a "ERROR:" $(LOG_FILE); \
|
||||
fi
|
||||
|
||||
package-clean clean-local:
|
||||
rm -rf Release/* Release Debug/* Debug*/Release */Debug *.log *.suo
|
||||
|
||||
clean:
|
||||
rm -rf Release/* Release Debug/* Debug */Release */Debug *.log *.suo
|
||||
|
||||
distclean-local: package-clean
|
||||
rm -f Makefile
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user