summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Mehani2016-03-08 16:10:10 +1100
committerOlivier Mehani2016-03-08 16:10:15 +1100
commitf6b6de34e8f583c970330e3b0f4ee7ac950a285b (patch)
tree9ad9a73b06e1abb50ced8df50bfb3e1471b508ef
downloadaur-oml2.tar.gz
Import 2.11.1rc from upstream release
Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
-rw-r--r--.SRCINFO41
-rw-r--r--PKGBUILD65
-rw-r--r--oml2-server.conf13
-rw-r--r--oml2-server.logrotate9
-rw-r--r--oml2-server.rc104
-rw-r--r--oml2-server.service32
-rw-r--r--oml2.install24
7 files changed, 288 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..20f2e28d35c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,41 @@
+# Generated by makepkg 5.0.1
+# Tue Mar 8 04:52:14 UTC 2016
+pkgbase = oml2
+ pkgdesc = OML is a measurement library that allows to define measurement points inside applications
+ pkgver = 2.11.1~rc
+ pkgrel = 1
+ url = http://oml.mytestbed.net/
+ install = oml2.install
+ arch = i686
+ arch = x86_64
+ license = custom:MIT-Nicta
+ checkdepends = check
+ makedepends = git
+ makedepends = asciidoc
+ depends = libxml2
+ depends = sqlite3
+ depends = popt
+ depends = ruby>=1.8.7
+ depends = postgresql-libs
+ optdepends = postgresql: to use as a backend instead of sqlite3
+ provides = liboml
+ provides = liboml-git
+ provides = oml2
+ conflicts = liboml
+ conflicts = liboml-git
+ conflicts = oml2
+ replaces = liboml-git
+ backup = etc/conf.d/oml2-server.conf
+ source = http://oml.mytestbed.net/attachments/download/1267/oml2-2.11.1rc.tar.gz
+ source = oml2-server.conf
+ source = oml2-server.logrotate
+ source = oml2-server.rc
+ source = oml2-server.service
+ md5sums = f9fae9569b03b14836f1669838ab31d9
+ md5sums = 0fcaf350b4c5ac5bc8db2f17de11f9f9
+ md5sums = 422a04d8bde681e43700d949750f2d99
+ md5sums = 3d783cf3f03d339d5a1607325ee71b0f
+ md5sums = 06f39c048d6c3752b167770d991f984c
+
+pkgname = oml2
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..ed0441df458
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,65 @@
+# Contributor: Olivier Mehani <olivier.mehani@nicta.com.au>
+pkgname=oml2
+_redmineid=1267
+pkgver=2.11.1~rc
+pkgrel=1
+pkgdesc="OML is a measurement library that allows to define measurement points inside applications"
+arch=(i686 x86_64)
+url="http://oml.mytestbed.net/"
+license=('custom:MIT-Nicta')
+depends=('libxml2' 'sqlite3' 'popt' 'ruby>=1.8.7' 'postgresql-libs')
+makedepends=('git' 'asciidoc')
+optdepends=("postgresql: to use as a backend instead of sqlite3")
+checkdepends=('check')
+provides=(liboml liboml-git oml2)
+conflicts=(liboml liboml-git oml2)
+replaces=(liboml-git)
+source=(
+ http://oml.mytestbed.net/attachments/download/${_redmineid}/oml2-${pkgver/\~/}.tar.gz
+ oml2-server.conf
+ oml2-server.logrotate
+ oml2-server.rc
+ oml2-server.service
+)
+
+backup=(etc/conf.d/oml2-server.conf)
+install="oml2.install"
+
+_builddir=${pkgname}-${pkgver/\~/}
+
+build() {
+ cd "${srcdir}"
+ cd "${srcdir}/${_builddir}"
+ ./configure --prefix=/usr --localstatedir=/var --enable-doc --disable-doxygen-doc --with-pgsql
+ make || return 1
+}
+
+package() {
+ cd "${srcdir}/${_builddir}"
+ make DESTDIR="${pkgdir}/" install
+ # XXX: We can only build the example application when we can find everything else
+ make -C example/liboml2 \
+ BINDIR="${pkgdir}/usr/bin" \
+ SCAFFOLD="${pkgdir}/usr/bin/oml2-scaffold" \
+ CFLAGS="-I${pkgdir}/usr/include" \
+ LDFLAGS="-L${pkgdir}/usr/lib" \
+ LIBS="-loml2 -locomm -lpopt -lm" \
+ install
+ mv ${pkgdir}/usr/bin/generator ${pkgdir}/usr/bin/oml2-generator
+ install -D -m 0644 ${srcdir}/${_builddir}/COPYING \
+ ${pkgdir}/usr/share/licenses/${pkgname}/COPYING
+ install -D -m 0755 ${startdir}/oml2-server.rc ${pkgdir}/etc/rc.d/oml2-server
+ install -D -m 0644 ${startdir}/oml2-server.service ${pkgdir}/usr/lib/systemd/system/oml2-server.service
+ install -D -m 0644 ${startdir}/oml2-server.conf ${pkgdir}/etc/conf.d/oml2-server.conf
+ install -D -m 0644 ${startdir}/oml2-server.logrotate ${pkgdir}/etc/logrotate.d/oml2-server
+}
+
+check() {
+ cd "${srcdir}/${_builddir}"
+ make check
+}
+md5sums=('f9fae9569b03b14836f1669838ab31d9'
+ '0fcaf350b4c5ac5bc8db2f17de11f9f9'
+ '422a04d8bde681e43700d949750f2d99'
+ '3d783cf3f03d339d5a1607325ee71b0f'
+ '06f39c048d6c3752b167770d991f984c')
diff --git a/oml2-server.conf b/oml2-server.conf
new file mode 100644
index 00000000000..c63175b0814
--- /dev/null
+++ b/oml2-server.conf
@@ -0,0 +1,13 @@
+# This creates SQLite3 databases in /var/oml2, use
+# "--data-dir=DIR"
+# to override.
+#
+#
+# See oml2-server(1) for details.
+OML2_OPTS="-l 3003 --logfile=/var/log/oml2-server.log --user=oml2 --group=oml2"
+
+# Uncomment the following to use the PostgreSQL backend instead (default values
+# explicitely given here)
+# Make sure the oml2 PG user exist and is allowed to create databases:
+# createuser --username postgres --createdb --no-superuser --no-createrole oml2
+#OML2_OPTS="$OML2_OPTS --backend=postgresql --pg-host=localhost --pg-port=5432 --pg-user=oml2 --pg-pass=''"
diff --git a/oml2-server.logrotate b/oml2-server.logrotate
new file mode 100644
index 00000000000..60d066ab2e6
--- /dev/null
+++ b/oml2-server.logrotate
@@ -0,0 +1,9 @@
+/var/log/oml2-server.log {
+ weekly
+ rotate 4
+ missingok
+ notifempty
+ compress
+ copytruncate
+}
+
diff --git a/oml2-server.rc b/oml2-server.rc
new file mode 100644
index 00000000000..efbc6147fbc
--- /dev/null
+++ b/oml2-server.rc
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+daemon_name=oml2-server
+pidfile=/run/$daemon_name.pid
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+test_pid(){
+ if [ -s "$pidfile" ]; then
+ if pidof -o %PPID $daemon_name | tr ' ' '\n' | grep -w $(cat $pidfile); then
+ return 0
+ fi
+ fi
+ return 1
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [[ -z $PID ]]; then
+ [[ -f $pidfile ]] &&
+ rm -f $pidfile
+ # RUN
+ $daemon_name $OML2_OPTS &
+ #
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > $pidfile
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [[ -n $PID ]] && kill $PID &> /dev/null
+ #
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ exit 1
+ else
+ rm -f $pidfile &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 wait_stop
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ wait_stop)
+ pidtmp=$(test_pid) || exit 0
+ if kill -0 "${pidtmp:-}" 2> /dev/null; then
+ PID=$pidtmp
+ fi
+
+ $0 stop
+
+ if [ -n "${PID:-}" ]; then
+ i=0
+ stat_busy "Waiting for server to terminate"
+ while kill -0 "${PID:-}" 2> /dev/null; do
+ if [ $i = '60' ]; then
+ stat_fail
+ break;
+ else
+ i=$(($i+1))
+ sleep 1
+ fi
+ done
+ stat_done
+ fi
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status|wait_stop}"
+esac
+
+exit 0
+
+# vim:set ts=2 sw=2 et ft=sh:
diff --git a/oml2-server.service b/oml2-server.service
new file mode 100644
index 00000000000..fc756822ff5
--- /dev/null
+++ b/oml2-server.service
@@ -0,0 +1,32 @@
+# Do not make modifications to this file, as they may not survive update.
+# Instead, copy it to /etc/systemd/system/, and modify it there; then, run
+# sudo systemctl reenable oml2-server.service
+# That modified copy will override the parameters here.
+#
+# See systemd(1) for details.
+#
+[Unit]
+Description=OML2 measurements collection server
+After=network.target
+# SQLite3 backend (and logs)
+RequiresMountsFor=/var
+
+# Uncomment the following lines when using the PostgreSQL backend
+#Requires=postgresql.service
+#After=postgresql.service
+
+[Service]
+Type=simple
+# This creates SQLite3 databases in /var/oml2, use
+# "--data-dir=DIR"
+# to override.
+#
+# See oml2-server(1) for details.
+ExecStart=/usr/bin/oml2-server -l 3003 --logfile=/var/log/oml2-server.log --user=oml2 --group=oml2
+
+# Add the following to the ExecStart line to enable and configure the PostgreSQL
+# backend
+#--backend=postgresql --pg-host=localhost --pg-port=5432 --pg-user=oml2 --pg-pass=correcthorsebatterystaple
+
+[Install]
+WantedBy=multi-user.target
diff --git a/oml2.install b/oml2.install
new file mode 100644
index 00000000000..9c5a572bdfd
--- /dev/null
+++ b/oml2.install
@@ -0,0 +1,24 @@
+## arg 1: the new package version
+post_install() {
+ getent passwd oml2 >/dev/null && getent group oml2 >/dev/null && exit 0
+ echo ">>> Creating oml2 user and group and setting permissions..."
+ getent group oml2 >/dev/null || usr/sbin/groupadd -g 137 oml2
+ getent passwd oml2 >/dev/null || usr/sbin/useradd -c 'OML2 daemon' -u 137 -g oml2 -d '/var/oml2' -s /bin/bash oml2
+ mkdir -p /var/oml2
+ chown oml2:oml2 /var/oml2
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ post_install
+}
+
+## arg 1: the old package version
+pre_remove() {
+ getent passwd oml2 >/dev/null && usr/sbin/userdel oml2 &>/dev/null
+ rm -rf /var/oml2
+ (getent group oml2 >/dev/null && usr/sbin/groupdel oml2 &>/dev/null) || /bin/true
+}
+
+# vim:set ts=2 sw=2 et: