You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/09/13 13:52:09 UTC

[2/6] brooklyn-dist git commit: Improve RPM package

Improve RPM package


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/4118fc4f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/4118fc4f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/4118fc4f

Branch: refs/heads/master
Commit: 4118fc4f936d7fa440d5961880af2465afa89928
Parents: 1eb9be8
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Wed Sep 6 14:59:22 2017 +0100
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Fri Sep 8 17:22:19 2017 +0100

----------------------------------------------------------------------
 .../main/filtered-resources/etc/brooklyn.cfg    |  24 +++
 .../src/main/resources/bin/runbrooklyn          |  39 +++++
 .../src/main/resources/bin/setenv               |   7 +
 .../org.apache.brooklyn.osgilauncher.cfg        |   2 +-
 rpm-packaging/pom.xml                           | 162 ++++++++++++++-----
 rpm-packaging/rpm/postinstall.sh                |   3 -
 rpm-packaging/rpm/preinstall.sh                 |  10 ++
 .../resources/service/systemd/brooklyn.service  |  10 +-
 .../resources/service/upstart/rpm/brooklyn.conf |  14 +-
 .../src/test/yaml/package-apps.yaml             |   4 +-
 shared-packaging/src/test/yaml/package.bom      |  44 ++---
 11 files changed, 240 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg b/karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg
new file mode 100644
index 0000000..abf8550
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg
@@ -0,0 +1,24 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+# Web login credentials
+
+# Credentials for user 'admin'
+brooklyn.webconsole.security.users=admin
+brooklyn.webconsole.security.user.admin.password=password

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/karaf/apache-brooklyn/src/main/resources/bin/runbrooklyn
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/bin/runbrooklyn b/karaf/apache-brooklyn/src/main/resources/bin/runbrooklyn
new file mode 100644
index 0000000..59c9554
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/resources/bin/runbrooklyn
@@ -0,0 +1,39 @@
+#!/usr/bin/env 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.
+
+# This script is a convenience wrapper for use to avoid problems on Centos 6
+# Upstart is too old on CentOS 6, at least v1.4 required to use setuid, setgid.
+# This script does the setuid and handles termination via signals.
+
+trap terminate_all SIGTERM
+trap kill_all SIGKILL
+
+function terminate_all () {
+  pkill -SIGTERM -g ${PGROUP}
+  kill -s SIGTERM ${KARAF}
+}
+function kill_all () {
+  pkill -SIGKILL -g ${PGROUP}
+  kill -s SIGKILL ${KARAF}
+}
+
+su -c "/opt/brooklyn/bin/karaf server  >> /dev/null 2>&1" brooklyn & KARAF=$!
+sleep 1 # gives time for process structure to be established
+PGROUP=$(pgrep -P $KARAF)
+wait

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/karaf/apache-brooklyn/src/main/resources/bin/setenv
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/bin/setenv b/karaf/apache-brooklyn/src/main/resources/bin/setenv
index 9a109fd..88cbc6a 100644
--- a/karaf/apache-brooklyn/src/main/resources/bin/setenv
+++ b/karaf/apache-brooklyn/src/main/resources/bin/setenv
@@ -75,6 +75,10 @@ if [ "x$JAVA" = "x" ]; then
     fi
 fi
 
+if [ -z "${BROOKLYN_PERSISTENCE_DIR}" ] ; then
+    export BROOKLYN_PERSISTENCE_DIR="~/.brooklyn/brooklyn-persisted-state"
+fi
+
 # force resolution of localhost to be loopback
 export EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 ${EXTRA_JAVA_OPTS}"
 
@@ -83,3 +87,6 @@ export EXTRA_JAVA_OPTS="-XX:SoftRefLRUPolicyMSPerMB=1 ${EXTRA_JAVA_OPTS}"
 
 # Set the TLS protocol versions
 export EXTRA_JAVA_OPTS="-Dhttps.protocols=TLSv1.1,TLSv1.2 ${EXTRA_JAVA_OPTS}"
+
+# Set the persistence directory
+export EXTRA_JAVA_OPTS="-Dbrooklyn.persistence.dir=${BROOKLYN_PERSISTENCE_DIR} ${EXTRA_JAVA_OPTS}"

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/karaf/config/src/main/resources/org.apache.brooklyn.osgilauncher.cfg
----------------------------------------------------------------------
diff --git a/karaf/config/src/main/resources/org.apache.brooklyn.osgilauncher.cfg b/karaf/config/src/main/resources/org.apache.brooklyn.osgilauncher.cfg
index 84b750c..6f80460 100644
--- a/karaf/config/src/main/resources/org.apache.brooklyn.osgilauncher.cfg
+++ b/karaf/config/src/main/resources/org.apache.brooklyn.osgilauncher.cfg
@@ -58,7 +58,7 @@ default.catalog.location=${karaf.etc}/default.catalog.bom
 #persistMode=AUTO
 
 # The directory to read/write persisted state (or container name if using an object store)
-#persistenceDir=
+persistenceDir=${brooklyn.persistence.dir}
 
 # The location spec for an object store to read/write persisted state
 #persistenceLocation=

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/rpm-packaging/pom.xml
----------------------------------------------------------------------
diff --git a/rpm-packaging/pom.xml b/rpm-packaging/pom.xml
index b2b7075..b816555 100644
--- a/rpm-packaging/pom.xml
+++ b/rpm-packaging/pom.xml
@@ -26,6 +26,14 @@
         Brooklyn RPM Package for Centos 7 and RHEL 7 operating systems
     </description>
 
+    <properties>
+        <brooklyn.directory.permission.default>740</brooklyn.directory.permission.default>
+        <brooklyn.directory.permission.root>740</brooklyn.directory.permission.root>
+        <brooklyn.file.permission.default>740</brooklyn.file.permission.default>
+        <brooklyn.file.permission.bin>740</brooklyn.file.permission.bin>
+        <brooklyn.file.permission.global>664</brooklyn.file.permission.global>
+    </properties>
+
     <parent>
         <groupId>org.apache.brooklyn</groupId>
         <artifactId>brooklyn-dist-root</artifactId>
@@ -36,8 +44,9 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-dist</artifactId>
+            <artifactId>apache-brooklyn</artifactId>
             <version>${project.version}</version>
+            <type>zip</type>
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
@@ -58,23 +67,22 @@
                             <goal>unpack</goal>
                         </goals>
                         <configuration>
-                          <artifactItems>
-                            <artifactItem>
-                              <groupId>org.apache.brooklyn</groupId>
-                              <artifactId>brooklyn-dist</artifactId>
-                              <version>${project.version}</version>
-                              <classifier>dist</classifier>
-                              <type>tar.gz</type>
-                              <outputDirectory>${project.build.directory}/deps</outputDirectory>
-                            </artifactItem>
-                            <artifactItem>
-                              <groupId>org.apache.brooklyn</groupId>
-                              <artifactId>shared-packaging</artifactId>
-                              <version>${project.version}</version>
-                              <type>jar</type>
-                              <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
-                            </artifactItem>
-                          </artifactItems>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.brooklyn</groupId>
+                                    <artifactId>apache-brooklyn</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>zip</type>
+                                    <outputDirectory>${project.build.directory}/deps</outputDirectory>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.brooklyn</groupId>
+                                    <artifactId>shared-packaging</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
                         </configuration>
                     </execution>
                 </executions>
@@ -97,66 +105,90 @@
                     <group>Applications/Internet</group>
                     <changelogFile><!--TODO--></changelogFile>
                     <needarch>noarch</needarch>
+                    <classifier>noarch</classifier>
                     <targetOS>Linux</targetOS>
                     <requires>
-                        <require>java</require>
+                        <require>java-1.8.0</require>
                     </requires>
                     <defineStatements>
                         <defineStatement>_binaries_in_noarch_packages_terminate_build 0</defineStatement>
                     </defineStatements>
-                    <defaultDirmode>755</defaultDirmode>
-                    <defaultFilemode>644</defaultFilemode>
+                    <defaultDirmode>${brooklyn.directory.permission.default}</defaultDirmode>
+                    <defaultFilemode>${brooklyn.file.permission.default}</defaultFilemode>
                     <defaultGroupname>brooklyn</defaultGroupname>
                     <defaultUsername>brooklyn</defaultUsername>
                     <mappings>
                         <mapping>
-                            <directory>/etc/brooklyn</directory>
-                            <configuration>true</configuration>
+                            <directory>/opt/brooklyn-${project.version}</directory>
                         </mapping>
                         <mapping>
-                            <directory>/etc/brooklyn</directory>
-                            <configuration>true</configuration>
-                            <filemode>600</filemode>
-                            <username>brooklyn</username>
-                            <groupname>brooklyn</groupname>
+                            <directory>/opt/brooklyn-${project.version}/bin</directory>
+                            <filemode>${brooklyn.file.permission.bin}</filemode>
                             <sources>
                                 <source>
-                                    <location>${project.build.directory}/deps/shared-packaging/conf/brooklyn.conf</location>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/bin</location>
                                 </source>
                             </sources>
                         </mapping>
                         <mapping>
-                            <directory>/etc/brooklyn</directory>
-                            <configuration>true</configuration>
+                            <directory>/opt/brooklyn-${project.version}/catalog</directory>
                             <sources>
                                 <source>
-                                    <location>${project.build.directory}/deps/shared-packaging/conf/logback.xml</location>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/catalog</location>
                                 </source>
                             </sources>
                         </mapping>
                         <mapping>
-                            <directory>/opt/brooklyn</directory>
+                            <directory>/opt/brooklyn-${project.version}/data</directory>
+                            <directoryIncluded>true</directoryIncluded>
+                            <recurseDirectories>true</recurseDirectories>
                             <sources>
                                 <source>
-                                    <location>${project.build.directory}/deps/brooklyn-dist-${project.version}</location>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/data</location>
                                 </source>
                             </sources>
                         </mapping>
                         <mapping>
-                            <directory>/var/lib/brooklyn</directory>
-                            <configuration>true</configuration>
+                            <directory>/opt/brooklyn-${project.version}/data/log</directory>
                         </mapping>
                         <mapping>
-                            <directory>/var/log/brooklyn</directory>
-                            <configuration>true</configuration>
-                            <filemode>700</filemode>
-                            <username>brooklyn</username>
-                            <groupname>brooklyn</groupname>
+                            <directory>/opt/brooklyn-${project.version}/deploy</directory>
+                            <sources>
+                                <source>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/deploy</location>
+                                </source>
+                            </sources>
                         </mapping>
                         <mapping>
-                            <directory>/etc/systemd/system/multi-user.target.wants</directory>
+                            <directory>/etc/brooklyn</directory>
+                            <configuration>noreplace</configuration>
+                            <filemode>${brooklyn.file.permission.default}</filemode>
+                            <sources>
+                                <source>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/etc</location>
+                                </source>
+                            </sources>
+                        </mapping>
+                        <mapping>
+                            <directory>/opt/brooklyn-${project.version}/lib</directory>
+                            <sources>
+                                <source>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/lib</location>
+                                </source>
+                            </sources>
+                        </mapping>
+                        <mapping>
+                            <directory>/opt/brooklyn-${project.version}/system</directory>
+                            <sources>
+                                <source>
+                                    <location>${project.build.directory}/deps/apache-brooklyn-${project.version}/system</location>
+                                </source>
+                            </sources>
+                        </mapping>
+                        <mapping>
+                            <directory>/lib/systemd/system</directory>
                             <directoryIncluded>false</directoryIncluded>
-                            <filemode>644</filemode>
+                            <filemode>${brooklyn.file.permission.global}</filemode>
                             <username>root</username>
                             <groupname>root</groupname>
                             <sources>
@@ -168,7 +200,7 @@
                         <mapping>
                             <directory>/etc/init</directory>
                             <directoryIncluded>false</directoryIncluded>
-                            <filemode>644</filemode>
+                            <filemode>${brooklyn.file.permission.global}</filemode>
                             <username>root</username>
                             <groupname>root</groupname>
                             <sources>
@@ -177,6 +209,48 @@
                                 </source>
                             </sources>
                         </mapping>
+                        <mapping>
+                            <directory>/etc/systemd/system/multi-user.target.wants</directory>
+                            <directoryIncluded>false</directoryIncluded>
+                            <filemode>${brooklyn.file.permission.global}</filemode>
+                            <username>root</username>
+                            <groupname>root</groupname>
+                            <sources>
+                                <source>
+                                    <location>${project.build.directory}/deps/shared-packaging/service/systemd</location>
+                                </source>
+                            </sources>
+                        </mapping>
+                        <mapping>
+                            <directory>/var/lib/brooklyn</directory>
+                            <filemode>${brooklyn.file.permission.default}</filemode>
+                        </mapping>
+                        <mapping>
+                            <directory>/opt/brooklyn</directory>
+                            <sources>
+                                <softlinkSource>
+                                    <location>/opt/brooklyn-${project.version}</location>
+                                </softlinkSource>
+                            </sources>
+                        </mapping>
+                        <mapping>
+                            <directory>/var/log/brooklyn</directory>
+                            <sources>
+                                <softlinkSource>
+                                    <location>/opt/brooklyn-${project.version}/data/log</location>
+                                </softlinkSource>
+                            </sources>
+                        </mapping>
+                        <!-- There is a bug in karaf 4.1.2 that ignores the KARAF_ETC envvar. The workaround is to softlink to the etc folder -->
+                        <!-- Until it is resolved: https://issues.apache.org/jira/browse/KARAF-5352 -->
+                        <mapping>
+                            <directory>/opt/brooklyn-${project.version}/etc</directory>
+                            <sources>
+                                <softlinkSource>
+                                    <location>/etc/brooklyn</location>
+                                </softlinkSource>
+                            </sources>
+                        </mapping>
                     </mappings>
                     <preinstallScriptlet>
                         <scriptFile>${basedir}/rpm/preinstall.sh</scriptFile>

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/rpm-packaging/rpm/postinstall.sh
----------------------------------------------------------------------
diff --git a/rpm-packaging/rpm/postinstall.sh b/rpm-packaging/rpm/postinstall.sh
index 4782a23..13abadd 100644
--- a/rpm-packaging/rpm/postinstall.sh
+++ b/rpm-packaging/rpm/postinstall.sh
@@ -19,7 +19,4 @@
 
 if which systemctl >> /dev/null 2>&1; then
     systemctl daemon-reload
-    systemctl start brooklyn.service
-else
-    initctl start brooklyn
 fi

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/rpm-packaging/rpm/preinstall.sh
----------------------------------------------------------------------
diff --git a/rpm-packaging/rpm/preinstall.sh b/rpm-packaging/rpm/preinstall.sh
index 666327f..7da5acf 100644
--- a/rpm-packaging/rpm/preinstall.sh
+++ b/rpm-packaging/rpm/preinstall.sh
@@ -19,3 +19,13 @@
 
 getent group brooklyn || groupadd -r brooklyn
 getent passwd brooklyn || useradd -r -g brooklyn -d /opt/brooklyn -s /sbin/nologin brooklyn
+# Remove the symbolic link "/opt/brooklyn" if exists (means that we are upgrading brooklyn)
+BROOKLYN_ROOT=/opt/brooklyn
+if [[ -L $BROOKLYN_ROOT && -d $BROOKLYN_ROOT ]]; then
+    rm -f $BROOKLYN_ROOT
+fi
+# Remove the symbolic link "/var/log/brooklyn" if exists (means that we are upgrading brooklyn)
+BROOKLYN_LOG=/var/log/brooklyn
+if [[ -L $BROOKLYN_LOG && -d $BROOKLYN_LOG ]]; then
+    rm -f $BROOKLYN_LOG
+fi

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/shared-packaging/src/main/resources/service/systemd/brooklyn.service
----------------------------------------------------------------------
diff --git a/shared-packaging/src/main/resources/service/systemd/brooklyn.service b/shared-packaging/src/main/resources/service/systemd/brooklyn.service
index 52dd3b6..ef861bd 100644
--- a/shared-packaging/src/main/resources/service/systemd/brooklyn.service
+++ b/shared-packaging/src/main/resources/service/systemd/brooklyn.service
@@ -22,12 +22,16 @@ Documentation=https://brooklyn.apache.org/documentation/index.html
 [Service]
 Type=simple
 WorkingDirectory=/opt/brooklyn/
-Environment="JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"
-Environment="CLASSPATH=/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-ExecStart=/usr/bin/java $JAVA_OPTS -cp "$CLASSPATH" org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties --localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto
+Environment="EXTRA_JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx1g"
+Environment="KARAF_HOME=/opt/brooklyn"
+Environment="KARAF_ETC=/etc/brooklyn"
+Environment="KARAF_REDIRECT=/dev/null"
+Environment="BROOKLYN_PERSISTENCE_DIR=/var/lib/brooklyn"
+ExecStart=/opt/brooklyn/bin/karaf server  >> "$KARAF_REDIRECT" 2>&1
 Restart=always
 User=brooklyn
 Group=brooklyn
+UMask=0066
 
 [Install]
 WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
----------------------------------------------------------------------
diff --git a/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf b/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
index 804e0cd..1af0674 100644
--- a/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
+++ b/shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf
@@ -22,6 +22,7 @@ start on runlevel [23]
 stop on runlevel [016]
 respawn
 respawn limit 5 10
+umask 0066
 
 console output
 
@@ -30,13 +31,14 @@ pre-start script
 end script
 
 script
-    BROOKLYN_HOME="/opt/brooklyn/"
-    JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"
-    CLASSPATH="/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-    export BROOKLYN_HOME
-    # Upstart is too old on CentOS 6, at least v1.4 required to use setuid, setgid.
+    EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx1g"
+    KARAF_HOME="/opt/brooklyn/"
+    KARAF_ETC="/etc/brooklyn/"
+    KARAF_REDIRECT=/dev/null
+    BROOKLYN_PERSISTENCE_DIR="/var/lib/brooklyn"
+    export EXTRA_JAVA_OPTS KARAF_REDIRECT KARAF_HOME KARAF_ETC BROOKLYN_PERSISTENCE_DIR
     chsh -s /bin/bash brooklyn
-    exec su -c "java ${JAVA_OPTS} -cp $CLASSPATH org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties --localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto" brooklyn
+    exec /opt/brooklyn/bin/runbrooklyn  >> "$KARAF_REDIRECT" 2>&1
 end script
 
 pre-stop script

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/shared-packaging/src/test/yaml/package-apps.yaml
----------------------------------------------------------------------
diff --git a/shared-packaging/src/test/yaml/package-apps.yaml b/shared-packaging/src/test/yaml/package-apps.yaml
index de4420c..bda0c51 100644
--- a/shared-packaging/src/test/yaml/package-apps.yaml
+++ b/shared-packaging/src/test/yaml/package-apps.yaml
@@ -51,7 +51,7 @@ services:
       # privateKeyFile: ~/.ssh/<private key>
       user: vagrant
   brooklyn.config:
-    package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.12.0-SNAPSHOT/rpm-packaging-0.12.0-SNAPSHOT.rpm # BROOKLYN_VERSION
+    package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.12.0-SNAPSHOT/rpm-packaging-0.12.0-SNAPSHOT-noarch.rpm # BROOKLYN_VERSION
 
 ---
 
@@ -64,6 +64,6 @@ services:
       # privateKeyFile: ~/.ssh/<private key>
       user: vagrant
   brooklyn.config:
-    package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.12.0-SNAPSHOT/rpm-packaging-0.12.0-SNAPSHOT.rpm # BROOKLYN_VERSION
+    package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.12.0-SNAPSHOT/rpm-packaging-0.12.0-SNAPSHOT-noarch.rpm # BROOKLYN_VERSION
 
 

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/4118fc4f/shared-packaging/src/test/yaml/package.bom
----------------------------------------------------------------------
diff --git a/shared-packaging/src/test/yaml/package.bom b/shared-packaging/src/test/yaml/package.bom
index c17cb2c..bc1780d 100644
--- a/shared-packaging/src/test/yaml/package.bom
+++ b/shared-packaging/src/test/yaml/package.bom
@@ -79,8 +79,8 @@ brooklyn.catalog:
             sudo iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
             sudo service iptables save
           fi
-          sudo yum -y install java-1.7.0-openjdk.x86_64
           sudo yum -y install brooklyn-package.rpm
+          sudo systemctl start brooklyn
 
   - id: yum-upstart-brooklyn
     item:
@@ -95,9 +95,8 @@ brooklyn.catalog:
             sudo iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
             sudo service iptables save
           fi
-          sudo yum -y install java-1.7.0-openjdk.x86_64
           sudo yum -y install brooklyn-package.rpm
-
+          sudo initctl start brooklyn
 
 ### Tests ###
   - id: test-is-up
@@ -119,7 +118,7 @@ brooklyn.catalog:
       type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
       name: Check process has started
       # The brackets prevent grep from matching its own process
-      command: ps ax | grep "[o]rg.apache.brooklyn.cli.Main"
+      command: ps ax | grep "[/]opt/brooklyn/bin/karaf"
       assertStatus:
         equals: 0
       assertOut:
@@ -131,7 +130,7 @@ brooklyn.catalog:
       type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
       name: Check process is not started
       # The brackets prevent grep from matching its own process
-      command: ps ax | grep "[o]rg.apache.brooklyn.cli.Main"
+      command: ps ax | grep "[/]opt/brooklyn/bin/karaf"
       assertStatus:
         equals: 1
       assertOut:
@@ -143,7 +142,7 @@ brooklyn.catalog:
       type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
       name: Check user the process is running under
       # The brackets prevent grep from matching its own process
-      command: ps -fu brooklyn | grep "[o]rg.apache.brooklyn.cli.Main"
+      command: ps -fu brooklyn | grep "[/]opt/brooklyn/bin/karaf"
       assertStatus:
         equals: 0
       assertOut:
@@ -166,24 +165,25 @@ brooklyn.catalog:
       type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
       name: Check paths permissions
       command: |
-        [ "$(stat -c "%A %U %G" /opt/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
-        [ "$(stat -c "%A %U %G" /var/lib/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
-        [ "$(stat -c "%A %U %G" /var/log/brooklyn)" = "drwx------ brooklyn brooklyn" ] && \
-        [ "$(stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants)" = "drwxr-xr-x root root" ] && \
-        [ "$(sudo stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants/brooklyn.service)" = "-rw-r--r-- root root" ] && \
-        [ "$(stat -c "%A %U %G" /etc/init)" = "drwxr-xr-x root root" ] && \
-        [ "$(stat -c "%A %U %G" /etc/init/brooklyn.conf)" = "-rw-r--r-- root root" ] && \
-        [ "$(stat -c "%A %U %G" /etc/brooklyn)" = "drwxr-xr-x brooklyn brooklyn" ] && \
-        [ "$(sudo stat -c "%A %U %G" /etc/brooklyn/brooklyn.conf)" = "-rw------- brooklyn brooklyn" ] && \
-        [ "$(stat -c "%A %U %G" /etc/brooklyn/logback.xml)" = "-rw-r--r-- brooklyn brooklyn" ] && \
-        ! find /opt/brooklyn | xargs stat -c "%A %U %G" | grep -v "drwxr-xr-x brooklyn brooklyn\|-rw-r--r-- brooklyn brooklyn"
+        BROOKLYN_DIRECTORIES="/opt/brooklyn/ /etc/brooklyn/ /var/lib/brooklyn/ /var/log/brooklyn/"
+        [ "$(sudo stat -c "%A %U %G" /opt/brooklyn)" = "lrwxrwxrwx brooklyn brooklyn" ]
+        [ "$(sudo stat -c "%A %U %G" /etc/init)" = "drwxr-xr-x root root" ]
+        [ "$(sudo stat -c "%A %U %G" /lib/systemd/system/)" = "drwxr-xr-x root root" ]
+        [ "$(sudo stat -c "%A %U %G" /etc/init/brooklyn.conf)" = "-rw-rw-r-- root root" ]
+        [ "$(sudo stat -c "%A %U %G" /lib/systemd/system/brooklyn.service)" = "-rw-rw-r-- root root" ]
+        if hash systemctl ; then
+          [ "$(sudo stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants/brooklyn.service)" = "-rwxr----- root root" ]
+        fi
+        ! sudo ls -d /opt/brooklyn-* | xargs stat -c "%F %a %U %G" | grep -v -E "^directory\s740\sbrooklyn\sbrooklyn$"
+        ! sudo find ${BROOKLYN_DIRECTORIES} -type f | xargs sudo stat -c "%a %U %G" | grep -v -E "^[6,7][0,4,6][0]\sbrooklyn\sbrooklyn"
+        ! sudo find ${BROOKLYN_DIRECTORIES} -type d | xargs sudo stat -c "%a %U %G" | grep -v -E "^[6,7][0,1,4][0-1]\sbrooklyn\sbrooklyn"
       assertStatus:
         equals: 0
   - id: test-log-files-exist
     item:
       type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
       name: Check log files created at expected location
-      command: sudo ls /var/log/brooklyn/brooklyn.{debug,info}.log | wc -l
+      command: sudo ls /opt/brooklyn/data/log/brooklyn.{debug,info}.log | wc -l
       assertOut:
         equals: "2"
   - id: test-healthy
@@ -228,8 +228,8 @@ brooklyn.catalog:
   - id: packaging-asserts
     item:
       type: org.apache.brooklyn.test.framework.TestCase
-      targetId: brooklyn
       brooklyn.config:
+        targetId: brooklyn
         timeout: 1m
       brooklyn.children:
       - type: test-is-up
@@ -262,8 +262,12 @@ brooklyn.catalog:
         name: 13. Restart machine
       - type: test-is-not-up
         name: 14. Check not running while restarting
+      - type: test-is-up
+        name: 15. Wait for machine to fully restart
+        brooklyn.config:
+          timeout: 10m
       - type: test-healthy
-        name: 15. Check healthy
+        name: 16. Check healthy
 ### Combined tests with target entity - system specific ###
   - id: test-yum-upstart-brooklyn
     item: