directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1001788 - in /directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main: java/org/apache/directory/daemon/installers/archive/ java/org/apache/directory/daemon/installers/bin/ resources/org/apache/directory/daemon/install...
Date Mon, 27 Sep 2010 15:43:56 GMT
Author: pamarcelot
Date: Mon Sep 27 15:43:55 2010
New Revision: 1001788

URL: http://svn.apache.org/viewvc?rev=1001788&view=rev
Log:
Made the binary installer build again (not fully functionnal yet).

Modified:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java?rev=1001788&r1=1001787&r2=1001788&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
Mon Sep 27 15:43:55 2010
@@ -215,8 +215,7 @@ public class ArchiveInstallerCommand ext
             && !archiveType.equalsIgnoreCase( "tar.gz" ) && !archiveType.equalsIgnoreCase(
"tar.bz2" ) )
         {
             log.warn( "Archive type is unknwown (" + archiveType + ")!" );
-            log.warn( "The build will continue, but please check the archive type of this
installer " );
-            log.warn( "target" );
+            log.warn( "The build will continue, but please check the archive type of this
installer target" );
             return false;
         }
 

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java?rev=1001788&r1=1001787&r2=1001788&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
Mon Sep 27 15:43:55 2010
@@ -42,6 +42,7 @@ public class BinInstallerCommand extends
 {
     /** The sh utility executable */
     private File shUtility = new File( "/bin/sh" );
+
     /** The final name of the installer */
     private String finalName;
 
@@ -71,25 +72,64 @@ public class BinInstallerCommand extends
      */
     public void execute() throws MojoExecutionException, MojoFailureException
     {
-        // TODO FIXME
-        //        // 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;
-        //        }
-        //
+        // Verifying the target
+        if ( !verifyTarget() )
+        {
+            return;
+        }
+
+        log.info( "  Creating Bin installer..." );
+
+        // Creating the target directory
+        getTargetDirectory().mkdirs();
+
+        log.info( "    Copying Bin installer files" );
+
+        try
+        {
+            // Creating the installation layout and copying files to it
+            copyCommonFiles( mojo );
+
+            File binShDirectory = new File( getBinInstallerDirectory(), "sh" );
+            binShDirectory.mkdirs();
+
+            // Copying shell script utilities for the installer
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"bootstrap.sh" ),
+                        new File( getBinInstallerDirectory(), "bootstrap.sh" ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
+                        "createInstaller.sh" ), new File( getBinInstallerDirectory(), "createInstaller.sh"
), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"functions.sh" ),
+                        new File( binShDirectory, "functions.sh" ), false );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"install.sh" ),
+                        new File( binShDirectory, "install.sh" ), false );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"variables.sh" ),
+                        new File( binShDirectory, "variables.sh" ), false );
+
+        }
+        catch ( Exception e )
+        {
+            log.error( e.getMessage() );
+            throw new MojoFailureException( "Failed to copy bin installer 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.setWorkingDirectory( getBinInstallerDirectory() );
+        try
+        {
+            createBinTask.execute();
+        }
+        catch ( IOException e )
+        {
+            log.error( e.getMessage() );
+            throw new MojoFailureException( "Failed while trying to generate the Bin: " +
e.getMessage() );
+        }
+
+        //        
         //        File baseDirectory = target.getLayout().getInstallationDirectory();
         //        File imagesDirectory = baseDirectory.getParentFile();
         //
@@ -108,12 +148,13 @@ public class BinInstallerCommand extends
         //        try
         //        {
         //            copyFiles( baseDirectory, binRootFolderServerDirectory );
+        //
         //        }
         //        catch ( IOException e )
         //        {
         //            log.error( e.getMessage() );
         //            throw new MojoFailureException( "Failed to copy image (" + target.getLayout().getInstallationDirectory()
-        //                + ") to the Bin directory (" + binRootFolderDirectory + ")" );
+        //                        + ") to the Bin directory (" + binRootFolderDirectory +
")" );
         //        }
         //
         //        // Create instance and sh directory
@@ -127,35 +168,36 @@ public class BinInstallerCommand extends
         //        {
         //            // Copying the apacheds.conf file to the server installation layout
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"apacheds.conf" ),
-        //                new File( binRootFolderServerDirectory, "conf/apacheds.conf" ),
false );
+        //                        new File( binRootFolderServerDirectory, "conf/apacheds.conf"
), false );
         //
         //            // Copying the default instance apacheds.conf file
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-        //                "apacheds-default.conf" ), new File( binRootFolderInstanceDirectory,
"apacheds.conf" ), false );
+        //                        "apacheds-default.conf" ), new File( binRootFolderInstanceDirectory,
"apacheds.conf" ), false );
         //
         //            // Copying the log4j.properties file for the default instance
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( binRootFolderServerDirectory,
-        //                "conf/log4j.properties" ), new File( binRootFolderInstanceDirectory,
"log4j.properties" ), false );
+        //                        "conf/log4j.properties" ), new File( binRootFolderInstanceDirectory,
"log4j.properties" ),
+        //                false );
         //
         //            // Copying the server.xml file for the default instance
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( binRootFolderServerDirectory,
-        //                "conf/server.xml" ), new File( binRootFolderInstanceDirectory,
"server.xml" ), false );
+        //                        "conf/server.xml" ), new File( binRootFolderInstanceDirectory,
"server.xml" ), false );
         //
         //            // Copying the apacheds-init script file for the default instance
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"apacheds-init" ),
-        //                new File( binRootFolderInstanceDirectory, "apacheds-init" ), true
);
+        //                        new File( binRootFolderInstanceDirectory, "apacheds-init"
), true );
         //
         //            // Copying shell script utilities for the installer
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"bootstrap.sh" ),
-        //                new File( binDirectory, "bootstrap.sh" ), true );
+        //                        new File( binDirectory, "bootstrap.sh" ), true );
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-        //                "createInstaller.sh" ), new File( binDirectory, "createInstaller.sh"
), true );
+        //                        "createInstaller.sh" ), new File( binDirectory, "createInstaller.sh"
), true );
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"functions.sh" ),
-        //                new File( binShDirectory, "functions.sh" ), false );
+        //                        new File( binShDirectory, "functions.sh" ), false );
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"install.sh" ),
-        //                new File( binShDirectory, "install.sh" ), false );
+        //                        new File( binShDirectory, "install.sh" ), false );
         //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
"variables.sh" ),
-        //                new File( binShDirectory, "variables.sh" ), false );
+        //                        new File( binShDirectory, "variables.sh" ), false );
         //
         //            // Removing the redundant server.xml file (see DIRSERVER-1112)
         //            new File( binRootFolderServerDirectory, "conf/server.xml" ).delete();
@@ -170,7 +212,7 @@ public class BinInstallerCommand extends
         //        log.info( "Generating Bin Installer" );
         //        Execute createBinTask = new Execute();
         //        String[] cmd = new String[]
-        //            { shUtility.getAbsolutePath(), "createInstaller.sh" };
+        //                    { shUtility.getAbsolutePath(), "createInstaller.sh" };
         //        createBinTask.setCommandline( cmd );
         //        createBinTask.setSpawn( true );
         //        createBinTask.setWorkingDirectory( binDirectory );
@@ -183,36 +225,37 @@ public class BinInstallerCommand extends
         //            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, finalName
) );
+
+        log.info( "Bin Installer generated at " + new File( getTargetDirectory(), finalName
) );
     }
 
 
     /**
-     * Recursively copy files from the given source to the given destination.
+     * Verifies the target.
      *
-     * @param src
-     *      the source
-     * @param dest
-     *      the destination
-     * @throws IOException
-     *      If an error occurs when copying a file
+     * @return
+     *      <code>true</code> if the target is correct, 
+     *      <code>false</code> if not.
      */
-    public void copyFiles( File src, File dest ) throws IOException
+    private boolean verifyTarget()
     {
-        if ( src.isDirectory() )
+        // Verifying the target is Linux
+        if ( !target.isOsNameLinux() )
         {
-            dest.mkdirs();
-
-            for ( File file : src.listFiles() )
-            {
-                copyFiles( file, new File( dest, file.getName() ) );
-            }
+            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 target" );
+            return false;
         }
-        else
+
+        // Verifying the sh utility exists
+        if ( !shUtility.exists() )
         {
-            FileUtils.copyFile( src, dest );
+            log.warn( "Cannot find sh utility at this location: " + shUtility );
+            log.warn( "The build will continue, but please check the location of your sh
utility." );
+            return false;
         }
+
+        return true;
     }
 
 
@@ -234,16 +277,32 @@ public class BinInstallerCommand extends
     }
 
 
+    /**
+     * Gets the directory for the Bin installer.
+     *
+     * @return
+     *      the directory for the Bin installer.
+     */
+    private File getBinInstallerDirectory()
+    {
+        return new File( getTargetDirectory(), "bin" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public File getInstallationDirectory()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return new File( getBinInstallerDirectory(), "server" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public File getInstanceDirectory()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return new File( getBinInstallerDirectory(), "instance" );
     }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java?rev=1001788&r1=1001787&r2=1001788&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinTarget.java
Mon Sep 27 15:43:55 2010
@@ -33,30 +33,9 @@ import org.apache.directory.daemon.insta
  */
 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()
+    public BinTarget()
     {
-        return wrapperExecutablePath;
-    }
-
-
-    /**
-     * Sets the Wrapper executable path.
-     *
-     * @param wrapperExecutablePath
-     *      the wrapper executable path
-     */
-    public void setWrapperExecutablePath( String wrapperExecutablePath )
-    {
-        this.wrapperExecutablePath = wrapperExecutablePath;
+        setOsName( Target.OS_NAME_LINUX );
+        setOsArch( Target.OS_ARCH_X86 );
     }
 }
\ No newline at end of file

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh?rev=1001788&r1=1001787&r2=1001788&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/bootstrap.sh
Mon Sep 27 15:43:55 2010
@@ -27,8 +27,8 @@ verifyExitCode()
 {
     if [ $? -ne 0 ]
     then
-               echo "An error occurred when installing Apache DS."
-               echo "Apache DS installation failed."
+               echo "An error occurred when installing ApacheDS."
+               echo "ApacheDS installation failed."
                exit 1
     fi
 }
@@ -38,7 +38,7 @@ export APACHEDS_VERSION=${apacheds.versi
 
 # Displaying welcome message and license terms
 more <<"EOF"
-                   WELCOME TO THE APACHE DS INSTALLER PROGRAM
+                   WELCOME TO THE APACHEDS INSTALLER PROGRAM
                     _                     _          ____  ____ 
                    / \   _ __   __ _  ___| |__   ___|  _ \/ ___|
                   / _ \ | '_ \ / _` |/ __| '_ \ / _ \ | | \___ \ 
@@ -46,7 +46,7 @@ more <<"EOF"
                 /_/   \_\ .__/ \__,_|\___|_| |_|\___|____/|____/ 
                         |_|
 
-    Apache DS is distributed under the Apache Software License Version 2.0.
+    ApacheDS is distributed under the Apache Software License Version 2.0.
             
             Please, take some time to read the license terms below.
 
@@ -275,5 +275,5 @@ verifyExitCode
 
 # Finishing
 echo "Done."
-echo "Apache DS has been installed successfully."
+echo "ApacheDS has been installed successfully."
 exit 0

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh?rev=1001788&r1=1001787&r2=1001788&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/bin/createInstaller.sh
Mon Sep 27 15:43:55 2010
@@ -20,16 +20,16 @@
 # 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}
+sed -e "s/@LINES@/${lines}/" bootstrap.sh > ../../${finalName}
 
 # Packing the data and shell scripts
-tar czf ${tmpArchive} rootFolder/* sh/*
+tar czf ${tmpArchive} instance/* server/* sh/*
 
 # Adding the temp archive to the installer
-cat ${tmpArchive} >> ../${finalName}
+cat ${tmpArchive} >> ../../${finalName}
 
 # Modifying permission on the installer so it is executable
-chmod 750 ../${finalName}
+chmod +x ../../${finalName}
 
 # Cleaning
 rm ${tmpArchive}



Mime
View raw message