build.xml
changeset 7924 3cbb2e1e1ce5
parent 7903 b788095e7704
child 7925 d91bd76b1bd0
--- a/build.xml	Tue Jul 27 17:11:31 2010 +0530
+++ b/build.xml	Tue Jul 27 16:39:03 2010 +0200
@@ -177,6 +177,13 @@
     </or>
   </condition>
 
+  <condition property="allow.root.user" value="true" else="false">
+    <or>
+      <equals arg1="yes" arg2="${allow.root}" />
+      <equals arg1="true" arg2="${allow.root}" />
+    </or>
+  </condition>
+
   <condition property="no.java.home" value="true">
     <not>
       <isset property="env.JAVA_HOME" />
@@ -188,7 +195,17 @@
       <equals arg1="${bbdd.rdbms}" arg2="POSTGRE" />
     </and>
   </condition>
- 
+
+  <condition property="root.user">
+    <and>
+      <equals arg1="${user.name}" arg2="root" />
+      <not>
+        <contains string="${os.name}" substring="Windows" />
+      </not>
+      <equals arg1="false" arg2="${allow.root.user}" />
+    </and>
+  </condition>
+
   <path id="project.class.path">
     <dirset dir="${base.modules}">
       <include name="*/build/classes/" />
@@ -298,6 +315,7 @@
   
   <target name="init" depends="code.rev">
     <fail if="no.java.home" message="The environment variable JAVA_HOME is not set." />
+    <fail if="root.user" message="Don't run ant tasks with the root user" />
   </target>
 
   <target name="code.rev" depends="set.code.rev">