aboutsummaryrefslogtreecommitdiffstats
path: root/community/homer-api
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-09-19 17:17:04 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-09-19 17:17:04 +0300
commitfb1062131ac950b1076b675cdd0883cc1fc016b7 (patch)
tree6cde065409c0c272069f491cb295ded66a034775 /community/homer-api
parent8c160033aa9cc65eb70f6e5891876dc6c6d6fd88 (diff)
Revert "main/homer-api: moved from community"
Diffstat (limited to 'community/homer-api')
-rw-r--r--community/homer-api/APKBUILD71
-rw-r--r--community/homer-api/homer_db_init24
-rw-r--r--community/homer-api/php7.patch11
-rw-r--r--community/homer-api/rotation-ini-path.patch28
4 files changed, 134 insertions, 0 deletions
diff --git a/community/homer-api/APKBUILD b/community/homer-api/APKBUILD
new file mode 100644
index 00000000000..6ef39246e34
--- /dev/null
+++ b/community/homer-api/APKBUILD
@@ -0,0 +1,71 @@
+# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
+# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+pkgname=homer-api
+pkgver=5.0.6
+pkgrel=11
+pkgdesc="HOMER API"
+url="https://github.com/sipcapture/homer-api"
+arch="noarch"
+license="GPL"
+depends="homer-db php7-ctype php7-json php7-pdo_mysql php7-session"
+makedepends="$depends_dev"
+options="!check"
+subpackages="$pkgname-doc homer-api-ldap homer-db"
+source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/homer-api/archive/$pkgver.tar.gz
+ homer_db_init
+ php7.patch
+ rotation-ini-path.patch"
+builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ return 0
+}
+
+package() {
+ cd "$builddir"
+ local file
+ local appdir=$pkgdir/usr/share/webapps/homer
+
+ mkdir -p "$appdir" \
+ "$pkgdir"/etc/homer \
+ "$pkgdir"/usr/share/doc/homer-api
+
+ mv api "$appdir"
+
+ for file in configuration preferences; do
+ mv "$appdir"/api/${file}_example.php "$pkgdir"/etc/homer/$file.php
+ ln -s /etc/homer/$file.php "$appdir"/api
+ done
+
+ cp -R examples "$pkgdir"/usr/share/doc/homer-api
+}
+
+db() {
+ depends="mariadb-client perl perl-dbi perl-dbd-mysql"
+
+ cd "$builddir"
+ mkdir -p \
+ "$subpkgdir"/etc/periodic/daily \
+ "$subpkgdir"/usr/share/homer-db
+
+ install -D -m 644 scripts/rotation.ini \
+ "$subpkgdir"/etc/homer/rotation.ini
+ cp -pr sql/* "$subpkgdir"/usr/share/homer-db
+
+ install -D "$srcdir"/homer_db_init "$subpkgdir"/usr/bin/homer_db_init
+ cp -p scripts/homer_* "$subpkgdir"/usr/bin
+ ln -s /usr/bin/homer_rotate "$subpkgdir"/etc/periodic/daily
+}
+
+ldap() {
+ depends="$pkgname php7-ldap"
+
+ local dir=usr/share/webapps/homer/api/Authentication
+ mkdir -p "$subpkgdir"/$dir
+ mv "$pkgdir"/$dir/LDAP.php "$subpkgdir"/$dir
+}
+
+sha512sums="620185c19bd348ba68bad3a1992b7d673d29dcfb8a0aeea437a2d31e90f0a21cf6f46a43f0041a583a14d9403e1d8574c6040da1dba397ec2d955b8aba9010d8 homer-api-5.0.6.tar.gz
+e305af57a8445b45cb1e894aa34ceea3aeedb60740a636229d470d872f9ebb835e03985faeb685180a3e2c1eae29b49c841f8cbdb4236dbf0323f905a30b0bbb homer_db_init
+068d7b03c51aed4c144b6f8382a367016432b5f2c22e79e19da516536bf22c9bec4fbedf81130e32d6d919be746610563295513412f14c565fc917bdc0a7b004 php7.patch
+0328c4f645601be150f877a31a8c245908da9d9972bed6e1af50f2c43055c9f47376da30c666b6eaa0310637414f65906b88f9a339a1dfa14e1864c70b36fa77 rotation-ini-path.patch"
diff --git a/community/homer-api/homer_db_init b/community/homer-api/homer_db_init
new file mode 100644
index 00000000000..c80328ac6ae
--- /dev/null
+++ b/community/homer-api/homer_db_init
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+
+# HOMER database setup script
+# Copyright (c) 2017 Kaarle Ritvanen
+
+exec_sql() {
+ mysql $2 < /usr/share/homer-db/$1.sql
+}
+
+exec_sql homer_databases
+exec_sql homer_user
+
+for db in configuration data statistic; do
+ exec_sql schema_$db homer_$db
+done
+
+homer_rotate
+
+[ "$1" = -r ] || exit 0
+
+mysql <<EOF
+CREATE USER 'homer_user' IDENTIFIED BY 'homer_password';
+GRANT SELECT ON homer_data.* TO 'homer_user';
+EOF
diff --git a/community/homer-api/php7.patch b/community/homer-api/php7.patch
new file mode 100644
index 00000000000..df159b0ba46
--- /dev/null
+++ b/community/homer-api/php7.patch
@@ -0,0 +1,11 @@
+--- homer-api-5.0.6/api/Authentication/LDAP.php
++++ homer-api-5.0.6.php7/api/Authentication/LDAP.php
+@@ -118,7 +118,7 @@
+
+
+ // Assigne Admin Privs, should be read from the LDAP Directory in the future
+- $ADMIN_USER = split(",", LDAP_ADMIN_USER);
++ $ADMIN_USER = explode(",", LDAP_ADMIN_USER);
+ foreach($ADMIN_USER as &$value) {
+
+ if ($value == $param['username']) {
diff --git a/community/homer-api/rotation-ini-path.patch b/community/homer-api/rotation-ini-path.patch
new file mode 100644
index 00000000000..52d42f7b09e
--- /dev/null
+++ b/community/homer-api/rotation-ini-path.patch
@@ -0,0 +1,28 @@
+--- homer-api-5.0.6/scripts/homer_partremove
++++ homer-api-5.0.6.alpine/scripts/homer_partremove
+@@ -3,9 +3,8 @@
+ # Set correct bin path if we are running as a cron job
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+-bin_dir=`dirname $0`
+-programm="$bin_dir/homer_mysql_remove_partitions.pl"
+-config="$bin_dir/rotation.ini"
++programm="homer_mysql_remove_partitions.pl"
++config=/etc/homer/rotation.ini
+
+ $programm $config
+
+--- homer-api-5.0.6/scripts/homer_rotate
++++ homer-api-5.0.6.alpine/scripts/homer_rotate
+@@ -3,9 +3,8 @@
+ # Set correct bin path if we are running as a cron job
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+-bin_dir=`dirname $0`
+-programm="$bin_dir/homer_mysql_rotate.pl"
+-config="$bin_dir/rotation.ini"
++programm="homer_mysql_rotate.pl"
++config=/etc/homer/rotation.ini
+
+ if [ $# -ne 0 ]
+ then