aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/package
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/tools/package')
-rw-r--r--framework/src/onos/tools/package/archetypes/api/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/bundle/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/cli/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/ui/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/branding/pom.xml2
-rw-r--r--framework/src/onos/tools/package/deb/control8
-rw-r--r--framework/src/onos/tools/package/deb/copyright20
-rwxr-xr-xframework/src/onos/tools/package/deb/postinst16
-rwxr-xr-xframework/src/onos/tools/package/deb/postrm5
-rwxr-xr-xframework/src/onos/tools/package/deb/prerm23
-rw-r--r--framework/src/onos/tools/package/init/onos.conf37
-rw-r--r--framework/src/onos/tools/package/rpm/onos.spec71
17 files changed, 190 insertions, 10 deletions
diff --git a/framework/src/onos/tools/package/archetypes/api/pom.xml b/framework/src/onos/tools/package/archetypes/api/pom.xml
index d34db1f0..8deaada9 100644
--- a/framework/src/onos/tools/package/archetypes/api/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/api/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-api-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
index f29a327a..a0e54f3f 100644
--- a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
</properties>
<dependencies>
diff --git a/framework/src/onos/tools/package/archetypes/bundle/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/pom.xml
index ff6aa52e..65b55b2b 100644
--- a/framework/src/onos/tools/package/archetypes/bundle/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/bundle/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-bundle-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
index c9e747c9..222e8b03 100644
--- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.origin>Foo, Inc.</onos.app.origin>
diff --git a/framework/src/onos/tools/package/archetypes/cli/pom.xml b/framework/src/onos/tools/package/archetypes/cli/pom.xml
index 1ab9c1f2..a071eed1 100644
--- a/framework/src/onos/tools/package/archetypes/cli/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/cli/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-cli-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
index cb3862c3..f4602692 100644
--- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
</properties>
<dependencies>
diff --git a/framework/src/onos/tools/package/archetypes/pom.xml b/framework/src/onos/tools/package/archetypes/pom.xml
index 2fd5f874..525a2f68 100644
--- a/framework/src/onos/tools/package/archetypes/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>ONOS archetypes project</description>
diff --git a/framework/src/onos/tools/package/archetypes/ui/pom.xml b/framework/src/onos/tools/package/archetypes/ui/pom.xml
index ca7b2d87..8dd3a8e0 100644
--- a/framework/src/onos/tools/package/archetypes/ui/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/ui/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-ui-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
index a6beae99..2e1f091e 100644
--- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.origin>Foo, Inc.</onos.app.origin>
diff --git a/framework/src/onos/tools/package/branding/pom.xml b/framework/src/onos/tools/package/branding/pom.xml
index 452a03c9..be9c4165 100644
--- a/framework/src/onos/tools/package/branding/pom.xml
+++ b/framework/src/onos/tools/package/branding/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/framework/src/onos/tools/package/deb/control b/framework/src/onos/tools/package/deb/control
new file mode 100644
index 00000000..c581ac25
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/control
@@ -0,0 +1,8 @@
+Package: onos
+Architecture: all
+Maintainer: ONOS Project
+Depends: debconf (>= 0.5.00), default-jre-headless (>= 1.8) | openjdk-8-jre | oracle-java8-installer
+Priority: optional
+Version: @ONOS_POM_VERSION
+Description: Open Network Operating System (ONOS)
+ Open Network Operating System (ONOS) is an opensource SDN controller.
diff --git a/framework/src/onos/tools/package/deb/copyright b/framework/src/onos/tools/package/deb/copyright
new file mode 100644
index 00000000..09ec05e3
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/copyright
@@ -0,0 +1,20 @@
+Upstream-Name: onos
+Source: http://github.com/opennetworkinglab/onos
+
+Files: *
+Copyright: 2014-2015 Open Networking Laboratory
+License: Apache 2.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.
+ .
+ On Debian systems, the complete text of the Apache License 2.0 can
+ be found in "/usr/share/common-licenses/Apache-2.0"
diff --git a/framework/src/onos/tools/package/deb/postinst b/framework/src/onos/tools/package/deb/postinst
new file mode 100755
index 00000000..60de14a7
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/postinst
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+ONOS_USER=sdn
+
+# Check to see if user exists, and if not, create a service account
+getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER )
+
+# Create ONOS options file
+[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options
+export ONOS_OPTS=server
+export ONOS_USER="$ONOS_USER"
+EOF
+
+# Change permissions for onos directory
+[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos
+
diff --git a/framework/src/onos/tools/package/deb/postrm b/framework/src/onos/tools/package/deb/postrm
new file mode 100755
index 00000000..90dd6164
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/postrm
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# FIXME dpkg will remove /opt if it is empty after removing onos
+# We should recreate /opt if it was deleted.
+sudo mkdir -p /opt
diff --git a/framework/src/onos/tools/package/deb/prerm b/framework/src/onos/tools/package/deb/prerm
new file mode 100755
index 00000000..2a1633da
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/prerm
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Check if onos is running; if it is, stop onos
+[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || (
+ stop onos
+
+ # Wait for onos to stop up to 5 seconds
+ for i in $(seq 1 5); do
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break
+ sleep 1
+ done
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos'
+)
+
+# Clean up onos runtime directories
+# TODO don't hardcode karaf version
+rm -rf /opt/onos/apache-karaf-3.0.3/
+rm -rf /opt/onos/var/*
+rm -rf /opt/onos/config
+rm -rf /opt/onos/options
+rm -rf /opt/onos/log
+
+#TODO consider removing the sdn user if we created it
diff --git a/framework/src/onos/tools/package/init/onos.conf b/framework/src/onos/tools/package/init/onos.conf
new file mode 100644
index 00000000..779df905
--- /dev/null
+++ b/framework/src/onos/tools/package/init/onos.conf
@@ -0,0 +1,37 @@
+description "Open Network Operating System"
+author "ON.Lab"
+
+start on (net-device-up
+ and local-filesystems
+ and runlevel [2345])
+stop on runlevel [016]
+
+console output
+kill timeout 60
+respawn
+
+env LANG=en_US.UTF-8
+
+pre-start script
+ [ -f /opt/onos/options ] && . /opt/onos/options
+ ONOS_USER=${ONOS_USER:-root}
+
+ # Ensure that the environment is initialized
+ [ -d /opt/onos ] && mkdir /opt/onos/var 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/var
+ [ -d /opt/onos ] && mkdir /opt/onos/config 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/config
+ # TODO make karaf version configurable
+ [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \
+ && ln -s /opt/onos/apache-karaf-3.0.3/data/log /opt/onos/log || :
+end script
+
+pre-stop script
+ /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log
+ sleep 1
+end script
+
+script
+ [ -f /opt/onos/options ] && . /opt/onos/options
+ start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
+ --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
+ >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
+end script
diff --git a/framework/src/onos/tools/package/rpm/onos.spec b/framework/src/onos/tools/package/rpm/onos.spec
new file mode 100644
index 00000000..df0a05d5
--- /dev/null
+++ b/framework/src/onos/tools/package/rpm/onos.spec
@@ -0,0 +1,71 @@
+Name: onos
+Version: @ONOS_RPM_VERSION
+Release: 1
+Summary: Open Networking Operating System (ONOS)
+Vendor: ONOS Project
+Packager: ONOS Project
+
+Group: Applications/Engineering
+License: Apache 2.0
+Requires: jre >= 1:8
+URL: http://www.onosproject.org
+Source0: %{name}-@ONOS_RPM_VERSION.tar.gz
+
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-buildroot
+
+%description
+Open Network Operating System (ONOS) is an open source SDN controller.
+
+%prep
+%setup -q
+
+%install
+mkdir -p %{buildroot}
+cp -R * %{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+/etc/init/onos.conf
+/opt/onos/
+
+%post
+ONOS_USER=sdn
+
+# Check to see if user exists, and if not, create a service account
+getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER )
+
+# Create ONOS options file
+[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options
+export ONOS_OPTS=server
+export ONOS_USER="$ONOS_USER"
+EOF
+
+# Change permissions for onos directory
+[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos
+
+echo ONOS successfully installed at /opt/onos
+
+%preun
+# Check if onos is running; if it is, stop onos
+[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || (
+ stop onos
+
+ # Wait for onos to stop up to 5 seconds
+ for i in $(seq 1 5); do
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break
+ sleep 1
+ done
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos'
+)
+
+%postun
+#TODO this should be less brute-force
+rm -rf /opt/onos
+
+%changelog
+# TODO
+