diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2017-02-13 14:06:56 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2017-02-13 14:40:18 +0200 |
commit | 50b3ed90d094c089367f408ae89668a167e23179 (patch) | |
tree | 1e8785d81ec3d21013a56d5b38a0ae768b0889a6 | |
parent | 8f4dda4aa062e44200b4e8457e6cc7244ed6c362 (diff) | |
download | aports-50b3ed90d094c089367f408ae89668a167e23179.tar.bz2 aports-50b3ed90d094c089367f408ae89668a167e23179.tar.xz |
testing/homer-api: database initialization script
-rw-r--r-- | testing/homer-api/APKBUILD | 10 | ||||
-rw-r--r-- | testing/homer-api/homer_db_init | 22 |
2 files changed, 26 insertions, 6 deletions
diff --git a/testing/homer-api/APKBUILD b/testing/homer-api/APKBUILD index 5af455d5ac..8351a96319 100644 --- a/testing/homer-api/APKBUILD +++ b/testing/homer-api/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: pkgname=homer-api pkgver=5.0.6 -pkgrel=3 +pkgrel=4 pkgdesc="HOMER API" url="https://github.com/sipcapture/homer-api" arch="noarch" @@ -13,6 +13,7 @@ makedepends="$depends_dev" install= subpackages="$pkgname-doc homer-db" source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/homer-api/archive/$pkgver.tar.gz + homer_db_init rotation-ini-path.patch" builddir="$srcdir"/$pkgname-$pkgver @@ -45,20 +46,17 @@ db() { cd "$builddir" mkdir -p \ "$subpkgdir"/etc/periodic/daily \ - "$subpkgdir"/usr/bin \ "$subpkgdir"/usr/share/homer-db install -D -m 644 scripts/rotation.ini \ "$subpkgdir"/etc/homer/rotation.ini cp -p 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 } -md5sums="16762b9eabfee68a5953b6df87f2c6e6 homer-api-5.0.6.tar.gz -5e336b2b7eedfa20961dba21019e97cf rotation-ini-path.patch" -sha256sums="abe4ab89fe5d0d09d7b89f91316f6ae39a51195903099e73d7dff95d5bd23672 homer-api-5.0.6.tar.gz -5b51667f7e4f22e271445f8ed6f52d2a443b5b10ad3e0947a2476b9f45417079 rotation-ini-path.patch" sha512sums="620185c19bd348ba68bad3a1992b7d673d29dcfb8a0aeea437a2d31e90f0a21cf6f46a43f0041a583a14d9403e1d8574c6040da1dba397ec2d955b8aba9010d8 homer-api-5.0.6.tar.gz +a95cbb359b8b2cb9d0819d186c9160a86fca41f7578e8da06c93f21f2f21ba9e4aebd89755f8f980f5b57a80240a43b933f1d5d2dbd3b40d8ef517c828fa75be homer_db_init b7a072cee1d64ec712fb4e9b7ac4191581f9babaf92c3088b8c6bbcc6e72d3f588015894835d7cdab281ba6963dcb15e8f9197fc9ee138cb329104beac5654e7 rotation-ini-path.patch" diff --git a/testing/homer-api/homer_db_init b/testing/homer-api/homer_db_init new file mode 100644 index 0000000000..037d177be5 --- /dev/null +++ b/testing/homer-api/homer_db_init @@ -0,0 +1,22 @@ +#!/bin/sh -e + +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'; +GRANT SELECT ON homer_statistic.* TO 'homer_user'; +EOF |