You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/03/07 14:28:34 UTC
svn commit: r634663 [1/2] - in
/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main:
java/org/apache/directory/daemon/installers/
java/org/apache/directory/daemon/installers/bin/
java/org/apache/directory/daemon/in...
Author: pamarcelot
Date: Fri Mar 7 05:28:32 2008
New Revision: 634663
URL: http://svn.apache.org/viewvc?rev=634663&view=rev
Log:
Added a complete Mac OS X package installer (bundled in a DMG).
Added small bricks for Binary and Debian installers (they need extra work).
Added:
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebTarget.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgInstallerCommand.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgTarget.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/functions.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/install.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/variables.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/control
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/DS_Store (with props)
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/Info.plist
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/License.rtf
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/apacheds-default.conf
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/apacheds-usr-bin.sh
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/apacheds.conf
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/apacheds.init
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/dmg-background.png (with props)
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/org.apache.directory.server.plist
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/pkg-background.tiff (with props)
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/postflight
Removed:
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/DebTarget.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/PkgTarget.java
Modified:
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
Modified: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java?rev=634663&r1=634662&r2=634663&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java (original)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java Fri Mar 7 05:28:32 2008
@@ -49,8 +49,8 @@
this.target = target;
initializeFiltering();
}
-
-
+
+
public Properties getFilterProperties()
{
return filterProperties;
@@ -118,8 +118,8 @@
{
try
{
- MojoHelperUtils.copyAsciiFile( mymojo, filterProperties,
- getClass().getResourceAsStream( "LICENSE" ), licenseTarget, false );
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "LICENSE" ),
+ licenseTarget, false );
}
catch ( IOException e )
{
@@ -167,17 +167,17 @@
}
// copy over the REQUIRED logger artifact
-/*
- try
- {
- FileUtils.copyFile( mymojo.getLogger().getFile(), layout.getLogger() );
- }
- catch ( IOException e )
- {
- throw new MojoFailureException( "Failed to copy logger.jar " + mymojo.getLogger().getFile()
- + " into position " + layout.getLogger() );
- }
-*/
+ /*
+ try
+ {
+ FileUtils.copyFile( mymojo.getLogger().getFile(), layout.getLogger() );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoFailureException( "Failed to copy logger.jar " + mymojo.getLogger().getFile()
+ + " into position " + layout.getLogger() );
+ }
+ */
// copy over the REQUIRED daemon.jar file
try
@@ -216,7 +216,7 @@
catch ( IOException e )
{
log.error( "Failed to copy logger configuration file " + target.getLoggerConfigurationFile()
- + " into position " + layout.getLoggerConfigurationFile(), e );
+ + " into position " + layout.getLoggerConfigurationFile(), e );
}
}
@@ -230,7 +230,7 @@
catch ( IOException e )
{
log.error( "Failed to copy server configuration file " + target.getServerConfigurationFile()
- + " into position " + layout.getConfigurationFile(), e );
+ + " into position " + layout.getConfigurationFile(), e );
}
}
@@ -238,81 +238,99 @@
// Copy Wrapper Files
// -------------------------------------------------------------------
- if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "i386" ) && target.getDaemonFramework().equals("tanuki"))
+ if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "i386" )
+ && target.getDaemonFramework().equals( "tanuki" ) )
{
try
{
MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-32" ),
- new File( layout.getBinDirectory(), target.getApplication().getName() ) );
- MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/lib/libwrapper-linux-x86-32.so" ),
- new File( layout.getLibDirectory(), "libwrapper.so" ) );
+ new File( layout.getBinDirectory(), target.getApplication().getName() ) );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+ "wrapper/lib/libwrapper-linux-x86-32.so" ), new File( layout.getLibDirectory(), "libwrapper.so" ) );
}
catch ( IOException e )
{
- throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories");
+ throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories" );
}
}
-
- if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "x86_64" ) && target.getDaemonFramework().equals("tanuki"))
+ if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "x86_64" )
+ && target.getDaemonFramework().equals( "tanuki" ) )
{
try
{
MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-64" ),
- new File( layout.getBinDirectory(), target.getApplication().getName() ) );
- MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/lib/libwrapper-linux-x86-64.so" ),
- new File( layout.getLibDirectory(), "libwrapper.so" ) );
+ new File( layout.getBinDirectory(), target.getApplication().getName() ) );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+ "wrapper/lib/libwrapper-linux-x86-64.so" ), new File( layout.getLibDirectory(), "libwrapper.so" ) );
}
catch ( IOException e )
{
- throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories");
+ throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories" );
}
}
- // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()
- if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "sparc" ) )
+ if ( target.getOsName().equalsIgnoreCase( "mac os x" ) && target.getDaemonFramework().equals( "tanuki" ) )
{
- File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
try
{
- MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_sparc" ), executable );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+ "wrapper/bin/wrapper-macosx-universal-32" ), new File( layout.getBinDirectory(), target
+ .getApplication().getName() ) );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+ "wrapper/lib/libwrapper-macosx-universal-32.jnilib" ), new File( layout.getLibDirectory(),
+ "libwrapper.jnilib" ) );
}
catch ( IOException e )
{
- throw new MojoFailureException( "Failed to copy jsvc executable file "
- + getClass().getResource( "jsvc_solaris_sparc" ) + " into position " + executable.getAbsolutePath() );
+ throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories" );
}
}
- if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "i386" ) )
+ // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()
+ if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "sparc" ) )
{
File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
try
{
- MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_i386" ), executable );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_sparc" ), executable );
}
catch ( IOException e )
{
throw new MojoFailureException( "Failed to copy jsvc executable file "
- + getClass().getResource( "jsvc_solaris_i386" ) + " into position " + executable.getAbsolutePath() );
+ + getClass().getResource( "jsvc_solaris_sparc" ) + " into position " + executable.getAbsolutePath() );
}
}
- // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()
- if ( target.getOsName().equals( "macosx" ) && target.getOsArch().equals( "ppc" ) )
+ if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "i386" ) )
{
File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
try
{
- MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_macosx_ppc" ), executable );
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_i386" ), executable );
}
catch ( IOException e )
{
throw new MojoFailureException( "Failed to copy jsvc executable file "
- + getClass().getResource( "jsvc_macosx_ppc" ) + " into position " + executable.getAbsolutePath() );
+ + getClass().getResource( "jsvc_solaris_i386" ) + " into position " + executable.getAbsolutePath() );
}
}
+ // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()
+ // if ( target.getOsName().equals( "macosx" ) && target.getOsArch().equals( "ppc" ) )
+ // {
+ // File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
+ // try
+ // {
+ // MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_macosx_ppc" ), executable );
+ // }
+ // catch ( IOException e )
+ // {
+ // throw new MojoFailureException( "Failed to copy jsvc executable file "
+ // + getClass().getResource( "jsvc_macosx_ppc" ) + " into position " + executable.getAbsolutePath() );
+ // }
+ // }
+
target.setLibArtifacts( MojoHelperUtils.copyDependencies( mymojo, layout ) );
// -- copy sources if set --
@@ -360,10 +378,10 @@
catch ( IOException e )
{
log.error( "Failed to notice file " + noticeFile.getAbsolutePath() + " into position "
- + noticeFileTarget.getAbsolutePath(), e );
+ + noticeFileTarget.getAbsolutePath(), e );
}
}
-
+
processPackagedFiles( target, mymojo.getPackagedFiles() );
}
}
Modified: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java?rev=634663&r1=634662&r2=634663&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java (original)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java Fri Mar 7 05:28:32 2008
@@ -139,7 +139,7 @@
mymojo.getLog().info( " Including artifacts: " );
mymojo.getLog().info( " -------------------" );
Iterator artifacts = mymojo.getProject().getRuntimeArtifacts().iterator();
-
+
while ( artifacts.hasNext() )
{
artifact = ( Artifact ) artifacts.next();
@@ -237,6 +237,34 @@
{
throw new MojoFailureException( "Execution of '" + cmdString + "' resulted in a non-zero exit value: "
+ task.getExitValue() );
+ }
+ }
+
+
+ /**
+ * Recursively copy files from the given source to the given destination.
+ *
+ * @param src
+ * the source
+ * @param dest
+ * the destination
+ * @throws IOException
+ * If an error occurs when copying a file
+ */
+ public static void copyFiles( File src, File dest ) throws IOException
+ {
+ if ( src.isDirectory() )
+ {
+ dest.mkdirs();
+
+ for ( File file : src.listFiles() )
+ {
+ copyFiles( file, new File( dest, file.getName() ) );
+ }
+ }
+ else
+ {
+ FileUtils.copyFile( src, dest );
}
}
}
Modified: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java?rev=634663&r1=634662&r2=634663&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java (original)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java Fri Mar 7 05:28:32 2008
@@ -28,15 +28,20 @@
import java.util.List;
import java.util.Set;
+import org.apache.directory.daemon.installers.bin.BinInstallerCommand;
+import org.apache.directory.daemon.installers.bin.BinTarget;
+import org.apache.directory.daemon.installers.deb.DebInstallerCommand;
+import org.apache.directory.daemon.installers.deb.DebTarget;
import org.apache.directory.daemon.installers.inno.InnoInstallerCommand;
import org.apache.directory.daemon.installers.inno.InnoTarget;
import org.apache.directory.daemon.installers.izpack.IzPackInstallerCommand;
import org.apache.directory.daemon.installers.izpack.IzPackTarget;
+import org.apache.directory.daemon.installers.nsis.NsisInstallerCommand;
+import org.apache.directory.daemon.installers.nsis.NsisTarget;
+import org.apache.directory.daemon.installers.pkg.PkgInstallerCommand;
+import org.apache.directory.daemon.installers.pkg.PkgTarget;
import org.apache.directory.daemon.installers.rpm.RpmInstallerCommand;
import org.apache.directory.daemon.installers.rpm.RpmTarget;
-import org.apache.directory.daemon.installers.nsis.NsisTarget;
-import org.apache.directory.daemon.installers.nsis.NsisInstallerCommand;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Developer;
import org.apache.maven.model.MailingList;
@@ -118,6 +123,11 @@
* @parameter
*/
private DebTarget[] debTargets;
+
+ /**
+ * @parameter
+ */
+ private BinTarget[] binTargets;
/**
* @parameter
@@ -250,6 +260,27 @@
rpmCmd = new RpmInstallerCommand( this, ( RpmTarget ) target );
rpmCmd.execute();
}
+
+ if ( target instanceof PkgTarget )
+ {
+ PkgInstallerCommand pkgCmd = null;
+ pkgCmd = new PkgInstallerCommand( this, ( PkgTarget ) target );
+ pkgCmd.execute();
+ }
+
+ if ( target instanceof DebTarget )
+ {
+ DebInstallerCommand debCmd = null;
+ debCmd = new DebInstallerCommand( this, ( DebTarget ) target );
+ debCmd.execute();
+ }
+
+ if ( target instanceof BinTarget )
+ {
+ BinInstallerCommand binCmd = null;
+ binCmd = new BinInstallerCommand( this, ( BinTarget ) target );
+ binCmd.execute();
+ }
}
}
@@ -263,6 +294,7 @@
addAll( allTargets, rpmTargets );
addAll( allTargets, debTargets );
addAll( allTargets, pkgTargets );
+ addAll( allTargets, binTargets );
}
@@ -538,7 +570,7 @@
getLog().info( "daemonFramework: " + target.getDaemonFramework() );
getLog().info( "loggerConfigurationFile: " + target.getLoggerConfigurationFile() );
getLog().info( "bootstrapperConfigurationFiles: " + target.getBootstrapperConfigurationFile() );
- getLog().info( "serverConfigurationFil: " + target.getServerConfigurationFile() );
+ getLog().info( "serverConfigurationFile: " + target.getServerConfigurationFile() );
}
}
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.bin;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.MojoHelperUtils;
+import org.apache.directory.daemon.installers.ServiceInstallersMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.codehaus.plexus.util.FileUtils;
+
+
+/**
+ * Bin (Binary) Installer command for Linux.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 434414 $
+ */
+public class BinInstallerCommand extends MojoCommand
+{
+ private final Properties filterProperties = new Properties( System.getProperties() );
+ /** The PKG target */
+ private final BinTarget target;
+ /** The Maven logger */
+ private final Log log;
+ /** The sh utility executable */
+ private File shUtility = new File( "/bin/sh" );
+
+
+ /**
+ * Creates a new instance of BinInstallerCommand.
+ *
+ * @param mymojo
+ * the Server Installers Mojo
+ * @param target
+ * the Bin target
+ */
+ public BinInstallerCommand( ServiceInstallersMojo mymojo, BinTarget target )
+ {
+ super( mymojo );
+ this.target = target;
+ this.log = mymojo.getLog();
+ initializeFiltering();
+ }
+
+
+ /**
+ * Performs the following:
+ * <ol>
+ * <li>Bail if target is not for Linux</li>
+ * <li>Creates the Mac OS X PKG Installer for Apache DS</li>
+ * <li>Package it in a Mac OS X DMG (Disk iMaGe)</li>
+ * </ol>
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ // Verifying the target is macosx
+ if ( !target.getOsFamily().equals( "linux" ) )
+ {
+ log.warn( "Bin installer can only be targeted for linux platforms!" );
+ log.warn( "The build will continue, but please check the the platform of this installer " );
+ log.warn( "target" );
+ return;
+ }
+
+ // Verifying the hdiutil utility exists
+ if ( !shUtility.exists() )
+ {
+ log.warn( "Cannot find sh utility at this location: " + shUtility );
+ log.warn( "The build will continue, but please check the location of your sh " );
+ log.warn( "utility." );
+ return;
+ }
+
+ File baseDirectory = target.getLayout().getBaseDirectory();
+ File imagesDirectory = baseDirectory.getParentFile();
+
+ log.info( "Creating Bin Installer..." );
+
+ // Creating the package directory
+ File binDirectory = new File( imagesDirectory, target.getId() + "-bin" );
+ binDirectory.mkdirs();
+
+ log.info( "Copying Bin installer files" );
+
+ // Copying the apacheds files in the root directory
+ File binRootDirectory = new File( binDirectory, "root" );
+ try
+ {
+ copyFiles( baseDirectory, binRootDirectory );
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy image (" + target.getLayout().getBaseDirectory()
+ + ") to the Bin directory (" + binRootDirectory + ")" );
+ }
+
+ // Create sh directory
+ File binShDirectory = new File( binDirectory, "sh" );
+ binShDirectory.mkdirs();
+
+ // Copying the resources files
+ try
+ {
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "bootstrap.sh" ), new File( binDirectory,
+ "bootstrap.sh" ) );
+
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+ "createInstaller.sh" ), new File( binDirectory, "createInstaller.sh" ), true );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "functions.sh" ), new File( binShDirectory,
+ "functions.sh" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "install.sh" ), new File( binShDirectory,
+ "install.sh" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "variables.sh" ), new File( binShDirectory,
+ "variables.sh" ) );
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy Bin resources files." );
+ }
+
+ // Generating the Bin
+ log.info( "Generating Bin Installer" );
+ Execute createBinTask = new Execute();
+ String[] cmd = new String[]
+ { shUtility.getAbsolutePath(), "createInstaller.sh" };
+ createBinTask.setCommandline( cmd );
+ createBinTask.setSpawn( true );
+ createBinTask.setWorkingDirectory( binDirectory );
+ try
+ {
+ createBinTask.execute();
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed while trying to generate the Bin: " + e.getMessage() );
+ }
+
+ log.info( "Bin Installer generated at " + new File( imagesDirectory, target.getFinalName() + ".bin" ) );
+ }
+
+
+ /**
+ * Recursively copy files from the given source to the given destination.
+ *
+ * @param src
+ * the source
+ * @param dest
+ * the destination
+ * @throws IOException
+ * If an error occurs when copying a file
+ */
+ public void copyFiles( File src, File dest ) throws IOException
+ {
+ if ( src.isDirectory() )
+ {
+ dest.mkdirs();
+
+ for ( File file : src.listFiles() )
+ {
+ copyFiles( file, new File( dest, file.getName() ) );
+ }
+ }
+ else
+ {
+ FileUtils.copyFile( src, dest );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+ */
+ public Properties getFilterProperties()
+ {
+ return filterProperties;
+ }
+
+
+ private void initializeFiltering()
+ {
+ filterProperties.putAll( mymojo.getProject().getProperties() );
+ filterProperties.put( "tmpArchive", "__tmp.tar.gz" );
+ filterProperties.put( "finalName", target.getFinalName() );
+ }
+}
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.bin;
+
+
+import org.apache.directory.daemon.installers.Target;
+
+
+/**
+ * A Bin installer for the Linux platform.
+ *
+ * To create a Bin installer we use the shell (SH) utility that is bundled
+ * in every Linux.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BinTarget extends Target
+{
+ /** The wrapper executable path */
+ private String wrapperExecutablePath = "src/main/installers/wrapper/bin/wrapper-windows-x86-32.exe";
+
+
+ /**
+ * Gets the Wrapper executable path.
+ *
+ * @return
+ * the wrapper executable path
+ */
+ public String getWrapperExecutablePath()
+ {
+ return wrapperExecutablePath;
+ }
+
+
+ /**
+ * Sets the Wrapper executable path.
+ *
+ * @param wrapperExecutablePath
+ * the wrapper executable path
+ */
+ public void setWrapperExecutablePath( String wrapperExecutablePath )
+ {
+ this.wrapperExecutablePath = wrapperExecutablePath;
+ }
+}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.deb;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.MojoHelperUtils;
+import org.apache.directory.daemon.installers.ServiceInstallersMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.tools.ant.taskdefs.Execute;
+
+
+/**
+ * Nullsoft INstaller System (NSIS) Installer command for Windows installers
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 434414 $
+ */
+public class DebInstallerCommand extends MojoCommand
+{
+ private final Properties filterProperties = new Properties( System.getProperties() );
+ /** The Deb target */
+ private final DebTarget target;
+ /** The Maven logger */
+ private final Log log;
+ /** The dpkg utility*/
+ private File dpkgUtility;
+
+
+ /**
+ * Creates a new instance of DebInstallerCommand.
+ *
+ * @param mymojo
+ * the Server Installers Mojo
+ * @param target
+ * the DEB target
+ */
+ public DebInstallerCommand( ServiceInstallersMojo mymojo, DebTarget target )
+ {
+ super( mymojo );
+ this.target = target;
+ this.log = mymojo.getLog();
+ }
+
+
+ /**
+ * Performs the following:
+ * <ol>
+ * <li>Bail if target is not for linux or the dpkg utility could not be found.</li>
+ * <li>Creates the Debian DEB package for Apache DS</li>
+ * </ol>
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ // Verifying the target is linux
+ if ( !target.getOsFamily().equals( "linux" ) )
+ {
+ log.warn( "DEB package installer can only be targeted for Linux platforms!" );
+ log.warn( "The build will continue, but please check the the platform of this installer " );
+ log.warn( "target" );
+ return;
+ }
+
+ // Verifying the dpkg utility exists
+ if ( !target.getDpkgUtility().exists() )
+ {
+ log.warn( "Cannot find dpkg utility at this location: " + target.getDpkgUtility() );
+ log.warn( "The build will continue, but please check the location of your dpkg " );
+ log.warn( "utility." );
+ return;
+ }
+ else
+ {
+ dpkgUtility = target.getDpkgUtility();
+ }
+
+ File baseDirectory = target.getLayout().getBaseDirectory();
+ File imagesDirectory = baseDirectory.getParentFile();
+
+ log.info( "Creating Debian DEB Package..." );
+
+ // Creating the package directory
+ File debDirectory = new File( imagesDirectory, target.getId() + "-deb" );
+ debDirectory.mkdirs();
+
+ log.info( "Copying DEB Package files" );
+
+ // Copying the apacheds files in the '/usr/local/apacheds' directory
+ File debApacheDsDirectory = new File( debDirectory, "usr/local/apacheds" );
+ try
+ {
+ MojoHelperUtils.copyFiles( baseDirectory, debApacheDsDirectory );
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy image (" + target.getLayout().getBaseDirectory()
+ + ") to the DEB directory (" + debApacheDsDirectory + ")" );
+ }
+
+ // Create DEBIAN directory
+ File debDebianDirectory = new File( debDirectory, "DEBIAN" );
+ debDebianDirectory.mkdirs();
+
+ // Copying the 'control' file
+ try
+ {
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "control" ),
+ new File( debDebianDirectory, "control" ), true );
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy DEB 'control' file." );
+ }
+
+ // Generating the DEB
+ log.info( "Generating Debian DEB Package" );
+ Execute createDebTask = new Execute();
+ String[] cmd = new String[]
+ { dpkgUtility.getAbsolutePath(), "-b", target.getId() + "-deb", target.getFinalName() + ".deb" };
+ createDebTask.setCommandline( cmd );
+ createDebTask.setSpawn( true );
+ createDebTask.setWorkingDirectory( imagesDirectory );
+ try
+ {
+ createDebTask.execute();
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed while trying to generate the DEB package: " + e.getMessage() );
+ }
+
+ log.info( "Debian DEB package generated at " + new File( imagesDirectory, target.getFinalName() + ".deb" ) );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+ */
+ public Properties getFilterProperties()
+ {
+ return filterProperties;
+ }
+}
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebTarget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebTarget.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebTarget.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebTarget.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.deb;
+
+
+import java.io.File;
+
+import org.apache.directory.daemon.installers.Target;
+
+
+/**
+ * A Deb package for the Debian platform.
+ *
+ * To create a Deb package we use the dpkg utility that is bundled in the
+ * Debian operating system.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DebTarget extends Target
+{
+ /** The wrapper executable path */
+ private String wrapperExecutablePath = "src/main/installers/wrapper/bin/wrapper-windows-x86-32.exe";
+ /** The PackageMaker utility executable */
+ private File dpkgUtility = new File( "/usr/bin/dpkg" );
+
+
+ /**
+ * Gets the dpkg utility.
+ *
+ * @return
+ * the dpkg utility
+ */
+ public File getDpkgUtility()
+ {
+ return dpkgUtility;
+ }
+
+
+ /**
+ * Gets the Wrapper executable path.
+ *
+ * @return
+ * the wrapper executable path
+ */
+ public String getWrapperExecutablePath()
+ {
+ return wrapperExecutablePath;
+ }
+
+
+ /**
+ * Sets the dpkg utility.
+ *
+ * @param dpkgUtility
+ * the dpkg utility
+ */
+ public void setDpkgUtility( File dpkgUtility )
+ {
+ this.dpkgUtility = dpkgUtility;
+ }
+
+
+ /**
+ * Sets the Wrapper executable path.
+ *
+ * @param wrapperExecutablePath
+ * the wrapper executable path
+ */
+ public void setWrapperExecutablePath( String wrapperExecutablePath )
+ {
+ this.wrapperExecutablePath = wrapperExecutablePath;
+ }
+}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgInstallerCommand.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgInstallerCommand.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgInstallerCommand.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,333 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.pkg;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.MojoHelperUtils;
+import org.apache.directory.daemon.installers.ServiceInstallersMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.tools.ant.taskdefs.Execute;
+
+
+/**
+ * PKG Installer command for creating Mac OS X packages.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 434414 $
+ */
+public class PkgInstallerCommand extends MojoCommand
+{
+ private final Properties filterProperties = new Properties( System.getProperties() );
+ /** The PKG target */
+ private final PkgTarget target;
+ /** The Maven logger */
+ private final Log log;
+ /** The PackageMaker utility executable */
+ private File packageMakerUtility;
+ /** The hdiutil utility executable */
+ private File hdiutilUtility = new File( "/usr/bin/hdiutil" );
+
+
+ /**
+ * Creates a new instance of PkgInstallerCommand.
+ *
+ * @param mymojo
+ * the Server Installers Mojo
+ * @param target
+ * the PKG target
+ */
+ public PkgInstallerCommand( ServiceInstallersMojo mymojo, PkgTarget target )
+ {
+ super( mymojo );
+ this.target = target;
+ this.log = mymojo.getLog();
+ initializeFiltering();
+ }
+
+
+ /**
+ * Performs the following:
+ * <ol>
+ * <li>Bail if target is not for macosx or the PackageMaker or hdiutil utilities coud not be found.</li>
+ * <li>Creates the Mac OS X PKG Installer for Apache DS</li>
+ * <li>Package it in a Mac OS X DMG (Disk iMaGe)</li>
+ * </ol>
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ // Verifying the target is macosx
+ if ( !target.getOsFamily().equals( "macosx" ) )
+ {
+ log.warn( "PKG installer can only be targeted for Mac OS X platforms!" );
+ log.warn( "The build will continue, but please check the the platform of this installer " );
+ log.warn( "target" );
+ return;
+ }
+
+ // Verifying the PackageMaker utility exists
+ if ( !target.getPackageMakerUtility().exists() )
+ {
+ log.warn( "Cannot find PackageMaker utility at this location: " + target.getPackageMakerUtility() );
+ log.warn( "The build will continue, but please check the location of your Package Maker " );
+ log.warn( "utility." );
+ return;
+ }
+ else
+ {
+ packageMakerUtility = target.getPackageMakerUtility();
+ }
+
+ // Verifying the hdiutil utility exists
+ if ( !hdiutilUtility.exists() )
+ {
+ log.warn( "Cannot find hdiutil utility at this location: " + hdiutilUtility );
+ log.warn( "The build will continue, but please check the location of your hdiutil " );
+ log.warn( "utility." );
+ return;
+ }
+
+ File baseDirectory = target.getLayout().getBaseDirectory();
+ File imagesDirectory = baseDirectory.getParentFile();
+
+ log.info( "Creating Mac OS X PKG Installer..." );
+
+ // Creating the package directory
+ File pkgDirectory = new File( imagesDirectory, target.getId() + "-pkg" );
+ pkgDirectory.mkdirs();
+
+ log.info( "Copying PKG installer files" );
+
+ // Creating the root directories hierarchy
+ File pkgRootDirectory = new File( pkgDirectory, "root" );
+ pkgRootDirectory.mkdirs();
+ File pkgRootUsrBinDirectory = new File( pkgRootDirectory, "usr/bin" );
+ pkgRootUsrBinDirectory.mkdirs();
+ File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, "usr/local/"
+ + target.getApplication().getName() + "-" + target.getApplication().getVersion() );
+ pkgRootUsrLocalApachedsDirectory.mkdirs();
+ File pkgRootInstancesDirectory = new File( pkgRootUsrLocalApachedsDirectory, "instances" );
+ pkgRootInstancesDirectory.mkdirs();
+ File pkgRootInstancesDefaultDirectory = new File( pkgRootInstancesDirectory, "default" );
+ pkgRootInstancesDefaultDirectory.mkdirs();
+ File pkgRootInstancesDefaultConfDirectory = new File( pkgRootInstancesDefaultDirectory, "conf" );
+ pkgRootInstancesDefaultConfDirectory.mkdirs();
+ File pkgRootInstancesDefaultLdifDirectory = new File( pkgRootInstancesDefaultDirectory, "ldif" );
+ pkgRootInstancesDefaultLdifDirectory.mkdirs();
+ new File( pkgRootInstancesDefaultDirectory, "log" ).mkdirs();
+ new File( pkgRootInstancesDefaultDirectory, "partitions" ).mkdirs();
+ new File( pkgRootInstancesDefaultDirectory, "run" ).mkdirs();
+ File pkgRootLibraryLaunchDaemons = new File( pkgRootDirectory, "Library/LaunchDaemons" );
+ pkgRootLibraryLaunchDaemons.mkdirs();
+
+ // Copying the apacheds files in the root directory
+ try
+ {
+ // Copying the generated layout
+ MojoHelperUtils.copyFiles( baseDirectory, pkgRootUsrLocalApachedsDirectory );
+
+ // Copying the apacheds.init file
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.init" ),
+ new File( pkgRootUsrLocalApachedsDirectory, "bin/" + target.getApplication().getName() + ".init" ),
+ true );
+
+ // Replacing the apacheds.conf file
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
+ new File( pkgRootUsrLocalApachedsDirectory, "conf/apacheds.conf" ), true );
+
+ // Replacing the apacheds.conf file in the default instance conf directory
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+ "apacheds-default.conf" ), new File( pkgRootInstancesDefaultConfDirectory, "apacheds.conf" ), false );
+
+ // Replacing the log4j.properties file in the default instance conf directory
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
+ "conf/log4j.properties" ), new File( pkgRootInstancesDefaultConfDirectory, "log4j.properties" ), false );
+
+ // Replacing the server.xml file in the default instance conf directory
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
+ "conf/server.xml" ), new File( pkgRootInstancesDefaultConfDirectory, "server.xml" ), false );
+
+ // Copying the apacheds command to /usr/bin
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+ "apacheds-usr-bin.sh" ), new File( pkgRootUsrBinDirectory, target.getApplication().getName() ), true );
+
+ // Copying the org.apache.directory.server.plist file to /Library/LaunchDaemons/
+ MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+ "org.apache.directory.server.plist" ), new File( pkgRootLibraryLaunchDaemons,
+ "org.apache.directory.server.plist" ), true );
+
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy image (" + target.getLayout().getBaseDirectory()
+ + ") to the PKG directory (" + pkgRootDirectory + ")" );
+ }
+
+ // Create Resources folder and sub-folder
+ // Copying the resources files and Info.plist file needed for the
+ // generation of the PKG
+ File pkgResourcesEnglishDirectory = new File( pkgDirectory, "Resources/en.lproj" );
+ pkgResourcesEnglishDirectory.mkdirs();
+ File pkgScriptsDirectory = new File( pkgDirectory, "scripts" );
+ pkgScriptsDirectory.mkdirs();
+
+ try
+ {
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "pkg-background.tiff" ), new File(
+ pkgResourcesEnglishDirectory, "background.tiff" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "License.rtf" ), new File(
+ pkgResourcesEnglishDirectory, "License.rtf" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "Info.plist" ), new File( pkgDirectory,
+ "Info.plist" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "postflight" ), new File(
+ pkgScriptsDirectory, "postflight" ) );
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy PKG resources files." );
+ }
+
+ // Generating the PKG
+ log.info( "Generating Mac OS X PKG Installer" );
+ Execute createPkgTask = new Execute();
+ String[] cmd = new String[]
+ { packageMakerUtility.getAbsolutePath(), "--root", "root/", "--resources", "Resources/", "--info",
+ "Info.plist", "--title", "Apache Directory Server " + target.getApplication().getVersion(),
+ "--version", target.getApplication().getVersion(), "--scripts", "scripts", "--out",
+ "Apache Directory Server Installer.pkg" };
+ createPkgTask.setCommandline( cmd );
+ createPkgTask.setSpawn( true );
+ createPkgTask.setWorkingDirectory( pkgDirectory );
+ try
+ {
+ createPkgTask.execute();
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed while trying to generate the PKG: " + e.getMessage() );
+ }
+
+ log.info( "Mac OS X PKG Installer generated at "
+ + new File( pkgDirectory, "Apache Directory Server Installer.pkg" ) );
+
+ log.info( "Creating Mac OS X DMG..." );
+
+ // Creating the disc image directory
+ File dmgDirectory = new File( imagesDirectory, target.getId() + "-dmg" );
+ dmgDirectory.mkdirs();
+
+ log.info( "Copying DMG files" );
+
+ // Create dmg directory and its sub-directory
+ File dmgDmgBackgroundDirectory = new File( dmgDirectory, "dmg/.background" );
+ dmgDmgBackgroundDirectory.mkdirs();
+
+ // Copying the files
+ try
+ {
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "dmg-background.png" ), new File(
+ dmgDirectory, "dmg/.background/background.png" ) );
+
+ MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "DS_Store" ), new File( dmgDirectory,
+ "dmg/.DS_Store" ) );
+
+ MojoHelperUtils.copyFiles( new File( pkgDirectory, "Apache Directory Server Installer.pkg" ), new File(
+ dmgDirectory, "dmg/Apache Directory Server Installer.pkg" ) );
+
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed to copy DMG resources files." );
+ }
+
+ // Setting execution permission to the postflight script
+ // (unfortunately, the execution permission has been lost after the
+ // copy of the PKG to the dmg folder)
+ MojoHelperUtils.exec( new String[]
+ {
+ "chmod",
+ "755",
+ new File( dmgDirectory, "dmg/Apache Directory Server Installer.pkg/Contents/Resources/postflight" )
+ .toString() }, dmgDirectory, false );
+
+ // Generating the DMG
+ log.info( "Generating Mac OS X DMG Installer" );
+ try
+ {
+ Execute createDmgTask = new Execute();
+ createDmgTask.setCommandline( new String[]
+ { hdiutilUtility.getAbsolutePath(), "makehybrid", "-hfs", "-hfs-volume-name",
+ "Apache Directory Server Installer", "-hfs-openfolder", "dmg/", "dmg/", "-o", "TMP.dmg" } );
+ createDmgTask.setSpawn( true );
+ createDmgTask.setWorkingDirectory( dmgDirectory );
+ createDmgTask.execute();
+
+ createDmgTask.setCommandline( new String[]
+ { hdiutilUtility.getAbsolutePath(), "convert", "-format", "UDZO", "TMP.dmg", "-o",
+ "../" + target.getFinalName() + ".dmg" } );
+ createDmgTask.execute();
+
+ }
+ catch ( IOException e )
+ {
+ log.error( e.getMessage() );
+ throw new MojoFailureException( "Failed while trying to generate the DMG: " + e.getMessage() );
+ }
+
+ log.info( "Mac OS X DMG generated at " + new File( imagesDirectory, target.getFinalName() + ".dmg" ) );
+ }
+
+
+ private void initializeFiltering()
+ {
+ filterProperties.putAll( mymojo.getProject().getProperties() );
+ filterProperties.put( "app.name", target.getApplication().getName() );
+ if ( target.getApplication().getVersion() != null )
+ {
+ filterProperties.put( "app.version", target.getApplication().getVersion() );
+ }
+ else
+ {
+ filterProperties.put( "app.version", "1.0" );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+ */
+ public Properties getFilterProperties()
+ {
+ return filterProperties;
+ }
+}
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgTarget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgTarget.java?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgTarget.java (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/pkg/PkgTarget.java Fri Mar 7 05:28:32 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.daemon.installers.pkg;
+
+
+import java.io.File;
+
+import org.apache.directory.daemon.installers.Target;
+
+
+/**
+ * A PKG installer for the Mac OS X platform.
+ *
+ * To create a PKG installer we use the PackageMaker utility that is bundled
+ * in the (free) developer tools supplied by Apple.
+ *
+ * More information on the use of the PackageMaker utility in the command line
+ * can be found at this address:
+ * http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/packagemaker.1.html
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PkgTarget extends Target
+{
+ /** The wrapper executable path */
+ private String wrapperExecutablePath = "src/main/installers/wrapper/bin/wrapper-windows-x86-32.exe";
+ /** The PackageMaker utility executable */
+ private File packageMakerUtility = new File(
+ "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker" );
+
+
+ /**
+ * Gets the PackageMaker utility.
+ *
+ * @return
+ * the PackageMaker utility
+ */
+ public File getPackageMakerUtility()
+ {
+ return packageMakerUtility;
+ }
+
+
+ /**
+ * Gets the Wrapper executable path.
+ *
+ * @return
+ * the wrapper executable path
+ */
+ public String getWrapperExecutablePath()
+ {
+ return wrapperExecutablePath;
+ }
+
+
+ /**
+ * Sets the PackageMaker utility.
+ *
+ * @param packageMakerUtility
+ * the PackageMaker utility
+ */
+ public void setPackageMakerUtility( File packageMakerUtility )
+ {
+ this.packageMakerUtility = packageMakerUtility;
+ }
+
+
+ /**
+ * Sets the Wrapper executable path.
+ *
+ * @param wrapperExecutablePath
+ * the wrapper executable path
+ */
+ public void setWrapperExecutablePath( String wrapperExecutablePath )
+ {
+ this.wrapperExecutablePath = wrapperExecutablePath;
+ }
+}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh Fri Mar 7 05:28:32 2008
@@ -0,0 +1,235 @@
+#!/bin/sh
+
+# Displaying welcome message and license terms
+more <<"EOF"
+ WELCOME TO THE APACHE DS INSTALLER PROGRAM
+ _ _ ____ ____
+ / \ _ __ __ _ ___| |__ ___| _ \/ ___|
+ / _ \ | '_ \ / _` |/ __| '_ \ / _ \ | | \___ \
+ / ___ \| |_) | (_| | (__| | | | __/ |_| |___) |
+ /_/ \_\ .__/ \__,_|\___|_| |_|\___|____/|____/
+ |_|
+
+ Apache DS is distributed under the Apache Software License Version 2.0.
+
+ Please, take some time to read the license terms below.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+EOF
+
+# Asking for license agreement
+echo ""
+echo "Do you agree to the above license terms? [yes or no]"
+
+# Reading userInput
+while [ "true" ];
+do
+ read userInput leftover
+ case $userInput in
+ [yY] | [yY][eE][sS])
+ break;;
+ [nN] | [nN][oO])
+ echo "If you don't agree to the license this software cannot be installed."
+ exit 1
+ esac
+done
+
+# This is the name of the contained archive
+archiveName=__tmp.tar.gz
+
+# Unpacking the installer
+echo "Unpacking the installer..."
+trap 'rm -f $archiveName; exit 1' HUP INT QUIT TERM
+tail -n +@LINES@ $0 > $archiveName
+
+# Extracting the installer
+echo "Extracting the installer..."
+tar xzf $archiveName
+
+# Launching the installer
+cd sh
+. ./install.sh
+
+# Cleaning
+cd ..
+rm -rf sh
+rm -rd data
+rm -f $archiveName
+
+# Finishing
+echo "Done."
+echo "Apache DS has been installed successfully."
+exit 0
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh Fri Mar 7 05:28:32 2008
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Copying bootstrap.sh to the installer (and replacing the @lines@ variable)
+lines=`wc -l < bootstrap.sh`
+lines=`expr $lines + 1`
+sed -e "s/@LINES@/${lines}/" bootstrap.sh > ../${finalName}.bin
+
+# Packing the data and shell scripts
+tar czf ${tmpArchive} root/* sh/*
+
+# Adding the temp archive to the installer
+cat ${tmpArchive} >> ../${finalName}.bin
+
+# Modifying permission on the installer so it is executable
+chmod 750 ../${finalName}.bin
+
+# Cleaning
+rm ${tmpArchive}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/functions.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/functions.sh?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/functions.sh (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/functions.sh Fri Mar 7 05:28:32 2008
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+#------------------------------------------------------------------------------
+# Updates a variables that will be exported. The question, the variable name,
+# the default value and the mandatory aspect of the input are stored in the
+# "variables.sh" file under the following form:
+# <question> | <variable> | [<default value>] | [<mandatory>]
+#------------------------------------------------------------------------------
+ask_param()
+{
+ # Skipping empty lines
+ if [ -z "$1" ]
+ then
+ return
+ fi
+
+ # Searching for the current line (which is not a comment)
+ curline=`cat -n variables.sh | grep -e "^[[:space:]]*$1[[:space:]][[:space:]]*" | sed -e 's/^[^a-aA-Z|#-]*//'`
+ comment=`echo $curline | grep -e "^\#"`
+
+ # Skipping comments
+ if [ -n "$comment" ]
+ then
+ return
+ fi
+
+ # Getting question, variable, default and mandatory values
+ question=`echo $curline | cut -d'|' -f1 | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` # The question
+ variable=`echo $curline | cut -d'|' -f2 | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` # The variable
+ default=`echo $curline | cut -d'|' -f3 | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` # The default value
+ mandatory=`echo $curline | cut -d'|' -f4 | sed -e 's/^[ ]*//' -e 's/[ ]*$//'` # Mandatory input ?
+
+ # Use the commands below for debug
+ #echo "Current Line = " $curline
+ #echo "Question = " $question
+ #echo "Variable = " $variable
+ #echo "Default value = " $default
+ #echo "Mandatory = " $mandatory
+
+ # The line must include a variable
+ if [ -z "$variable" ]
+ then
+ return
+ fi
+
+ # If there is no question, we update the variable and we return
+ if [ -z "$question" ]
+ then
+ var=`eval echo $default`
+ export $variable="$var"
+ return
+ fi
+
+ # Removing extra spaces from mandatory
+ if [ -n "$mandatory" ]
+ then
+ mandatory=`echo $mandatory | sed -e 's/[[:space:]*M[[:space:]]*/M/'`
+ fi
+
+ # Let's ask the question
+ if [ -n "$default" ]
+ then
+ printf "$question? [Default: ";
+ printf `eval echo $default`;
+ printf "]\n"
+ else
+ echo "$question?"
+ fi
+
+ # Reading anwser
+ read read_answer
+ while [ -z "$read_answer" ]
+ do
+ if [ "x$mandatory" = "xM" ]
+ then
+ echo "You have to anwser, please."
+ if [ -n "$default" ]
+ then
+ printf "$question? [Default: ";
+ printf `eval echo $default`;
+ printf "]\n"
+ else
+ echo "$question?"
+ fi
+ read read_answer
+ else
+ # If the user does not enter any input and the input is not
+ # mandatory, we use the default value
+ read_answer=`eval echo $default`
+ fi
+ done
+
+ # Exporting the variable
+ export $variable="$read_answer"
+}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/install.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/install.sh?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/install.sh (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/install.sh Fri Mar 7 05:28:32 2008
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Loading functions
+. ./functions.sh
+
+# Reading variables file and asking questions
+lines=`wc -l < ./variables.sh`
+count=1
+lines=`expr ${lines:-0} + 1`
+while [ $count -lt $lines ]
+do
+ ask_param $count
+ count=`expr ${count:-0} + 1`
+done
+
+#
+# Starting installation
+#
+
+# Verifying the user is root
+#if ( test `id -un` != "root" )
+#then
+# echo "Only root can install this software."
+# echo "Apache DS installation has failed."
+# exit 1 ;
+#fi
+
+# Installing
+echo "Installing..."
+
+# Installing Apache DS core files
+mkdir -p $APACHEDS_HOME_DIRECTORY
+cp -r ../data/apacheds/* $APACHEDS_HOME_DIRECTORY
+
+# Creating Instances Home Directory
+mkdir -p $INSTANCES_HOME_DIRECTORY
+
+# Creating the Example Instance
+case $userInput in
+ [yY] | [yY][eE][sS])
+ EXAMPLE_HOME_DIRECTORY=$INSTANCES_HOME_DIRECTORY/example;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY/conf;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY/ldif;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY/log;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY/partitions;
+ mkdir -p $EXAMPLE_HOME_DIRECTORY/run;
+ cp ../data/example_instance/apacheds.conf $EXAMPLE_HOME_DIRECTORY/conf/;
+ cp ../data/example_instance/log4j.properties $EXAMPLE_HOME_DIRECTORY/conf/;
+ cp ../data/example_instance/server.xml $EXAMPLE_HOME_DIRECTORY/conf/;
+ cp ../data/example_instance/example.ldif $EXAMPLE_HOME_DIRECTORY/ldif/
+esac
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/variables.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/variables.sh?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/variables.sh (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/bin/variables.sh Fri Mar 7 05:28:32 2008
@@ -0,0 +1,4 @@
+#!/bin/sh
+Where do you want to install Apache DS|APACHEDS_HOME_DIRECTORY|/usr/local/apacheds||
+Where do you want to install Apache DS instances|INSTANCES_HOME_DIRECTORY|${APACHEDS_HOME_DIRECTORY}/instances||
+Do you want to create an example instance|CREATE_EXAMPLE_INSTANCE|yes||
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/control
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/control?rev=634663&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/control (added)
+++ directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/deb/control Fri Mar 7 05:28:32 2008
@@ -0,0 +1,12 @@
+Package: apacheds
+Version: 1.5.2-SNAPSHOT
+Section: devel
+Priority: optional
+Architecture: i386
+Depends:
+Installed-Size: 39037
+Maintainer: Apache Directory Project <de...@directory.apache.org>
+Description: LDAP Browser and Directory Client
+ Apache Directory Studio is a complete directory tooling platform intended to
+ be used with any LDAP server however it is particularly designed for use
+ with the Apache Directory Server.
Added: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/DS_Store
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/DS_Store?rev=634663&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/DS_Store
------------------------------------------------------------------------------
svn:executable = *
Propchange: directory/sandbox/pamarcelot/trunks/apacheds-additional-installers/daemon/plugin/src/main/resources/org/apache/directory/daemon/installers/pkg/DS_Store
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream