Changeset 2022

Show
Ignore:
Timestamp:
02/13/2010 09:37:29 AM (6 months ago)
Author:
djb61
Message:

Move the log4j properties files to .dist versions in svn, this stops user changes getting overwritten on install.

As the number of .dist files is getting quite large and a user would have to copy all of these to non .dist variants after install some support has been added in the installer for this, now if a .dist file is encountered and there isn't already a non .dist version in the install path then the installer will automatically copy the .dist file to an installed copy, additionally when building slave.zip the non .dist versions of files will be included in the zip also (for the zip this is not limited to ones created by the installer but will also pickup any relevant pre-existing config files rather than just the .dist versions).
See: #263

Location:
trunk
Files:
3 modified
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/installer.xml

    r1953 r2022  
    4040                        debug="${build.debug}" 
    4141                        optimize="${build.optimize}" /> 
    42                 <!-- create tools jar --> 
     42                <!-- create plugin framework jar --> 
    4343                <jar destfile="lib/${app.name}-jpf-${app.version}.jar"> 
    4444                        <manifest> 
  • trunk/src/tools/org/drftpd/tools/ant/ResourceTask.java

    r1925 r2022  
    4848        private boolean _slavePlugin; 
    4949        private ArrayList<String> _filePatterns; 
     50        private ArrayList<String> _installedConfs; 
    5051 
    5152        /** 
     
    6667         * @see org.apache.tools.ant.Task#execute() 
    6768         */ 
     69        @SuppressWarnings("unchecked") 
    6870        @Override 
    6971        public void execute() throws BuildException { 
     
    8183                } 
    8284                _longDate = buildDate.getTime(); 
     85                _installedConfs = (ArrayList<String>)getProject().getReference("installed.confs"); 
    8386                findResources(_resourceDir); 
    8487                if (_slavePlugin && !_filePatterns.isEmpty()) { 
     
    181184                        } catch (IOException e) { 
    182185                                // FileWriter is already closed 
     186                        } 
     187                } 
     188                // See if this is a dist file that needs installing 
     189                if (relativePath.endsWith(".dist")) { 
     190                        String installRelativePath = relativePath.substring(0, relativePath.lastIndexOf(".dist")); 
     191                        File installConfFile = new File(_baseDir, installRelativePath); 
     192                        boolean doInstall = true; 
     193                        if (installConfFile.exists()) { 
     194                                if (!_installedConfs.contains(installRelativePath)) { 
     195                                        doInstall = false; 
     196                                } 
     197                        } else { 
     198                                _installedConfs.add(installRelativePath); 
     199                        } 
     200                        if (doInstall) { 
     201                                // Write data to installed file 
     202                                FileWriter installOutputWriter = null; 
     203                                try { 
     204                                        installOutputWriter = new FileWriter(installConfFile,true); 
     205                                        installOutputWriter.write(output.toString()+"\n"); 
     206                                        installOutputWriter.flush(); 
     207                                } catch (FileNotFoundException e) { 
     208                                        log("Cannot install resource file to: " + installConfFile.getParent(),Project.MSG_ERR); 
     209                                } catch (IOException e) { 
     210                                        log("Error installing resource file: " + installConfFile.getName(),Project.MSG_ERR); 
     211                                } finally { 
     212                                        try { 
     213                                                installOutputWriter.close(); 
     214                                        } catch (IOException e) { 
     215                                                // FileWriter is already closed 
     216                                        } 
     217                                } 
     218                        } 
     219                        // Do this regardless so that any existing user installed confs get pulled into slave.zip 
     220                        if (_slavePlugin) { 
     221                                _filePatterns.add(installRelativePath); 
    183222                        } 
    184223                } 
  • trunk/src/tools/org/drftpd/tools/installer/PluginBuildListener.java

    r1925 r2022  
    5757        private HashMap<String,PluginDescriptor> _slavePluginMap; 
    5858        private FileSet _slaveFiles; 
     59        private ArrayList<String> _installedConfs; 
    5960        private TreeSet<String> _missingLibs; 
    6061        private InstallerConfig _config; 
     
    9394                } 
    9495                _slaveFiles = new FileSet(); 
     96                _installedConfs = new ArrayList<String>(); 
    9597                _missingLibs = new TreeSet<String>(); 
    9698                _pluginsDone = 0; 
     
    256258                                p.addReference("plugin.descriptor",currDescriptor); 
    257259                                p.addReference("slave.fileset",_slaveFiles); 
     260                                p.addReference("installed.confs",_installedConfs); 
    258261                                p.addReference("libs.missing",_missingLibs); 
    259262                        }