summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorEd Warnicke <eaw@cisco.com>2016-06-15 16:27:53 +0000
committerDave Wallace <dwallacelf@gmail.com>2016-06-15 16:57:34 +0000
commit2b3285a9316ba766552d4cc92b8eaef3b33ff6f3 (patch)
treebb51157e74a51527b60b2917c2239a51df549285 /packaging
parentd46e184662bc2ca83f721d4adb0a7a815acef0a0 (diff)
Added rpm for honeycomb
Change-Id: I2dd2f1bae1c5f0b0232b8e453c3fa8a1761d657d Signed-off-by: Ed Warnicke <eaw@cisco.com>
Diffstat (limited to 'packaging')
-rw-r--r--packaging/rpm/.gitignore6
-rw-r--r--packaging/rpm/honeycomb.service13
-rw-r--r--packaging/rpm/honeycomb.spec66
-rwxr-xr-xpackaging/rpm/release2
-rwxr-xr-xpackaging/rpm/rpmbuild.sh10
-rwxr-xr-xpackaging/rpm/version2
6 files changed, 99 insertions, 0 deletions
diff --git a/packaging/rpm/.gitignore b/packaging/rpm/.gitignore
new file mode 100644
index 000000000..2da6c3117
--- /dev/null
+++ b/packaging/rpm/.gitignore
@@ -0,0 +1,6 @@
+BUILD
+BUILDROOT
+RPMS
+SOURCES
+SPECS
+SRPMS
diff --git a/packaging/rpm/honeycomb.service b/packaging/rpm/honeycomb.service
new file mode 100644
index 000000000..4752c1313
--- /dev/null
+++ b/packaging/rpm/honeycomb.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=fd.io Honeycomb
+Wants=vpp.service
+After=vpp.service
+
+[Service]
+Type=forking
+ExecStart=/opt/honeycomb/bin/start
+User=honeycomb
+Group=honeycomb
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file
diff --git a/packaging/rpm/honeycomb.spec b/packaging/rpm/honeycomb.spec
new file mode 100644
index 000000000..1101a71ed
--- /dev/null
+++ b/packaging/rpm/honeycomb.spec
@@ -0,0 +1,66 @@
+# Honyecomb is a noarch package, so this isn't necessary. It's also very slow.
+%define __jar_repack 0
+%define _version %(./version)
+%define _release %(./release)
+
+Name: honeycomb
+Version: %{_version}
+# The Fedora/CentOS packaging guidelines *require* the use of a disttag. Honeycomb's
+# RPM build doesn't do anything Fedora/CentOS specific, so the disttag is
+# unnecessary and unused in our case, but both the docs and the pros (apevec)
+# agree that we should include it.
+# See: https://fedoraproject.org/wiki/Packaging:DistTag
+Release: %{_release}
+BuildArch: noarch
+Summary: fd.io Honeycomb
+Group: Applications/Communications
+License: Apache-1.0
+URL: http://www.fd.io
+Source0: v3po-karaf-%{_version}-SNAPSHOT.zip
+Source1: honeycomb.service
+Requires: vpp, java >= 1:1.8.0
+# Required for creating honeycomb group
+Requires(pre): shadow-utils
+# Required for configuring systemd
+BuildRequires: systemd
+
+%pre
+# Create `honeycomb` user/group
+# Short circuits if the user/group already exists
+# Home dir must be a valid path for various files to be created in it
+getent passwd honeycomb > /dev/null || useradd honeycomb -M -d $RPM_BUILD_ROOT/opt/%name
+getent group honeycomb > /dev/null || groupadd honeycomb
+getent group vpp > /dev/null && usermod -a -G vpp honeycomb
+
+%description
+fd.io Honeycomb
+
+%prep
+# Extract Source0 (Honeycomb archive)
+%autosetup -n v3po-karaf-%{_version}-SNAPSHOT
+
+%install
+# Create directory in build root for Honeycomb
+mkdir -p $RPM_BUILD_ROOT/opt/%name
+# Copy Honeycomb from archive to its dir in build root
+cp -r ../v3po-karaf-%{_version}-SNAPSHOT/* $RPM_BUILD_ROOT/opt/%name
+# Create directory in build root for systemd .service file
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+# Copy Honeycomb's systemd .service file to correct dir in build root
+echo "PWD:$PWD"
+cp ${RPM_BUILD_ROOT}/../../%{name}.service $RPM_BUILD_ROOT/%{_unitdir}/%name.service
+
+%postun
+# When the RPM is removed, the subdirs containing new files wouldn't normally
+# be deleted. Manually clean them up.
+# Warning: This does assume there's no data there that should be preserved
+if [ $1 -eq 0 ]; then
+ rm -rf $RPM_BUILD_ROOT/opt/%name
+fi
+
+%files
+# Honeycomb will run as honeycomb:honeycomb, set as user:group for honeycomb dir, don't override mode
+%attr(-,honeycomb,honeycomb) /opt/%name
+# Configure systemd unitfile user/group/mode
+%attr(0644,root,root) %{_unitdir}/%name.service
+
diff --git a/packaging/rpm/release b/packaging/rpm/release
new file mode 100755
index 000000000..c4bf723b5
--- /dev/null
+++ b/packaging/rpm/release
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo $BUILD_NUMBER
diff --git a/packaging/rpm/rpmbuild.sh b/packaging/rpm/rpmbuild.sh
new file mode 100755
index 000000000..b4a0d69ce
--- /dev/null
+++ b/packaging/rpm/rpmbuild.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+DIR=$(dirname $0)
+DIR=$(readlink -f $DIR)
+ZIPDIR=${DIR}/../../v3po/karaf/target/
+ZIPFILE=${ZIPDIR}/v3po-karaf-1.0.0-SNAPSHOT.zip
+mkdir -p ${DIR}/SOURCES/
+cp $ZIPFILE ${DIR}/SOURCES/
+cp ${DIR}/honeycomb.spec ${DIR}/SOURCES/
+rpmbuild -bb --define "_topdir ${DIR}" honeycomb.spec
diff --git a/packaging/rpm/version b/packaging/rpm/version
new file mode 100755
index 000000000..3fc0d1083
--- /dev/null
+++ b/packaging/rpm/version
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo 1.0.0