Author: doogie
Date: Sat Aug  9 17:35:11 2008
New Revision: 684387

URL: http://svn.apache.org/viewvc?rev=684387&view=rev
Log:
Debian work; have *not* done an install test with this, against
current HEAD.  It worked for a previous version.  I'll be continuing
to improve this over the next few weeks.

Added:
    ofbiz/trunk/debian/   (with props)
    ofbiz/trunk/debian/EncryptPassword.java
    ofbiz/trunk/debian/TODO
    ofbiz/trunk/debian/changelog
    ofbiz/trunk/debian/compat
    ofbiz/trunk/debian/control
    ofbiz/trunk/debian/entityengine.xslt
    ofbiz/trunk/debian/extract-entityengine.xslt
    ofbiz/trunk/debian/move-files.pl
    ofbiz/trunk/debian/ofbiz.config
    ofbiz/trunk/debian/ofbiz.default
    ofbiz/trunk/debian/ofbiz.dirs
    ofbiz/trunk/debian/ofbiz.init
    ofbiz/trunk/debian/ofbiz.links
    ofbiz/trunk/debian/ofbiz.postinst
    ofbiz/trunk/debian/ofbiz.postrm
    ofbiz/trunk/debian/ofbiz.prerm
    ofbiz/trunk/debian/ofbiz.templates
    ofbiz/trunk/debian/override-data.xslt
    ofbiz/trunk/debian/rules   (with props)

Propchange: ofbiz/trunk/debian/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug  9 17:35:11 2008
@@ -0,0 +1,10 @@
+EncryptPassword.class
+files
+ofbiz
+ofbiz-specialpurpose
+ofbiz-specialpurpose.debhelper.log
+ofbiz.debhelper.log
+ofbiz.prerm.debhelper
+ofbiz.postinst.debhelper
+ofbiz.postrm.debhelper
+ofbiz.substvars

Added: ofbiz/trunk/debian/EncryptPassword.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/EncryptPassword.java?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/EncryptPassword.java (added)
+++ ofbiz/trunk/debian/EncryptPassword.java Sat Aug  9 17:35:11 2008
@@ -0,0 +1,12 @@
+import org.ofbiz.base.crypto.HashCrypt;
+import org.ofbiz.common.login.LoginServices;
+
+public class EncryptPassword {
+    public static void main(String[] args) {
+        String hashType = LoginServices.getHashType();
+        for (String arg: args) {
+            System.out.println(HashCrypt.getDigestHash(arg, hashType));
+        }
+    }
+}
+

Added: ofbiz/trunk/debian/TODO
URL: http://svn.apache.org/viewvc/ofbiz/trunk/debian/TODO?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/TODO (added)
+++ ofbiz/trunk/debian/TODO Sat Aug  9 17:35:11 2008
@@ -0,0 +1,18 @@
+* debian/copyright
+- Prompt for:
+  - ofbiz admin password(s)
+  - default email([EMAIL PROTECTED])
+  - install of demo or just seed data
+* Auto-generate admin key/port
+* Move demo data into separate package?
+- module script for stopping/modifying/installing entity defs/data
+- init script
++ purging of /var/foo/ofbiz dirs
+  - /var/log/ofbiz, /var/cache/ofbiz
+  + /var/lib/ofbiz is cleared, except for .bash_history
+- purging of dpkg-statoverride values
+* mod-jk installation(apache/apache2)
+* debian/watch
+* During install, force seed install, but allow demo or ext to be selected.
+* During reconfigure, allow seed, demo, or ext to be selected.
+* Verify that $MEMIF in the init script only contains -X

Added: ofbiz/trunk/debian/changelog
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/changelog?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/changelog (added)
+++ ofbiz/trunk/debian/changelog Sat Aug  9 17:35:11 2008
@@ -0,0 +1,66 @@
+ofbiz (684378) unstable; urgency=low
+
+  * Start adding debian stuff to upstream.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Sat, 09 Aug 2008 19:20:35 -0500
+
+ofbiz (595296-2) unstable; urgency=low
+
+  * Fix moving of db_stop.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Tue, 25 Mar 2008 22:59:35 -0500
+
+ofbiz (595296-1) unstable; urgency=low
+
+  * First release.
+  * Change when db_stop is called, so that ucf can function.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Tue, 25 Mar 2008 22:43:12 -0500
+
+ofbiz (595296-0) unstable; urgency=low
+
+  * New upstream.
+  * Fix message to say 'start' when a timeout occurs starting.
+  * Actually install the seed data now, by using a new install target
+    in the init script.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Thu, 15 Nov 2007 23:09:57 -0600
+
+ofbiz (583221-0) unstable; urgency=low
+
+  * New upstream.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Mon, 01 Oct 2007 01:01:41 -0500
+
+ofbiz (551703-3) unstable; urgency=low
+
+  * Add PartyProduct.patch.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Thu, 02 Aug 2007 18:41:21 -0500
+
+ofbiz (551703-2) unstable; urgency=low
+
+  * Changed default log4j logging from all to info.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Thu, 12 Jul 2007 12:24:06 -0500
+
+ofbiz (551703-1) unstable; urgency=low
+
+  * Patched GenericDelegator to allow fetching/creating a value by
+    passing a single value, instead of a map.
+  * Move /var/tmp/ofbiz to /var/lib/ofbiz
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Thu, 12 Jul 2007 10:54:58 -0500
+
+ofbiz (551703-0) unstable; urgency=low
+
+  * New upstream.
+  * All services*.xml files are conffiles now.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Fri, 29 Jun 2007 13:20:01 -0500
+
+ofbiz (512946-1) unstable; urgency=low
+
+  * Initial version.
+
+ -- Adam Heath <[EMAIL PROTECTED]>  Wed, 11 Apr 2007 22:08:12 -0500

Added: ofbiz/trunk/debian/compat
URL: http://svn.apache.org/viewvc/ofbiz/trunk/debian/compat?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/compat (added)
+++ ofbiz/trunk/debian/compat Sat Aug  9 17:35:11 2008
@@ -0,0 +1 @@
+5

Added: ofbiz/trunk/debian/control
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/control?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/control (added)
+++ ofbiz/trunk/debian/control Sat Aug  9 17:35:11 2008
@@ -0,0 +1,22 @@
+Source: ofbiz
+Section: misc
+Priority: extra
+Maintainer: Adam Heath <[EMAIL PROTECTED]>
+Origin: brainfood
+Bugs: mozilla://bugs.brainfood.com
+Standards-Version: 3.7.2
+Build-Depends: sun-java6-jdk, debhelper (>= 5)
+
+Package: ofbiz
+Architecture: all
+Depends: dbconfig-common, xalan, ${misc:Depends}, ucf, sun-java6-jdk | 
j2sdk1.5, libpg-java, libmysql-java, jsvc, adduser
+Recommends: postgresql-8.1 | postgresql-7.5 | mysql-server
+Description: foo
+ bar
+
+Package: ofbiz-specialpurpose
+Architecture: all
+Depends: ofbiz (= ${binary:Version})
+Description: foo
+ bar
+

Added: ofbiz/trunk/debian/entityengine.xslt
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/entityengine.xslt?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/entityengine.xslt (added)
+++ ofbiz/trunk/debian/entityengine.xslt Sat Aug  9 17:35:11 2008
@@ -0,0 +1,112 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       version='1.0'>
+ <xsl:output
+       method="xml"
+       indent="yes"
+ />
+ <xsl:param name="dbtype">pgsql</xsl:param>
+ <xsl:param name="dbuser">ofbiz</xsl:param>
+ <xsl:param name="dbpass">ofbiz</xsl:param>
+ <xsl:param name="dbserver">127.0.0.1</xsl:param>
+ <xsl:param name="dbport">5432</xsl:param>
+ <xsl:param name="dbname">ofbiz</xsl:param>
+
+ <xsl:variable name="datasource">
+  <xsl:choose>
+   <xsl:when test="$dbtype='pgsql'">localpostgres</xsl:when>
+   <xsl:when test="$dbtype='mysql'">localmysql</xsl:when>
+   <xsl:when test="$dbtype='derby'">localderby</xsl:when>
+   <xsl:when test="$dbtype='derby'">localhsql</xsl:when>
+  </xsl:choose>
+ </xsl:variable>
+
+ <xsl:template match="[EMAIL PROTECTED]'default']/group-map/@datasource-name">
+  <xsl:attribute name="datasource-name"><xsl:value-of 
select="$datasource"/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="datasource">
+  <xsl:element name="{name()}"><xsl:apply-templates 
select="*|@*|text()|comment()"/></xsl:element>
+ </xsl:template>
+
+ <xsl:template name="datasource-common">
+  <xsl:choose>
+   <xsl:when test="$dbserver"><xsl:value-of select="$dbserver"/></xsl:when>
+   <xsl:otherwise>127.0.0.1</xsl:otherwise>
+  </xsl:choose>
+  <xsl:if test="$dbport">
+   <xsl:text>:</xsl:text>
+   <xsl:value-of select="$dbport"/>
+  </xsl:if>
+  <xsl:text>/</xsl:text>
+  <xsl:value-of select="$dbname"/>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='derby']/inline-jdbc/@jdbc-uri">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='hsql']/inline-jdbc/@jdbc-uri">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='pgsql']/inline-jdbc/@jdbc-uri">
+  <xsl:attribute name="jdbc-uri">
+   <xsl:text>jdbc:postgresql://</xsl:text>
+   <xsl:call-template name="datasource-common"/>
+  </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='mysql']/inline-jdbc/@jdbc-uri">
+  <xsl:attribute name="jdbc-uri">
+   <xsl:text>jdbc:mysql://</xsl:text>
+   <xsl:call-template name="datasource-common"/>
+   <xsl:text>?autoReconnect=true</xsl:text>
+  </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='derby']/inline-jdbc/@jdbc-username">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+  
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='hsql']/inline-jdbc/@jdbc-username">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+  
+ <xsl:template match="[EMAIL PROTECTED]/inline-jdbc/@jdbc-username">
+  <xsl:attribute name="jdbc-username"><xsl:value-of 
select="$dbuser"/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='derby']/inline-jdbc/@jdbc-password">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED] and 
$dbtype='hsql']/inline-jdbc/@jdbc-password">
+  <xsl:attribute name="jdbc-uri"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]/inline-jdbc/@jdbc-password">
+  <xsl:attribute name="jdbc-password"><xsl:value-of 
select="$dbpass"/></xsl:attribute>
+ </xsl:template>
+<!--
+                jdbc-uri="jdbc:postgresql://$dbserver[:$dbport]/$dbname"
+                jdbc-username="$dbuser"
+                jdbc-password="$dbpass"
+
+-->
+ <xsl:template match="*">
+  <xsl:element name="{name()}"><xsl:apply-templates 
select="*|@*|text()|comment()"/></xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text">
+  <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="@*">
+  <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="comment()">
+  <xsl:copy-of select="."/>
+ </xsl:template>
+</xsl:stylesheet>

Added: ofbiz/trunk/debian/extract-entityengine.xslt
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/extract-entityengine.xslt?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/extract-entityengine.xslt (added)
+++ ofbiz/trunk/debian/extract-entityengine.xslt Sat Aug  9 17:35:11 2008
@@ -0,0 +1,78 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       version='1.0'>
+ <xsl:output
+       method="text"
+ />
+
+ <xsl:param name="ofbizhome"/>
+ <xsl:variable name="newline">
+  <xsl:text>
+</xsl:text>
+ </xsl:variable>
+
+ <xsl:template match="entity-config">
+  <xsl:variable name="datasource"><xsl:value-of select="[EMAIL 
PROTECTED]'default']/group-map/@datasource-name"/></xsl:variable>
+  <xsl:text>ofbiz_dbtype="</xsl:text>
+  <xsl:value-of select="substring($datasource, 6)"/>
+  <xsl:text>"</xsl:text>
+  <xsl:value-of select="$newline"/>
+  <xsl:choose>
+   <xsl:when test="$datasource = 'localderby'"/>
+   <xsl:when test="$datasource = 'localhsql'"/>
+   <xsl:when test="$datasource = 'localpostgres' or $datasource = 
'localmysql'">
+    <xsl:apply-templates select="[EMAIL PROTECTED]/inline-jdbc">
+     <xsl:with-param name="datasource"><xsl:value-of 
select="$datasource"/></xsl:with-param>
+    </xsl:apply-templates>
+   </xsl:when>
+  </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="datasource/inline-jdbc">
+  <xsl:variable name="rest1"><xsl:value-of 
select="substring(substring-after(substring-after(@jdbc-uri, ':'), ':'), 
3)"/></xsl:variable>
+  <xsl:text>ofbiz_dbname="</xsl:text>
+  <xsl:value-of select="substring-after($rest1, '/')"/>
+  <xsl:text>"</xsl:text>
+  <xsl:value-of select="$newline"/>
+  <xsl:variable name="rest2"><xsl:value-of select="substring-before($rest1, 
'/')"/></xsl:variable>
+  <xsl:text>ofbiz_dbserver="</xsl:text>
+  <xsl:choose>
+   <xsl:when test="contains($rest2, ':')">
+    <xsl:value-of select="substring-before($rest2, ':')"/>
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="$newline"/>
+    <xsl:text>ofbiz_dbport="</xsl:text>
+    <xsl:value-of select="substring-after($rest2, ':')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$rest2"/>
+   </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text>"</xsl:text>
+  <xsl:value-of select="$newline"/>
+  <xsl:text>ofbiz_dbusername="</xsl:text>
+  <xsl:value-of select="@jdbc-username"/>
+  <xsl:text>"</xsl:text>
+  <xsl:value-of select="$newline"/>
+  <xsl:text>ofbiz_dbpassword="</xsl:text>
+  <xsl:value-of select="@jdbc-password"/>
+  <xsl:text>"</xsl:text>
+  <xsl:value-of select="$newline"/>
+ </xsl:template>
+
+ <xsl:template match="*">
+  <xsl:element name="{name()}"><xsl:apply-templates 
select="*|@*|text()|comment()"/></xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text">
+  <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="@*">
+  <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="comment()">
+  <xsl:copy-of select="."/>
+ </xsl:template>
+</xsl:stylesheet>

Added: ofbiz/trunk/debian/move-files.pl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/move-files.pl?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/move-files.pl (added)
+++ ofbiz/trunk/debian/move-files.pl Sat Aug  9 17:35:11 2008
@@ -0,0 +1,242 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Data::Dumper;
+use File::Copy;
+
+my %dirs;
+
+my %bases = (
+       'ofbiz'                 => 'debian/ofbiz',
+       'specialpurpose'        => 'debian/ofbiz-specialpurpose',
+);
+
+my $appDirsRe = qw/(applications|framework|specialpurpose)/;
+my @ignore = qw(
+OPTIONAL_LIBRARIES
+NOTICE
+ant
+LICENSE
+hot-deploy/README.txt
+.project
+applications/accounting/lib/README
+applications/content/lib/uno/README
+applications/content/index/indexhere.txt
+ant.bat
+stopofbiz.sh
+startofbiz.bat
+framework/example/lib/lib.txt
+framework/example/webapp/webapp.txt
+framework/logs/README
+framework/images/webapp/images/catalog/dirholder.txt
+framework/appserver/README
+framework/shark/lib/README
+framework/data/README
+README
+.classpath
+ij.ofbiz
+KEYS
+APACHE2_HEADER
+rc.ofbiz
+);
+#startofbiz.sh
+
+my %ignore = map({$_ => 1} @ignore);
+
+my @unknown;
+my %scripts;
+
+sub basename($) {
+       my $target = $_[0];
+       $target =~ s,/[^/]+$,,;
+       return $target;
+}
+
+sub _mkdir($) {
+       return mkdir($_[0]) || !system('mkdir', '-p', $_[0]);
+}
+
+sub copylink($$$) {
+       my ($base, $destdir, $file) = @_;
+       my $target = "$base$destdir/$file";
+       #print("Symlinking ($file) ($target)\n");
+       if (-f $file) {
+               _mkdir(basename($target)) || die("a");
+               link($file, $target) || die("b");
+       } else {
+               _mkdir($target) || die("c");
+       }
+       _mkdir(basename("$base/usr/share/ofbiz/dist/$file")) || die("d");
+       symlink("$destdir/$file", "$base/usr/share/ofbiz/dist/$file") || 
die("e");
+
+       my $symlink = "$base/usr/share/ofbiz/$file";
+       _mkdir(basename($symlink));
+       symlink("/usr/share/ofbiz/alternative/$file", $symlink) || die("f: 
$symlink: $!");
+}
+system('rm', '-rf', 'debian/ofbiz', 'debian/ofbiz-specialpurpose');
+
+open(FIND, '-|', 'find', qw(-printf %P\0)) || die("Couldn't run find");
+$/ = "\0";
+while (<FIND>) {
+       chomp;
+       #print("{$_}\n");
+       next if (m,^debian/,);
+       next if (exists($ignore{$_}));
+#      next if 
(m,^(LICENSE|NOTICE|OPTIONAL_LIBRARIES|ant(\.bat)?|\.(project|classpath)|(stop|start)ofbiz\.sh|startofbiz\.bat|(ij|rc)\.ofbiz)$,);
+       next if (m,(^|.*/)build\.xml$,);
+       #print("1\n");
+       next if (m,^$appDirsRe/[^/]+/(build/classes|src|testdef)/.*,);
+       next if (m,^framework/(catalina/work|data/derby|logs)/.*,);
+       #print("2\n");
+       my $type = undef;
+       if ($_ eq 'framework/entity/config/entityengine.xml') {
+               $type = 'ucf';
+       } elsif (m,(^|.*/)[^/]+\.css$,) {
+               $type = 'conffile';
+       } elsif 
(m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/(controller|web|regions)\.xml$,) {
+               $type = 'conffile';
+       } elsif ($_ eq 
'specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/facility-controller.xml') {
+               $type = 'conffile';
+       } elsif ($_ eq 'runtime/data/derby.properties') {
+               $type = 'conffile';
+       } elsif (m,^$appDirsRe/[^/]+/email/[^/]+/[^/]+\.ftl$,) {
+               $type = 'conffile';
+       } elsif (m,^$appDirsRe/[^/]+/data/[^/]+\.xml$,) {
+               $type = 'conffile';
+       } elsif (m,^$appDirsRe/[^/]+/ofbiz-component\.xml$,) {
+               $type = 'conffile';
+       } elsif (m,^$appDirsRe/component-load\.xml$,) {
+               $type = 'conffile';
+       } elsif (-f && m,^$appDirsRe/[^/]+/servicedef/services.*\.xml$,) {
+               $type = 'conffile';
+       } elsif (-f && 
m,^$appDirsRe/[^/]+/(dtd|entitydef|script|servicedef|widget)/.*$,) {
+               $type = 'code';
+       } elsif 
(m,^$appDirsRe/[^/]+/webapp/.*/[^/]+(\.(bsh|ftl|jsp|gif|htc|ico|jar|jpg|js|png)|(Forms?|Menus)\.xml)$,)
 {
+               $type = 'code';
+       } elsif (m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/[^/]+\.tld$,) {
+               $type = 'code';
+       } elsif (-f && m,^$appDirsRe/[^/]+/(config|templates|fieldtype)/.*$,) {
+               $type = 'conffile';
+       } elsif (m,^$appDirsRe/[^/]+/(build/lib/[^/]+\.jar|lib/.*\.jar)$,) {
+               $type = 'code';
+       } elsif (m,^framework/common/webcommon/.*\.ftl$,) {
+               $type = 'code';
+       } elsif (-f && m,^specialpurpose/pos/screens/.*$,) {
+               $type = 'code';
+       } elsif ($_ eq 'startofbiz.sh') {
+               $type = 'conffile';
+       } elsif ($_ eq 
'applications/content/template/survey/genericsurvey.ftl') {
+               $type = 'code';
+       } elsif ($_ eq 'ofbiz.jar') {
+               $type = 'code';
+       } elsif (-f && m,^runtime/(logs|catalina|data)/README$,) {
+               next;
+       } elsif ($_ eq 'runtime/catalina/catalina-users.xml') {
+               $type = 'varlib';
+       } elsif (m,^runtime/catalina/[^/]+$,) {
+               $type = 'varcache';
+       } elsif (-d && $_ eq 'runtime/logs') {
+               $type = 'varlog';
+       } elsif (m,^runtime/logs/.*$,) {
+               next;
+       } elsif (-d && m,^runtime/tmp$,) {
+               $type = 'varlib';
+       } elsif (m,^runtime/(data|output)/.*$,) {
+               $type = 'varlib';
+       } elsif (-f) {
+               $type = 'code';
+       } else {
+               next;
+       }
+       my $pkg;
+       if (m,^specialpurpose/.*,) {
+               $pkg = 'ofbiz-specialpurpose';
+       } else {
+               $pkg = 'ofbiz';
+       }
+       my $base = 'debian/' . $pkg;
+       my $file = $_;
+       print(STDERR "$type: $file\n") if ($file =~ m/.*runtime.*/);
+       if ($type eq 'code') {
+               my $target = "$base/usr/share/ofbiz/$file";
+               #print("Copying ($file) ($target)\n");
+               _mkdir(basename($target)) || die("1");
+               link($file, $target) || die("2");
+       } elsif ($type eq 'conffile') { # && $file =~ 
m,^.*/(ofbiz-component|component-load|data/.*)\.xml$,) {
+               copylink($base, '/etc/ofbiz', $file);
+       } elsif ($type eq 'ucf') {
+               copylink($base, '/etc/ofbiz', $file);
+               _mkdir(basename("$base/usr/share/ofbiz/ucf/$file"));
+               rename("$base/etc/ofbiz/$file", 
"$base/usr/share/ofbiz/ucf/$file");
+               my $postinst = <<_EOF_;
+trap 'rm -f "\$tmpconffile"' EXIT
+tmpconffile=`tempfile -m 644`
+munge_conffile "\$tmpconffile" "$file"
+ucf "\$tmpconffile" /etc/ofbiz/$file
+ucfr ofbiz /etc/ofbiz/$file
+rm -f "\$tmpconffile"
+trap '' EXIT
+_EOF_
+               push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst);
+               my $postrm = <<_EOF_;
+for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist;  do rm -f 
/etc/ofbiz/$file\$ext; done
+rm -f /etc/ofbiz/$file
+if which ucf >/dev/null; then ucf --purge /etc/ofbiz/$file; fi
+if which ucfr >/dev/null; then ucfr --purge ofbiz /etc/ofbiz/$file; fi
+_EOF_
+               push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm);
+       } elsif ($type =~ m/^var(cache|lib|log|tmp)$/) {
+               my $new = "/var/$1/$pkg";
+               copylink($base, $new, $file);
+               my $postrm = <<_EOF_; 
+if dpkg-statoverride --list "$new/$file" > /dev/null; then dpkg-statoverride 
--remove "$new/$file"; fi
+rm -rf "$new/$file"
+_EOF_
+               push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm);
+               my $postinst = <<_EOF_;
+if ! dpkg-statoverride --list "$new/$file" > /dev/null; then
+       dpkg-statoverride --add ofbiz ofbiz 2775 "$new/$file"
+       chown ofbiz:ofbiz "$new/$file"
+       chmod 2755 "$new/$file"
+fi
+_EOF_
+               push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst);
+       } else {
+               die("Unknown type($type) on file($file)");
+       }
+}
+
+
+close(FIND);
+my $postinst = <<_EOF_;
+               if [ "\$ofbiz_reseed" ]; then
+                       echo "Need to modify ofbiz data." 1>&2
+                       configure_ofbiz
+               fi
+_EOF_
+push(@{$scripts{'ofbiz'}->{'postinst'}->{'configure'}}, $postinst);
+foreach my $pkg (keys(%scripts)) {
+       foreach my $script (keys(%{$scripts{$pkg}})) {
+               open(SCRIPT, ">> debian/ofbiz.$script.debhelper");
+               print(SCRIPT "case \"\$1\" in\n");
+               my $segments = $scripts{$pkg}->{$script};
+               foreach my $arg (keys(%$segments)) {
+                       my $label = $arg;
+                       if ($label eq 'configure') {
+                               print(SCRIPT "\t(reconfigure|configure)\n");
+                       } elsif ($arg =~ m/[\s|]/) {
+                               print(SCRIPT "\t(\"$arg\")\n");
+                       } else {
+                               print(SCRIPT "\t($arg)\n");
+                       }
+                       print(SCRIPT join('', map("\t\t$_\n", split(/\n/, 
join("\n", @{$segments->{$arg}})))));
+                       print(SCRIPT "\t;;\n");
+               }
+               print(SCRIPT "esac\n");
+               print(SCRIPT "db_stop\n");
+               close(SCRIPT);
+       }
+}
+print(join('', map("$_\n", @unknown)));

Added: ofbiz/trunk/debian/ofbiz.config
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.config?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.config (added)
+++ ofbiz/trunk/debian/ofbiz.config Sat Aug  9 17:35:11 2008
@@ -0,0 +1,135 @@
+#!/bin/sh
+set -ex
+exec 2>>/tmp/ofbiz.config
+date 1>&2
+echo $$ 1>&2
+: "$0" "$@"
+
+
+. /usr/share/debconf/confmodule
+
+db_version 2.0
+db_capb backup
+#DEBHELPER#
+cat << _EOF_ > /dev/null
+if [ "$1" = configure ]; then
+       db_fget ofbiz/database-type seen || true
+       if [ "$RET" != false ]; then
+               db_set ofbiz/database-type pgsql
+               db_fset ofbiz/database-type seen false
+       fi
+       for dbtype in pgsql mysql; do
+               db_fget ofbiz/$dbtype/method seen || true
+               if [ "$RET" != false ]; then
+                       db_set ofbiz/$dbtype/method tcp/ip
+                       db_fset ofbiz/$dbtype/method seen false
+               fi
+       done
+fi
+_EOF_
+
+if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
+       dbc_dbtype="derby"
+       dbc_dbtypes="pgsql, mysql, derby, hsql"
+       dbc_authmethod_user="password"
+       . /usr/share/dbconfig-common/dpkg/config 
+       dbc_go ofbiz $@
+fi
+set -x
+if [ -r "/etc/ofbiz/debconf.cfg" ]; then
+       . "/etc/ofbiz/debconf.cfg"
+fi
+set_if() {
+       if [ "$2" ]; then
+               db_set "$1" "$2"
+               return 0
+       fi
+       return 1;
+}
+ofbiz_readers="seed"
+ofbiz_from_email="[EMAIL PROTECTED]"
+ofbiz_admin_port="10523"
+#env LANG=C LC_ALL=C sed -n -e 's/[^[:alnum:]]//g;p;q' < /dev/urandom | cut 
-b1-12
+if set_if ofbiz/admin-password-encrypted "$ofbiz_admin_password_encrypted"; 
then
+       db_fset ofbiz/admin-password-encrypted seen true
+fi
+db_set ofbiz/admin-password ofbiz || true
+set_if ofbiz/readers "$ofbiz_readers" || true
+set_if ofbiz/from-email "$ofbiz_from_email" || true
+set_if ofbiz/admin-port "$ofbiz_admin_port" || true
+
+cmd="$1"
+shift
+
+case "$cmd" in
+       (configure)
+               import_question=ofbiz/import-additional-data
+               reader_choices="demo, ext"
+       ;;
+       (reconfigure)
+               import_question=ofbiz/reimport-data
+               reader_choices="seed, demo, ext"
+       ;;
+       (*)
+               echo "Invalid command($cmd)" 1>&2
+               exit 9
+       ;;
+esac
+case "$cmd" in
+       (configure|reconfigure)
+               db_subst ofbiz/readers choices "$reader_choices"
+               STATE=0
+               while :; do
+                       NEXT=$(($STATE + 1))
+                       case "$STATE" in
+                               (-1)    exit 10
+                               ;;
+                               (0)     if db_input medium 
ofbiz/admin-password; then
+                                               db_set ofbiz/admin-password ''
+                                               db_set 
ofbiz/admin-password-encrypted ''
+                                               db_fset 
ofbiz/password-confirmation seen false
+                                       else
+                                               db_fset 
ofbiz/password-confirmation seen true
+                                               db_get ofbiz/admin-password || 
true
+                                               db_set 
ofbiz/password-confirmation "$RET"
+                                       fi
+                               ;;
+                               (1)     password=""
+                                       db_get ofbiz/admin-password && 
password="$RET"
+                                       if ! [ "$password" ]; then
+                                               db_input high 
ofbiz/empty-password-not-allowed || true
+                                               NEXT=0
+                                       fi
+                               ;;
+                               (2)     db_input high 
ofbiz/password-confirmation || true
+                               ;;
+                               (3)     confirm=""
+                                       db_get ofbiz/password-confirmation && 
confirm="$RET"
+                                       if [ "$password" != "$confirm" ]; then
+                                               db_input high 
ofbiz/mismatched-passwords || true
+                                               NEXT=0
+                                               db_fset ofbiz/admin-password 
seen false
+                                       fi
+                               ;;
+                               (4)     db_input medium $import_question || true
+                               ;;
+                               (5)     db_get $import_question && 
do_import="$RET"
+                                       if [ "$do_import" = "true" ]; then
+                                               db_input medium ofbiz/readers 
|| true
+                                       fi
+                               ;;
+                               (6)     db_input medium ofbiz/from-email || true
+                               ;;
+                               (7)     db_input low ofbiz/admin-port || true
+                               ;;
+                               (*)     break
+                               ;;
+                       esac
+                       if db_go; then
+                               STATE=$NEXT
+                       else
+                               STATE=$(($STATE - 1))
+                       fi
+               done
+       ;;
+esac

Added: ofbiz/trunk/debian/ofbiz.default
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.default?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.default (added)
+++ ofbiz/trunk/debian/ofbiz.default Sat Aug  9 17:35:11 2008
@@ -0,0 +1 @@
+MEMIF="-Xms128M -Xmx256M"

Added: ofbiz/trunk/debian/ofbiz.dirs
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.dirs?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.dirs (added)
+++ ofbiz/trunk/debian/ofbiz.dirs Sat Aug  9 17:35:11 2008
@@ -0,0 +1,3 @@
+usr/share/ofbiz/support
+etc/ofbiz
+var/lib/ofbiz

Added: ofbiz/trunk/debian/ofbiz.init
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.init?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.init (added)
+++ ofbiz/trunk/debian/ofbiz.init Sat Aug  9 17:35:11 2008
@@ -0,0 +1,287 @@
+#!/bin/sh
+set -e
+
+if ! [ -e "/usr/share/ofbiz/ofbiz.jar" ]; then
+       exit 0
+fi
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# set defaults
+DEFAULT=/etc/default/ofbiz
+JAVA_HOME=""
+JAVA_HOMES="/usr/lib/jvm/java-6-sun /usr/lib/j2sdk1.5"
+MEMIF=""
+UMASK=002
+
+. /lib/lsb/init-functions
+. /etc/default/rcS
+
+if [ -e /etc/default/locale ]; then
+       . /etc/default/locale
+       export LANG
+fi
+
+# allow local admin to change defaults
+if [ -e "$DEFAULT" ]; then
+       . "$DEFAULT"
+fi
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+NAME=ofbiz
+DESC="OfBiz Container"
+OFBIZ_HOME=/usr/share/ofbiz
+USER=ofbiz
+PIDFILE=/var/run/ofbiz.pid
+CLASS=org.ofbiz.base.start.Start
+
+ADMIN_PORT=10523
+ADMIN_KEY=so3du5kasd5dn
+PROPS="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY"
+
+if [ "x$JAVA_HOME" == x ]; then
+       if [ "x$JAVA_HOMES" != x ]; then
+               for possible in $JAVA_HOMES; do
+                       if [ -e "$possible/bin/java" ]; then
+                               JAVA_HOME="$possible"
+                               break
+                       fi
+               done
+       fi
+       if [ "x$JAVA_HOME" == x ]; then
+               log_failure_msg "Couldn't find a java."
+               if [ "x$JAVA_HOMES" != x ]; then
+                       log_failure_msg "Tried $JAVA_HOMES"
+               fi
+               exit 1
+       fi
+fi
+JAVA="$JAVA_HOME/bin/java"
+CLASSPATH="$OFBIZ_HOME/ofbiz.jar:/usr/share/java/commons-daemon.jar"
+
+run_ofbiz_cmd() {
+       (
+               cd "$OFBIZ_HOME"
+               "$JAVA" $PROPS -jar ofbiz.jar "$1"
+       )
+}
+
+get_status() {
+       status="$(run_ofbiz_cmd -status 2>/dev/null | sed -n 's/^Current Status 
: //p')"
+       case "$status" in
+               (Running|Starting|Stopping|Not\ Running)
+                       echo $status
+               ;;
+               (*)
+                       echo Not Running
+               ;;
+       esac
+}
+
+wait_for_status() {
+       count="$1"
+       while :; do
+               if [ "$(get_status)" = "$2" ]; then
+                       break;
+               fi
+               count=$(($count - 1))
+               if [ "$count" -eq 0 ]; then
+                       log_failure_msg "Timeout waiting for $3"
+                       exit 1
+               fi
+               log_begin_msg "."
+               sleep 1
+       done
+}
+
+ofbiz_shutdown() {
+       run_ofbiz_cmd -shutdown
+}
+
+wait_for_stop() {
+       wait_for_status 30 "Not Running" "stop"
+}
+
+start() {
+       case "$(get_status)" in
+               (Stopping)
+                       log_progress_msg "(waiting for stop"
+                       wait_for_stop
+                       log_progress_msg ")"
+               ;;
+               (Not\ Running)
+               ;;
+               (Starting|Running)
+                       log_progress_msg "(already running)"
+                       return
+               ;;
+               (*)
+                       log_progress_msg "(forcing stop"
+                       ofbiz_shutdown
+                       wait_for_stop
+                       log_progress_msg ")"
+               ;;
+       esac
+       (
+               cd "$OFBIZ_HOME"
+               touch /var/log/ofbiz/ofbiz.log
+               chown ofbiz.ofbiz /var/log/ofbiz/ofbiz.log
+               jsvc -pidfile "$PIDFILE" \
+                       -user $USER \
+                       -outfile /var/log/ofbiz/console.log -errfile '&1' \
+                       -home "$JAVA_HOME" -cp "$CLASSPATH" \
+                       $PROPS \
+                       $MEMIF \
+                       $CLASS
+       )
+       wait_for_status 40 "Running" "start"
+}
+
+stop() {
+       case "$(get_status)" in
+               (Not\ Running)
+               ;;
+               (*)
+                       ofbiz_shutdown
+                       wait_for_stop
+               ;;
+       esac
+       if [ -e "$PIDFILE" ]; then
+               rm "$PIDFILE"
+       fi
+}
+
+install() {
+       case "$(get_status)" in
+               (Stopping)
+                       log_progress_msg "(waiting for stop"
+                       wait_for_stop
+                       log_progress_msg ")"
+               ;;
+               (Not\ Running)
+               ;;
+               (Starting|Running)
+                       log_failure_msg "(running, can't install)"
+                       exit 1
+               ;;
+       esac
+       (
+               cd "$OFBIZ_HOME"
+               touch /var/log/ofbiz/ofbiz.log
+               chown ofbiz.ofbiz /var/log/ofbiz/ofbiz.log
+               jsvc -pidfile "$PIDFILE" \
+                       -nodetach \
+                       -user $USER \
+                       -outfile /dev/tty -errfile '&1' \
+                       -home "$JAVA_HOME" -cp "$CLASSPATH" \
+                       $PROPS \
+                       $MEMIF \
+                       $CLASS \
+                       install "$@"
+       )
+}
+
+module_hook() {
+       files=""
+       result="0"
+       while [ $# -gt 0 ]; do
+               case "$1" in
+                       (-file=*)
+                               file="$(echo "$1" | sed 's/^-file=//')"
+                               if ! [ -e "$file" ]; then
+                                       log_failure_msg "File $file does not 
exist"
+                                       result=1
+                               else
+                                       files="$files,$file"
+                               fi
+                       ;;
+                       (-file)
+                               file="$2"
+                               if ! shift; then
+                                       log_failure_msg "No file specified"
+                                       result=1
+                               elif ! [ -e "$file" ]; then
+                                       log_failure_msg "File $file does not 
exist"
+                                       result=1
+                               else
+                                       files="$files,$file"
+                               fi
+                       ;;
+                       (*)
+                               log_failure_msg "Unknown argument($1)"
+                               exit 1
+                       ;;
+               esac
+               shift
+       done
+       if ! [ "$files" ]; then
+               return 0
+       elif [ "$result" eq 1 ]; then
+               return 1
+       fi
+       files="$(echo "$files" | cut -f 2- -d ,)"
+       was_running=""
+       case "$(get_status)" in
+               (Not\ Running)
+               ;;
+               (Stopping)
+                       wait_for_stop
+               ;;
+               (*)
+                       log_daemon_msg "Stopping $DESC" "$NAME"
+                       ofbiz_shutdown
+                       wait_for_stop
+                       log_end_msg 0
+                       was_running=1
+               ;;
+       esac
+       cd "$OFBIZ_HOME"
+       if ! jsvc \
+               -user $USER -outfile /dev/tty -errfile '&1' -nodetach \
+               -home "$JAVA_HOME" -cp "$CLASSPATH" \
+               $CLASS install -file="$files"; then
+               log_failure_msg "Error installing files"
+               result=1
+       fi
+       if [ "$was_running" ]; then
+               log_daemon_msg "Starting $DESC" "$NAME"
+               start
+               log_end_msg 0
+       fi
+       return "$result"
+}
+cmd="$1"
+shift || true
+case "$cmd" in
+       (start)
+               log_daemon_msg "Starting $DESC" "$NAME"
+               start
+               log_end_msg 0
+       ;;
+       (stop)
+               log_daemon_msg "Stopping $DESC" "$NAME"
+               stop
+               log_end_msg 0
+       ;;
+       (install)
+               log_daemon_msg "Installing $DESC" "$NAME"
+               install "$@"
+               log_end_msg 0
+       ;;
+       (reload|restart|force-reload)
+               log_daemon_msg "Restarting $DESC" "$NAME"
+               stop
+               start
+               log_end_msg 0
+       ;;
+       (module-hook)
+               if ! module_hook "$@"; then
+                       exit 1
+               fi
+       ;;
+       (*)
+               log_success_msg "Usage: $0 
{start|stop|install|reload|force-reload|restart"
+               exit 1
+       ;;
+esac

Added: ofbiz/trunk/debian/ofbiz.links
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.links?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.links (added)
+++ ofbiz/trunk/debian/ofbiz.links Sat Aug  9 17:35:11 2008
@@ -0,0 +1,2 @@
+usr/share/java/postgresql.jar 
usr/share/ofbiz/framework/entity/lib/jdbc/postgresql.jar
+usr/share/java/mysql.jar usr/share/ofbiz/framework/entity/lib/jdbc/mysql.jar

Added: ofbiz/trunk/debian/ofbiz.postinst
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.postinst?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.postinst (added)
+++ ofbiz/trunk/debian/ofbiz.postinst Sat Aug  9 17:35:11 2008
@@ -0,0 +1,182 @@
+#!/bin/sh
+set -e
+: "$0" "$@"
+JAVA_HOME=""
+JAVA_HOMES="/usr/lib/jvm/java-6-sun /usr/lib/j2sdk1.5"
+for possible in $JAVA_HOMES; do
+       if [ -e "$possible/bin/java" ]; then
+               JAVA_HOME="$possible"
+               break
+       fi
+done
+if ! [ "$JAVA_HOME" ]; then
+       echo "Couldn't find a java."
+       echo "Tried $JAVA_HOMES"
+       exit 1
+fi
+JAVA="$JAVA_HOME/bin/java"
+
+encrypt_password() {
+       (
+               cd /usr/share/ofbiz
+               "$JAVA" -classpath 
framework/base/build/lib/ofbiz-base.jar:framework/common/build/lib/ofbiz-common.jar:framework/base/config:framework/entity/build/lib/ofbiz-entity.jar:framework/base/lib/javolution.jar:framework/base/lib/commons/commons-collections.jar:framework/base/lib/jdbm.jar:framework/base/lib/log4j.jar:framework/security/config:support
 EncryptPassword "$1"
+       )
+}
+munge_conffile() {
+       tmp="$1"
+       source="$2"
+       case "$source" in
+               (framework/entity/config/entityengine.xml)
+                       . /etc/dbconfig-common/ofbiz.conf
+                       xalan \
+                               -xsl 
"/usr/share/ofbiz/support/entityengine.xslt" \
+                               -in "/usr/share/ofbiz/ucf/$source" \
+                               -param dbtype "'$dbc_dbtype'" \
+                               -param dbuser "'$dbc_dbuser'" \
+                               -param dbpass "'$dbc_dbpass'" \
+                               -param dbserver "'$dbc_dbserver'" \
+                               -param dbport "'$dbc_dbport'" \
+                               -param dbname "'$dbc_dbname'" > $tmp
+               ;;
+               (*)
+                       echo "Unknown file: $source"
+                       exit 1
+               ;;
+       esac
+}
+configure_ofbiz() {
+       extra=""
+       : ofbiz_readers "$ofbiz_readers"
+       : ofbiz_import_readers "$ofbiz_import_readers"
+       : ofbiz_override_data "$ofbiz_override_data"
+       if [ "$ofbiz_readers" ]; then 
+               if [ "$ofbiz_import_readers" ]; then
+                       extra="$extra -readers=\"$ofbiz_readers\""
+               fi
+               if [ "$ofbiz_override_data" ]; then
+                       trap 'rm -f "$tempfile1" "$tempfile2"' EXIT
+                       tempdir="$(mktemp -d)"
+                       chown ofbiz:ofbiz "$tempdir"
+                       trap 'rm -rf "$tempdir"' EXIT
+                       files=""
+                       {
+                               IFS="," set -- $ofbiz_readers
+                               while [ $# -gt 0 ]; do
+                                       if true; then
+                                               xalan -q \
+                                               -param reader "'$1'" \
+                                               -param fromemail 
"'$ofbiz_from_email'" \
+                                               -param password 
"'$ofbiz_password_encrypted'" \
+                                               -param ofbizhome 
"'/usr/share/ofbiz'" \
+                                               -xsl 
"/usr/share/ofbiz/support/override-data.xslt" \
+                                               -in 
"/usr/share/ofbiz/framework/base/config/component-load.xml" \
+                                               -out "$tempdir/reader-$1.xml"
+                                       chown ofbiz:ofbiz 
"$tempdir/reader-$1.xml"
+                                       fi
+                                       if [ "$files" ]; then
+                                               
files="$files,$tempdir/reader-$1.xml"
+                                       else
+                                               files="$tempdir/reader-$1.xml"
+                                       fi
+                                       shift
+                               done
+                       }
+                       trap '' EXIT
+                       if [ "$files" ]; then
+                               extra="$extra -file=\"$files\""
+                       fi
+               fi
+               /etc/init.d/ofbiz install $extra
+       fi
+       #rm -f "$tempfile1" "$tempfile2"
+}
+fix_readers() {
+       IFS=", " set -- "$@"
+       while [ $# -gt 0 ]; do
+               echo -n "$1"
+               shift
+               if [ $# -gt 0 ]; then
+                       echo ','
+               fi
+       done
+}
+get_random_chars() {
+       (
+               LANG=C
+               LC_ALL=C
+               length="$1"
+               chars=""
+               set -x
+               while :; do
+                       needed_length=$((${length} - ${#chars}))
+                       chars="$chars$(dd if=/dev/urandom 
count="${needed_length}" bs=1 | sed -n -e 's/[^[:alnum:]]//g;p;q')"
+                       if [ "${#chars}" -ge "$length" ]; then
+                               break
+                       fi
+               done
+               echo $chars
+               set +x
+       )
+}
+get() {
+       var_name="$1"
+       debconf_name="$2"
+       shift 2
+       if db_get "$debconf_name"; then
+               if eval ! [ \"\$$var_name\" = \"\$RET\" ]; then
+                       while [ $# -gt 0 ]; do
+                               eval $1=1
+                               shift
+                       done
+                       eval $var_name=\"\$RET\"
+               fi
+       else
+               echo "Couldn't fetch '$debconf_name' from debconf!"
+               exit 1
+       fi
+}
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst 
+dbc_go ofbiz "$@"
+if [ -e /etc/ofbiz/debconf.cfg ]; then
+       ofbiz_admin_key=""
+       . /etc/ofbiz/debconf.cfg
+else
+       ofbiz_admin_key="$(get_random_chars 32)"
+       ofbiz_readers=""
+       ofbiz_from_email=""
+       ofbiz_admin_port=""
+fi
+ofbiz_reseed=""
+set -x
+case "$1" in
+       (configure|reconfigure)
+               get ofbiz_readers ofbiz/readers ofbiz_import_readers 
ofbiz_reseed
+               ofbiz_readers="$(fix_readers "$ofbiz_readers")"
+               get ofbiz_from_email ofbiz/from-email ofbiz_override_data 
ofbiz_reseed
+               get ofbiz_admin_port ofbiz/admin-port
+               if ! [ "$2" ]; then
+                       if ! getent passwd ofbiz 2>/dev/null >/dev/null; then
+                               adduser --quiet --group --no-create-home 
--system --home /var/lib/ofbiz ofbiz
+                       fi
+               fi
+               update-alternatives --install \
+                       /usr/share/ofbiz/alternative \
+                       ofbiz-alternative \
+                       /usr/share/ofbiz/dist \
+                       1000
+               cat << _EOF_ > /etc/ofbiz/debconf.cfg.dpkg-new
+ofbiz_readers='$ofbiz_readers'
+ofbiz_from_email='$ofbiz_from_email'
+ofbiz_admin_port='$ofbiz_admin_port'
+ofbiz_admin_key='$ofbiz_admin_key'
+_EOF_
+               ucf /etc/ofbiz/debconf.cfg.dpkg-new /etc/ofbiz/debconf.cfg
+               ucfr ofbiz /etc/ofbiz/debconf.cfg
+               rm /etc/ofbiz/debconf.cfg.dpkg-new
+       ;;
+esac
+#DEBHELPER#
+exit
+

Added: ofbiz/trunk/debian/ofbiz.postrm
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.postrm?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.postrm (added)
+++ ofbiz/trunk/debian/ofbiz.postrm Sat Aug  9 17:35:11 2008
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+: "$0" "$@"
+
+if [ -f /usr/share/debconf/confmodule ]; then
+       . /usr/share/debconf/confmodule
+fi
+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+       . /usr/share/dbconfig-common/dpkg/postrm 
+       dbc_go ofbiz "$@"
+fi
+
+case "$1" in
+       (purge)
+               rm -f /etc/ofbiz/debconf.cfg
+               if which ucf >/dev/null; then ucf --purge 
/etc/ofbiz/debconf.cfg; fi
+               if which ucfr >/dev/null; then ucfr --purge ofbiz 
/etc/ofbiz/debconf.cfg; fi
+       ;;
+esac
+
+#DEBHELPER#
+

Added: ofbiz/trunk/debian/ofbiz.prerm
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.prerm?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.prerm (added)
+++ ofbiz/trunk/debian/ofbiz.prerm Sat Aug  9 17:35:11 2008
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -ex
+: "$0" "$@"
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/prerm 
+dbc_go ofbiz "$@"
+
+case "$1" in
+       (upgrade|remove)
+               find /var/cache/ofbiz -mindepth 1 -maxdepth 1 -print0 | xargs 
rm -rf
+               ;;
+esac
+
+case "$1" in
+       (remove|deconfigure)
+               update-alternatives --remove \
+                       ofbiz-alternative \
+                       /usr/share/ofbiz/dist
+               ;;
+esac
+
+#DEBHELPER#
+
+

Added: ofbiz/trunk/debian/ofbiz.templates
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz.templates?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/ofbiz.templates (added)
+++ ofbiz/trunk/debian/ofbiz.templates Sat Aug  9 17:35:11 2008
@@ -0,0 +1,55 @@
+Template: ofbiz/admin-password
+Type: password
+Description: Enter the password for ofbiz admin accounts:
+
+Template: ofbiz/password-confirmation
+Type: password
+Description: Password confirmation:
+
+Template: ofbiz/readers
+Default: seed
+Type: multiselect
+Choices: ${choices}
+Description: Which additional data readers should be imported:
+
+Template: ofbiz/from-email
+Default: [EMAIL PROTECTED]
+Type: string
+Description: Email from address:
+ Various parts of ofbiz can be configured to send email.  This specifies
+ what the from address should be.
+
+Template: ofbiz/admin-password-encrypted
+Type: password
+Description: temporary placeholder for the encrypted password, not shown
+
+Template: ofbiz/mismatched-passwords
+Type: note
+Description: passwords do not match
+ The passwords you have entered do not match.
+
+Template: ofbiz/empty-password-not-allowed
+Type: note
+Description: empty password is not allowed
+ The password you have entered is empty.  This is not allowed.
+
+Template: ofbiz/admin-port
+Type: string
+Default: 10523
+Description: Admin port for status queries:
+ This is the port used to communicate with a running ofbiz instance, to
+ see if it is starting, running, or stopping.
+
+Template: ofbiz/import-additional-data
+Type: boolean
+Default: false
+Description: Important example data:
+ OfBiz comes with lots of example data, showing products/categories/users
+ etc.  Answering yes will import this additional data.
+
+Template: ofbiz/reimport-data
+Type: boolean
+Default: false
+Description: Reimport data:
+ Whether data should be reimported on upgrade.
+

Added: ofbiz/trunk/debian/override-data.xslt
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/debian/override-data.xslt?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/override-data.xslt (added)
+++ ofbiz/trunk/debian/override-data.xslt Sat Aug  9 17:35:11 2008
@@ -0,0 +1,147 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       version='1.0'>
+ <xsl:output
+       method="xml"
+       indent="yes"
+ />
+ <xsl:param name="reader">seed</xsl:param>
+ <xsl:param name="fromemail">[EMAIL PROTECTED]</xsl:param>
+ <xsl:param 
name="password">47ca69ebb4bdc9ae0adec130880165d2cc05db1a</xsl:param>
+ <xsl:param name="ofbizhome"/>
+
+ <xsl:template match="/">
+<!--
+  <xsl:message>OFBIZHOME(<xsl:value-of select="$ofbizhome"/>)</xsl:message>
+-->
+  <entity-engine-xml>
+   <xsl:comment>READER <xsl:value-of select="$reader"/></xsl:comment>
+   <xsl:apply-templates mode="components">
+    <xsl:with-param name="basedir"><xsl:value-of 
select="$ofbizhome"/></xsl:with-param>
+   </xsl:apply-templates>
+  </entity-engine-xml>
+ </xsl:template>
+
+ <xsl:template mode="components" match="load-components">
+  <xsl:param name="basedir"/>
+  <xsl:variable name="dir"><xsl:value-of select="$basedir"/>/<xsl:value-of 
select="@parent-directory"/></xsl:variable>
+  <xsl:variable name="file"><xsl:value-of 
select="$dir"/>/component-load.xml</xsl:variable>
+<!--
+  <xsl:message>LOAD COMPONENT(dir: <xsl:value-of select="$dir"/>)</xsl:message>
+-->
+  <xsl:apply-templates mode="components" select="document($file)">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$dir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="components" match="[EMAIL PROTECTED]'hot-deploy']">
+ </xsl:template>
+
+ <xsl:template mode="components" match="load-component">
+  <xsl:param name="basedir"/>
+  <xsl:variable name="dir"><xsl:value-of select="$basedir"/>/<xsl:value-of 
select="@component-location"/></xsl:variable>
+  <xsl:variable name="file"><xsl:value-of 
select="$dir"/>/ofbiz-component.xml</xsl:variable>
+  <xsl:apply-templates mode="component" select="document($file)">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$dir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="component" match="[EMAIL PROTECTED]'data' and 
@reader-name=$reader]">
+  <xsl:param name="basedir"/>
+<!--
+  <xsl:message>ENTITY-RESOURCE(<xsl:value-of select="name()"/>)(basedir: 
<xsl:value-of select="$basedir"/>)</xsl:message>
+-->
+  <xsl:variable name="file"><xsl:value-of select="$basedir"/>/<xsl:value-of 
select="@location"/></xsl:variable>
+  <xsl:apply-templates mode="data" select="document($file)">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$basedir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="components" match="/|*">
+  <xsl:param name="basedir"/>
+<!--
+  <xsl:message>DEFAULT COMPONENTS RULE(<xsl:value-of 
select="name()"/>)(basedir: <xsl:value-of select="$basedir"/>)</xsl:message>
+-->
+  <xsl:apply-templates mode="components">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$basedir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="component" match="/|*">
+  <xsl:param name="basedir"/>
+<!--
+  <xsl:message>DEFAULT COMPONENT RULE(<xsl:value-of 
select="name()"/>)(basedir: <xsl:value-of select="$basedir"/>)</xsl:message>
+-->
+  <xsl:apply-templates mode="component">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$basedir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="data" match="/|*">
+  <xsl:param name="basedir"/>
+<!--
+  <xsl:message>ENTITY DATA(<xsl:value-of select="name()"/>)(basedir: 
<xsl:value-of select="$basedir"/>)</xsl:message>
+-->
+  <xsl:apply-templates mode="data">
+   <xsl:with-param name="basedir"><xsl:value-of 
select="$basedir"/></xsl:with-param>
+  </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template mode="data" match="
+  ProductStoreEmailSetting[
+   @bccAddress='[EMAIL PROTECTED]' or
+   @fromAddress='[EMAIL PROTECTED]']|ContactList[
+   @verifyEmailFrom='[EMAIL PROTECTED]'
+  ]|ContactMech[
+   @infoString='[EMAIL PROTECTED]'
+  ]|WorkflowDataField[
+   @initialValue='[EMAIL PROTECTED]'
+  ]|UserLogin[
+   @currentPassword='47ca69ebb4bdc9ae0adec130880165d2cc05db1a'
+  ]">
+  <xsl:element name="{name()}">
+   <xsl:apply-templates mode="match" select="*|@*|text()|comment()"/>
+  </xsl:element>
+ </xsl:template>
+
+ <xsl:template mode="match" 
match="ProductStoreEmailSetting/@bccAddress|ProductStoreEmailSetting/@fromAddress|ProductStoreEmailSetting/@verifyEmailFrom|ContactMech/@infoString|ContactList/@verifyEmailFrom|WorkflowDataField/@initialValue">
+  <xsl:attribute name="{name()}">
+   <xsl:choose>
+    <xsl:when test=". = '[EMAIL PROTECTED]'"><xsl:value-of 
select="$fromemail"/></xsl:when>
+    <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+   </xsl:choose>
+  </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template mode="match" match="UserLogin/@currentPassword">
+  <xsl:attribute name="{name()}">
+   <xsl:choose>
+    <xsl:when test=". = 
'47ca69ebb4bdc9ae0adec130880165d2cc05db1a'"><xsl:value-of 
select="$password"/></xsl:when>
+    <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+   </xsl:choose>
+  </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="comment()|@*" mode="data">
+  <xsl:apply-templates mode="data"/>
+ </xsl:template>
+
+ <xsl:template mode="match" match="*">
+  <xsl:element name="{name()}">
+   <xsl:apply-templates mode="match" select="*|@*|text()|comment()"/>
+  </xsl:element>
+ </xsl:template>
+
+ <xsl:template mode="data" match="text()"/>
+ <xsl:template mode="match" match="text()"/>
+ <xsl:template mode="components" match="text()"/>
+ <xsl:template mode="component" match="text()"/>
+
+ <xsl:template mode="match" match="@*">
+  <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template mode="match" match="comment()">
+  <xsl:copy-of select="."/>
+ </xsl:template>
+</xsl:stylesheet>

Added: ofbiz/trunk/debian/rules
URL: http://svn.apache.org/viewvc/ofbiz/trunk/debian/rules?rev=684387&view=auto
==============================================================================
--- ofbiz/trunk/debian/rules (added)
+++ ofbiz/trunk/debian/rules Sat Aug  9 17:35:11 2008
@@ -0,0 +1,72 @@
+#!/usr/bin/make -f
+DH_VERBOSE     :=
+SHELL          := /bin/bash -O extglob
+
+export DH_VERBOSE
+
+JAVA_HOME      := /usr/lib/jvm/java-6-sun
+JAVAC          := $(JAVA_HOME)/bin/javac
+JAVA           := $(JAVA_HOME)/bin/java
+
+export JAVA_HOME
+UPSTREAM_VERSION := $(shell dpkg-parsechangelog | awk 'BEGIN{FS="[ 
-]";}/^Version:/{print $$2}')
+
+merge:
+       # This does *not* support checkout paths with spaces in them
+       # caveat empto
+       # TODO: svn
+       set -ex;set -- `(svk info . 2>/dev/null || true) | awk -F '[ ,]+' 
'/^(Depot Path|Mirrored From): /{print $$3}'`;\
+       if [ "$$1" ]; then \
+               if [ "$$2" ]; then svk sync "$$1"; fi; \
+               svk up; \
+               set -- `svk info . 2>/dev/null | awk -F '[ ,]+' '/^Mirrored 
From: /{print $$3, $$5}'`;\
+               if [ "$$1" ] && [ "$$2" ] && [ "$(UPSTREAM_VERSION)" -ne "$$2" 
]; then \
+                       dch -v "$$2-1" -m "New upstream version."; \
+               fi \
+       fi
+
+clean-debian:
+       dh_clean
+       rm -f debian/EncryptPassword.class
+       rm -rf runtime/catalina/work
+
+clean: clean-debian
+       ant clean-all
+
+build: build-ofbiz debian/EncryptPassword.class
+build-ofbiz:
+       ant
+
+debian/EncryptPassword.class: %.class: %.java
+debian/EncryptPassword.class: build-ofbiz
+       $(JAVAC) -classpath 
framework/base/build/lib/ofbiz-base.jar:framework/common/build/lib/ofbiz-common.jar
 -d $(@D) $*.java
+
+
+binary-indep: DH_OPTIONS=-i
+binary-indep:
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       mkdir -p runtime/catalina/work
+       perl debian/move-files.pl
+       dh_installdirs -v
+       cp -a debian/*.xslt debian/*.class debian/ofbiz/usr/share/ofbiz/support
+       dh_link
+#      tar -c . --exclude debian --exclude src --exclude build.xml --exclude 
build/classes --exclude framework/example | tar -C 
debian/ofbiz-svn-$(UPSTREAM_VERSION)/var/lib/ofbiz/$(UPSTREAM_VERSION) -x 
+#      dh_strip
+       dh_compress
+       dh_fixperms
+#      dh_shlibdeps
+       dh_md5sums
+       dh_installdebconf
+       dh_installinit
+       dh_installdeb
+       dh_gencontrol
+       dh_builddeb
+
+binary-arch:
+
+binary: binary-indep binary-arch
+
+.EXPORT_ALL_VARIABLES:
+

Propchange: ofbiz/trunk/debian/rules
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to