diff --git a/source/main/org/freecompany/redline/payload/Contents.java b/source/main/org/freecompany/redline/payload/Contents.java index 43e80f0..5e5e4f1 100644 --- a/source/main/org/freecompany/redline/payload/Contents.java +++ b/source/main/org/freecompany/redline/payload/Contents.java @@ -309,6 +309,16 @@ protected synchronized void addParents( final File file, final int permissions, for ( String parent : parents) addDirectory( parent, permissions, null, uname, gname); } + /** + * Add additional directory that is assumed to already exist on system where the RPM will be installed + * (e.g. /etc) and should not have an entry in the RPM. + * + * @param directory + */ + public synchronized static void addBuiltinDirectory( final String directory) { + builtin.add(directory); + } + /** * Retrieve the size of this archive in number of files. This count includes both directory entries and * soft links. diff --git a/source/test/org/freecompany/redline/payload/ContentsTest.java b/source/test/org/freecompany/redline/payload/ContentsTest.java index 55d605f..e2ca25c 100644 --- a/source/test/org/freecompany/redline/payload/ContentsTest.java +++ b/source/test/org/freecompany/redline/payload/ContentsTest.java @@ -25,4 +25,15 @@ public void testListParentsBuiltin() throws Exception { assertEquals( "/bin/one/two", list.get( 1)); assertEquals( "/bin/one", list.get( 2)); } + + public void testListParentsNewBuiltin() throws Exception { + ArrayList< String> list = new ArrayList< String>(); + Contents.addBuiltinDirectory("/home"); + Contents.listParents( list, new File( "/home/one/two/three/four")); + + assertEquals( 3, list.size()); + assertEquals( "/home/one/two/three", list.get( 0)); + assertEquals( "/home/one/two", list.get( 1)); + assertEquals( "/home/one", list.get( 2)); + } }