Bläddra i källkod

Revert "Revert due to unit test failures. "AMBARI-4934. Provide deb packages for Ambari server and Agents (Vitaliy Semenyk via dlysnichenko)""

This reverts commit 58064a862e08e327c119100c3964aba02e7fe6ac.
Lisnichenko Dmitro 11 år sedan
förälder
incheckning
fc1ba0b4af
37 ändrade filer med 1267 tillägg och 14 borttagningar
  1. 188 2
      ambari-agent/pom.xml
  2. 22 0
      ambari-agent/src/main/package/deb/control/control
  3. 34 0
      ambari-agent/src/main/package/deb/control/postinst
  4. 24 0
      ambari-agent/src/main/package/deb/control/postrm
  5. 15 0
      ambari-agent/src/main/package/deb/control/posttrm
  6. 27 0
      ambari-agent/src/main/package/deb/control/preinst
  7. 33 0
      ambari-agent/src/main/package/deb/control/prerm
  8. 25 0
      ambari-client/pom.xml
  9. 21 0
      ambari-client/src/main/package/deb/control/control
  10. 15 0
      ambari-client/src/main/package/deb/control/postinst
  11. 15 0
      ambari-client/src/main/package/deb/control/postrm
  12. 15 0
      ambari-client/src/main/package/deb/control/posttrm
  13. 15 0
      ambari-client/src/main/package/deb/control/preinst
  14. 15 0
      ambari-client/src/main/package/deb/control/prerm
  15. 16 0
      ambari-project/pom.xml
  16. 21 0
      ambari-project/src/main/package/deb/control/control
  17. 15 0
      ambari-project/src/main/package/deb/control/postinst
  18. 15 0
      ambari-project/src/main/package/deb/control/postrm
  19. 15 0
      ambari-project/src/main/package/deb/control/posttrm
  20. 15 0
      ambari-project/src/main/package/deb/control/preinst
  21. 15 0
      ambari-project/src/main/package/deb/control/prerm
  22. 389 10
      ambari-server/pom.xml
  23. 22 0
      ambari-server/src/main/package/deb/control/control
  24. 30 0
      ambari-server/src/main/package/deb/control/postinst
  25. 15 0
      ambari-server/src/main/package/deb/control/postrm
  26. 15 0
      ambari-server/src/main/package/deb/control/posttrm
  27. 22 0
      ambari-server/src/main/package/deb/control/preinst
  28. 40 0
      ambari-server/src/main/package/deb/control/prerm
  29. 16 0
      ambari-views/pom.xml
  30. 21 0
      ambari-views/src/main/package/deb/control/control
  31. 15 0
      ambari-views/src/main/package/deb/control/postinst
  32. 15 0
      ambari-views/src/main/package/deb/control/postrm
  33. 15 0
      ambari-views/src/main/package/deb/control/posttrm
  34. 15 0
      ambari-views/src/main/package/deb/control/preinst
  35. 15 0
      ambari-views/src/main/package/deb/control/prerm
  36. 17 1
      ambari-web/pom.xml
  37. 29 1
      pom.xml

+ 188 - 2
ambari-agent/pom.xml

@@ -45,6 +45,10 @@
     <ruby.tar>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.15/repos/centos6/ruby-1.8.7-p370.tar.gz</ruby.tar>
     <ruby.tar>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.15/repos/centos6/ruby-1.8.7-p370.tar.gz</ruby.tar>
     <lib.dir>/usr/lib/ambari-agent/lib</lib.dir>
     <lib.dir>/usr/lib/ambari-agent/lib</lib.dir>
     <python.ver>python &gt;= 2.6</python.ver>
     <python.ver>python &gt;= 2.6</python.ver>
+    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
+    <deb.architecture>amd64</deb.architecture>
+    <deb.dependency.list>openssl, zlibc, ${deb.python.ver}</deb.dependency.list>
+
     <ambari.server.module>../ambari-server</ambari.server.module>
     <ambari.server.module>../ambari-server</ambari.server.module>
     <target.cache.dir>${project.build.directory}/cache/</target.cache.dir>
     <target.cache.dir>${project.build.directory}/cache/</target.cache.dir>
     <resource.keeper.script>${ambari.server.module}/src/main/python/ambari_server/resourceFilesKeeper.py</resource.keeper.script>
     <resource.keeper.script>${ambari.server.module}/src/main/python/ambari_server/resourceFilesKeeper.py</resource.keeper.script>
@@ -371,6 +375,162 @@
           </mappings>
           </mappings>
         </configuration>
         </configuration>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dataSet>
+            <data>
+              <src>${project.build.directory}/${project.artifactId}-${project.version}/ambari_agent</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${agent.install.dir}</prefix>
+              </mapper>
+            </data>
+            <data>
+              <src>${project.build.directory}/${project.artifactId}-${project.version}/resource_management</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${resmgmt.install.dir}</prefix>
+              </mapper>
+            </data>
+            <data>
+              <src>${project.build.directory}/lib</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${lib.dir}</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>${project.basedir}/../ambari-common/src/main/python/jinja2/jinja2</src>
+              <excludes>${project.basedir}/../ambari-common/src/main/python/jinja2/jinja2/testsuite</excludes>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${jinja.install.dir}</prefix>
+              </mapper>
+            </data>
+            <data>
+              <src>src/examples</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${lib.dir}/examples</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>src/main/puppet</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/${project.artifactId}/puppet</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>conf/unix/ambari-agent.ini</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/etc/ambari-agent/conf</prefix>
+                  <user>root</user>
+                  <group>root</group>
+                  <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>${basedir}/target/src/ambari-agent</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/sbin</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>conf/unix/ambari-env.sh</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/ambari-agent</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>700</filemode>
+              </mapper>
+            </data>
+            <data>
+              <type>template</type>
+              <paths>
+                <path>${package.pid.dir}</path>
+                <path>/var/lib/${project.artifactId}/data</path>
+                <path>/var/lib/${project.artifactId}/keys</path>
+                <path>${package.log.dir}</path>
+              </paths>
+              <mapper>
+                <type>perm</type>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>etc/init.d/ambari-agent</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/etc/init.d</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>${basedir}/target/src/version</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/${project.artifactId}/data</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>${target.cache.dir}</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/ambari-agent/cache</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+          </dataSet>
+        </configuration>
+      </plugin>
       <plugin>
       <plugin>
         <groupId>com.github.goldin</groupId>
         <groupId>com.github.goldin</groupId>
         <artifactId>copy-maven-plugin</artifactId>
         <artifactId>copy-maven-plugin</artifactId>
@@ -428,6 +588,32 @@
               </resources>
               </resources>
             </configuration>
             </configuration>
           </execution>
           </execution>
+           <execution>
+            <id>copy-resources-filter</id>
+            <phase>prepare-package</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/src</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>conf/unix</directory>
+                  <includes>
+                    <include>ambari-agent</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+                <resource>
+                  <directory>..</directory>
+                  <includes>
+                    <include>version</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
         </executions>
         </executions>
       </plugin>
       </plugin>
       <plugin>
       <plugin>
@@ -451,7 +637,7 @@
           <version>${buildnumber-maven-plugin-version}</version>
           <version>${buildnumber-maven-plugin-version}</version>
           <configuration>
           <configuration>
               <urlScm>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-ambari.git</urlScm>
               <urlScm>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-ambari.git</urlScm>
-          </configuration>    
+          </configuration>
           <executions>
           <executions>
               <execution>
               <execution>
                   <phase>validate</phase>
                   <phase>validate</phase>
@@ -460,7 +646,7 @@
                   </goals>
                   </goals>
               </execution>
               </execution>
           </executions>
           </executions>
-      </plugin>      
+      </plugin>
     </plugins>
     </plugins>
     <extensions>
     <extensions>
       <extension>
       <extension>

+ 22 - 0
ambari-agent/src/main/package/deb/control/control

@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+Package: [[artifactId]]
+Version: [[version]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Depends: [[deb.dependency.list]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 34 - 0
ambari-agent/src/main/package/deb/control/postinst

@@ -0,0 +1,34 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+if [ "$1" == "configure" ]; # Action is install
+then
+  update-rc.d ambari-agent defaults
+fi
+
+
+chmod 755 /usr/lib/ambari-agent/lib/facter-1.6.10/bin/facter /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/filebucket /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/pi /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/puppet /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/puppetdoc /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/ralsh /usr/lib/ambari-agent/lib/ruby-1.8.7-p370/bin/*
+
+BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
+ORIG=/etc/ambari-agent/conf/ambari-agent.ini
+
+if [ -f $BAK ];
+then
+  SERV_HOST=`grep -e hostname\s*= $BAK | sed -r -e 's/hostname\s*=//' -e 's/\./\\\./g'`
+  sed -i -r -e "s/(hostname\s*=).*/\1$SERV_HOST/" $ORIG
+  rm $BAK -f
+fi
+exit 0

+ 24 - 0
ambari-agent/src/main/package/deb/control/postrm

@@ -0,0 +1,24 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+if [ "$1" == "upgrade" ]; # Action is upgrade
+then
+  if [ -d "/etc/ambari-agent/conf.save" ]
+  then
+      cp -f /etc/ambari-agent/conf.save/* /etc/ambari-agent/conf
+      mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
+  fi
+fi

+ 15 - 0
ambari-agent/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 27 - 0
ambari-agent/src/main/package/deb/control/preinst

@@ -0,0 +1,27 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+if [ -d "/etc/ambari-agent/conf.save" ]
+then
+    mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
+fi
+
+BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
+ORIG=/etc/ambari-agent/conf/ambari-agent.ini
+
+[ -f $ORIG ] && mv -f $ORIG $BAK
+
+exit 0

+ 33 - 0
ambari-agent/src/main/package/deb/control/prerm

@@ -0,0 +1,33 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+# WARNING: This script is performed not only on uninstall, but also
+# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/
+# for details
+
+if [ "$1" == "remove" ]; # Action is uninstall
+then
+    /usr/sbin/ambari-agent stop > /dev/null 2>&1
+    if [ -d "/etc/ambari-agent/conf.save" ]
+    then
+        mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save
+    fi
+    mv /etc/ambari-agent/conf /etc/ambari-agent/conf.save
+
+    update-rc.d -f ambari-agent remove
+fi
+
+exit 0

+ 25 - 0
ambari-client/pom.xml

@@ -145,6 +145,31 @@
           </mappings>
           </mappings>
         </configuration>
         </configuration>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dataSet>
+            <data>
+              <src>${project.build.directory}/${project.artifactId}-${project.version}/ambari_client</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${install.dir}</prefix>
+              </mapper>
+            </data>
+          </dataSet>
+        </configuration>
+      </plugin>
       <plugin>
       <plugin>
         <groupId>org.apache.rat</groupId>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <artifactId>apache-rat-plugin</artifactId>

+ 21 - 0
ambari-client/src/main/package/deb/control/control

@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+Package: [[artifactId]]
+Version: [[version]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 15 - 0
ambari-client/src/main/package/deb/control/postinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-client/src/main/package/deb/control/postrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-client/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-client/src/main/package/deb/control/preinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-client/src/main/package/deb/control/prerm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 16 - 0
ambari-project/pom.xml

@@ -81,6 +81,22 @@
               </execution>
               </execution>
             </executions>
             </executions>
           </plugin>
           </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mappings/>
+        </configuration>
+      </plugin>
         </plugins>
         </plugins>
       </build>
       </build>
     </profile>
     </profile>

+ 21 - 0
ambari-project/src/main/package/deb/control/control

@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+Package: [[artifactId]]
+Version: [[version]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 15 - 0
ambari-project/src/main/package/deb/control/postinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-project/src/main/package/deb/control/postrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-project/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-project/src/main/package/deb/control/preinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-project/src/main/package/deb/control/prerm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 389 - 10
ambari-server/pom.xml

@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml version="1.0"?>
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); you 
-  may not use this file except in compliance with the License. You may obtain 
-  a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
-  required by applicable law or agreed to in writing, software distributed 
-  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 
-  OR CONDITIONS OF ANY KIND, either express or implied. See the License for 
-  the specific language governing permissions and limitations under the License. 
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you
+  may not use this file except in compliance with the License. You may obtain
+  a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
+  required by applicable law or agreed to in writing, software distributed
+  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+  OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+  the specific language governing permissions and limitations under the License.
   See accompanying LICENSE file. -->
   See accompanying LICENSE file. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -25,6 +25,10 @@
   <properties>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <python.ver>python &gt;= 2.6</python.ver>
     <python.ver>python &gt;= 2.6</python.ver>
+    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
+    <deb.architecture>amd64</deb.architecture>
+    <deb.dependency.list>openssl, postgresql (&gt;= 8.1), ${deb.python.ver}</deb.dependency.list>
+
     <custom.tests>false</custom.tests>
     <custom.tests>false</custom.tests>
     <hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
     <hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
     <ambari-web-dir>${basedir}/../ambari-web/public</ambari-web-dir>
     <ambari-web-dir>${basedir}/../ambari-web/public</ambari-web-dir>
@@ -425,6 +429,348 @@
           </mappings>
           </mappings>
         </configuration>
         </configuration>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <!-- unbinds rpm creation from maven lifecycle -->
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dataSet>
+            <data>
+              <type>template</type>
+              <paths>
+                <path>/usr/lib/ambari-server</path>
+                <path>/var/run/ambari-server</path>
+                <path>/var/run/ambari-server/bootstrap</path>
+                <path>/var/log/ambari-server</path>
+                <path>/var/lib/ambari-server/resources/upgrade</path>
+              </paths>
+            </data>
+            <!-- TODO: should be included all subdirs, if exists-->
+            <data>
+              <src>${basedir}/../ambari-web/public</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/lib/ambari-server/web</prefix>
+              </mapper>
+            </data>
+            <data>
+              <src>${project.build.directory}/${project.artifactId}-${project.version}-dist/${project.artifactId}-${project.version}/lib</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/lib</prefix>
+              </mapper>
+            </data>
+            <data>
+              <src>src/main/python/ambari-server.py</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/sbin</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>src/main/python/ambari-server.py</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/sbin</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+            <data>
+              <src>${basedir}/target/src/ambari-server</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/usr/sbin</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
+          <data>
+            <src>conf/unix/ambari.properties</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/etc/ambari-server/conf</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>conf/unix/log4j.properties</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/etc/ambari-server/conf</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>conf/unix/krb5JAASLogin.conf</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/etc/ambari-server/conf</prefix>
+            </mapper>
+          </data>
+           <!-- /q001 -->
+          <data>
+            <src>conf/unix/ambari-env.sh</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>700</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>conf/unix/ca.config</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/keys</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/db</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/keys/db</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>700</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>target/classes/Ambari-DDL-Postgres-CREATE.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/Ambari-DDL-Postgres-DROP.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>target/classes/Ambari-DDL-Postgres-REMOTE-CREATE.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/Ambari-DDL-Postgres-REMOTE-DROP.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>target/classes/Ambari-DDL-Oracle-CREATE.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>target/classes/Ambari-DDL-MySQL-CREATE.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/Ambari-DDL-Oracle-DROP.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/Ambari-DDL-MySQL-DROP.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/hive-schema-0.10.0.oracle.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/hive-schema-0.12.0.oracle.sql</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>${project.build.directory}/DBConnectionVerification.jar</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/role_command_order.json</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/scripts</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/scripts</prefix>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/python/UpgradeHelper_HDP2.py</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/scripts</prefix>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/upgrade/ddl</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/upgrade/ddl</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/upgrade/dml</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/upgrade/dml</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>target/classes/stacks/HDP</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/stacks/HDP</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/python/ambari_server</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/usr/lib/python2.6/site-packages/ambari_server</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/python/bootstrap.py</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/usr/lib/python2.6/site-packages/ambari_server</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/python/setupAgent.py</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/usr/lib/python2.6/site-packages/ambari_server</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/python/os_type_check.sh</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/usr/lib/python2.6/site-packages/ambari_server</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          <data>
+            <src>${basedir}/target/src/version</src>
+            <type>file</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/custom_action_definitions</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/custom_action_definitions</prefix>
+            </mapper>
+          </data>
+          <data>
+            <src>src/main/resources/custom_actions</src>
+            <type>directory</type>
+            <mapper>
+              <type>perm</type>
+              <prefix>/var/lib/ambari-server/resources/custom_actions</prefix>
+              <user>root</user>
+              <group>root</group>
+              <filemode>755</filemode>
+            </mapper>
+          </data>
+          </dataSet>
+        </configuration>
+      </plugin>
       <plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
         <artifactId>findbugs-maven-plugin</artifactId>
@@ -471,7 +817,7 @@
         <groupId>com.atlassian.maven.plugins</groupId>
         <groupId>com.atlassian.maven.plugins</groupId>
         <artifactId>maven-clover2-plugin</artifactId>
         <artifactId>maven-clover2-plugin</artifactId>
         <version>3.1.11</version>
         <version>3.1.11</version>
-        <!-- <configuration> <licenseLocation>/path/to/clover.license</licenseLocation> 
+        <!-- <configuration> <licenseLocation>/path/to/clover.license</licenseLocation>
           </configuration> -->
           </configuration> -->
       </plugin>
       </plugin>
       <plugin>
       <plugin>
@@ -515,6 +861,39 @@
           </execution>
           </execution>
         </executions>
         </executions>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.6</version>
+          <executions>
+           <execution>
+            <id>copy-resources</id>
+            <phase>prepare-package</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/src</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>sbin</directory>
+                  <includes>
+                    <include>ambari-server</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+                <resource>
+                  <directory>..</directory>
+                  <includes>
+                    <include>version</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
     </plugins>
     <resources>
     <resources>
       <resource>
       <resource>
@@ -870,7 +1249,7 @@
       <version>2.2.1</version>
       <version>2.2.1</version>
     </dependency>
     </dependency>
   </dependencies>
   </dependencies>
-  <!--<reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> 
-    <artifactId>findbugs-maven-plugin</artifactId> <version>2.5.2</version> </plugin> 
+  <!--<reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId>
+    <artifactId>findbugs-maven-plugin</artifactId> <version>2.5.2</version> </plugin>
     </plugins> </reporting> -->
     </plugins> </reporting> -->
 </project>
 </project>

+ 22 - 0
ambari-server/src/main/package/deb/control/control

@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+Package: [[artifactId]]
+Version: [[version]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Depends: [[deb.dependency.list]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 30 - 0
ambari-server/src/main/package/deb/control/postinst

@@ -0,0 +1,30 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+if [ -e "/etc/init.d/ambari-server" ];
+then # Check is needed for upgrade
+    # Remove link created by previous package version
+    rm /etc/init.d/ambari-server
+fi
+
+ln -s /usr/sbin/ambari-server /etc/init.d/ambari-server
+
+if [ "$1" == "configure" ]; # Action is install
+then
+  update-rc.d ambari-server defaults
+fi
+
+exit 0

+ 15 - 0
ambari-server/src/main/package/deb/control/postrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-server/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 22 - 0
ambari-server/src/main/package/deb/control/preinst

@@ -0,0 +1,22 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+if [ -d "/etc/ambari-server/conf.save" ]
+then
+    mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save
+fi
+
+exit 0

+ 40 - 0
ambari-server/src/main/package/deb/control/prerm

@@ -0,0 +1,40 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+# WARNING: This script is performed not only on uninstall, but also
+# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/
+# for details
+
+if [ "$1" == "remove" ]; # Action is uninstall
+then
+    /usr/sbin/ambari-server stop > /dev/null 2>&1
+    if [ -d "/etc/ambari-server/conf.save" ]
+    then
+        mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save
+    fi
+
+    if [ -e "/etc/init.d/ambari-server" ];
+    then
+        # Remove link created during install
+        rm /etc/init.d/ambari-server
+    fi
+
+    mv /etc/ambari-server/conf /etc/ambari-server/conf.save
+
+    update-rc.d -f ambari-server remove
+fi
+
+exit 0

+ 16 - 0
ambari-views/pom.xml

@@ -123,6 +123,22 @@
                     </execution>
                     </execution>
                 </executions>
                 </executions>
             </plugin>
             </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+            <skip>true</skip>
+        </configuration>
+      </plugin>
         </plugins>
         </plugins>
     </build>
     </build>
 </project>
 </project>

+ 21 - 0
ambari-views/src/main/package/deb/control/control

@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+Package: [[artifactId]]
+Version: [[version]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 15 - 0
ambari-views/src/main/package/deb/control/postinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-views/src/main/package/deb/control/postrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-views/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-views/src/main/package/deb/control/preinst

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 15 - 0
ambari-views/src/main/package/deb/control/prerm

@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License

+ 17 - 1
ambari-web/pom.xml

@@ -58,6 +58,22 @@
           <mappings/>
           <mappings/>
         </configuration>
         </configuration>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <!-- unbinds deb creation from maven lifecycle -->
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+        </configuration>
+      </plugin>
       <plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-antrun-plugin</artifactId>
         <artifactId>maven-antrun-plugin</artifactId>
@@ -127,7 +143,7 @@
             </goals>
             </goals>
             <configuration>
             <configuration>
               <target name="ambari-web-test">
               <target name="ambari-web-test">
-                <!-- 
+                <!--
                 <exec dir="${basedir}" executable="brunch" failonerror="false">
                 <exec dir="${basedir}" executable="brunch" failonerror="false">
                   <arg value="test"/>
                   <arg value="test"/>
                 </exec>
                 </exec>

+ 29 - 1
pom.xml

@@ -27,6 +27,11 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <clover.license>${user.home}/clover.license</clover.license>
     <clover.license>${user.home}/clover.license</clover.license>
     <buildnumber-maven-plugin-version>1.2</buildnumber-maven-plugin-version>
     <buildnumber-maven-plugin-version>1.2</buildnumber-maven-plugin-version>
+    <deb.publisher>Hortonworks</deb.publisher>
+    <deb.section>universe/admin</deb.section>
+    <deb.architecture>i386 amd64</deb.architecture>
+    <deb.priority>extra</deb.priority>
+
   </properties>
   </properties>
   <pluginRepositories>
   <pluginRepositories>
     <pluginRepository>
     <pluginRepository>
@@ -65,6 +70,10 @@
           <artifactId>rpm-maven-plugin</artifactId>
           <artifactId>rpm-maven-plugin</artifactId>
           <version>2.0.1</version>
           <version>2.0.1</version>
         </plugin>
         </plugin>
+        <plugin>
+          <groupId>org.vafer</groupId>
+          <artifactId>jdeb</artifactId>
+        </plugin>
       </plugins>
       </plugins>
     </pluginManagement>
     </pluginManagement>
     <plugins>
     <plugins>
@@ -114,6 +123,26 @@
           <mappings/>
           <mappings/>
         </configuration>
         </configuration>
       </plugin>
       </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <verbose>false</verbose>
+          <submodules>true</submodules>
+          <deb>${basedir}/target/${artifactId}_${version}.deb</deb>
+          <skip>false</skip>
+          <controlDir>${basedir}/src/main/package/deb/control</controlDir>
+        </configuration>
+      </plugin>
       <plugin>
       <plugin>
         <groupId>org.apache.rat</groupId>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <artifactId>apache-rat-plugin</artifactId>
@@ -125,7 +154,6 @@
             <exclude>pass.txt</exclude>
             <exclude>pass.txt</exclude>
             <exclude>contrib/addons/test/dataServices/jmx/data/cluster_configuration.json.nohbase</exclude>
             <exclude>contrib/addons/test/dataServices/jmx/data/cluster_configuration.json.nohbase</exclude>
             <exclude>version</exclude>
             <exclude>version</exclude>
-
             <!--IDE and GIT files-->
             <!--IDE and GIT files-->
             <exclude>.idea/</exclude>
             <exclude>.idea/</exclude>
             <exclude>.git/</exclude>
             <exclude>.git/</exclude>