Subject: [alpine-aports] [PATCH] testing/flowd: rename user flowd -> flow

From: Valery Kartel <[email-masked]>
Date: Tue, 25 Apr 2017 17:00:11 +0300

rename user's home to /var/lib/flow
and config dir to /etc/flow

to make reuse user and directories
between several flow collectors
---
 testing/flowd/APKBUILD          | 16 +++++++++-------
 testing/flowd/fix_path.patch    |  8 ++++----
 testing/flowd/fix_user.patch    |  2 +-
 testing/flowd/flowd.initd       |  2 +-
 testing/flowd/flowd.pre-install |  4 ++--
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/testing/flowd/APKBUILD b/testing/flowd/APKBUILD
index 0f55eebea1..6982b63375 100644
--- a/testing/flowd/APKBUILD
+++ b/testing/flowd/APKBUILD
@@ -2,13 +2,15 @@
 # Maintainer: Valery Kartel <[email-masked]>
 pkgname=flowd
 pkgver=0.9.1
-pkgrel=2
+pkgrel=3
+_flow=flow
 pkgdesc="Small, fast and secure NetFlow collector"
 url="https://code.google.com/p/flowd"
 arch="all"
 license="BSD"
 install="$pkgname.pre-install"
-pkgusers=$pkgname
+pkgusers=$_flow
+pkggroups=$_flow
 makedepends="byacc perl-dev python2-dev"
 subpackages="$pkgname-dev $pkgname-doc py-$pkgname:_py
 	perl-$pkgname:_perl perl-$pkgname-doc:_perldoc:noarch
@@ -34,7 +36,7 @@ build() {
 		--target=$CTARGET \
 		--prefix=/usr \
 		--localstatedir=/var \
-		--sysconfdir=/etc/$pkgname \
+		--sysconfdir=/etc/$_flow \
 		|| return 1
 	make
 
@@ -54,7 +56,7 @@ check() {
 
 package() {
 	make -C "$builddir" DESTDIR="$pkgdir" install
-	install -dm750 -o $pkgname "$pkgdir"/var/lib/$pkgname
+	install -dm750 -o $_flow -g $_flow "$pkgdir"/var/lib/$_flow
 	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
 }
 
@@ -93,6 +95,6 @@ tools() {
 }
 
 sha512sums="c86d810de9a163206525c4ac12029d650209a370213d701d38b0e7ea746e087d2a0f80ab1657ccca87851cdf64628813666028e267529d6b7391b63542230967  flowd-0.9.1.tar.gz
-427a0b690519ddeb28da581ba7740faa6de9c6baf40ba285ad82f5652def3c950c8b080ca677de9748eea6cc1c2c5ab38559a139655e6cb176b021a5a9d5d912  fix_path.patch
-5264f4e913464c7cd6957ea4ef2a458551e3b52c66d1b709e90bfbe014327b72fbff52e282acbf6a2222972ca96f5908410f6ab51c3d8a161e9eef111634d8f2  fix_user.patch
-68cfe2ea07eb981c02660f5c05018308c164705f52c0c1d90bdacc45ec993dca971439c60b02f5ba3e521c8730e54d968a31af1eddfe6924d39d33c50843836b  flowd.initd"
+ba98fe584ab17b4cc2ba203748f045f06d22f8be5bfd20a369e4fb9b232af5304d39c6a4195e9fc4fff93b3bcf74960c87af7fcfa927fd87cb1086c59725d3aa  fix_path.patch
+91c0dfd2b427de86159ffd7b11fd79550de073b09fe9fc9a37a2f858743c7145163589a9941332e37823051d02a48953f04137aebf663429ccda84f8843d463a  fix_user.patch
+7c254c42a410780216e324223da152151fe60c396d4a714b0d5aa05e5f14cfc7df40457cd37a3c94b7a77cc131352d42ae154b6005bad6535967099d1027039e  flowd.initd"
diff --git a/testing/flowd/fix_path.patch b/testing/flowd/fix_path.patch
index 42b672dbf2..e2512fc2c6 100644
--- a/testing/flowd/fix_path.patch
+++ b/testing/flowd/fix_path.patch
@@ -5,7 +5,7 @@
 -
  # Specify where flowd should store its flow records
 -logfile "/var/log/flowd"
-+logfile "/var/lib/flowd/data"
++logfile "/var/lib/flow/data"
  
  # Specify what addresses/ports flowd should listen on.
  # Multiple addresses may be specified
@@ -16,7 +16,7 @@
  For example,
  .Bd -literal -offset indent
 -logfile "/var/log/flowd.bin"
-+logfile "/var/lib/flowd/data"
++logfile "/var/lib/flow/data"
  .Ed
  .Pp
  There is no default value for this option and it it mandatory 
@@ -25,7 +25,7 @@
  For example,
  .Bd -literal -offset indent
 -logsock "/var/log/flowd.sock"
-+logsock "/var/lib/flowd/socket"
++logsock "/var/lib/flow/socket"
  .Ed
  .Pp
  This option accepts the modifier
@@ -34,7 +34,7 @@
  For example,
  .Bd -literal -offset indent
 -logsock "/var/log/flowd.sock" bufsize 65536
-+logsock "/var/lib/flowd/socket" bufsize 65536
++logsock "/var/lib/flow/socket" bufsize 65536
  .Ed
  .Pp
  There is no default value for
diff --git a/testing/flowd/fix_user.patch b/testing/flowd/fix_user.patch
index 12800d0442..0bf37e4dd3 100644
--- a/testing/flowd/fix_user.patch
+++ b/testing/flowd/fix_user.patch
@@ -5,7 +5,7 @@
  #define DEFAULT_CONFIG			SYSCONFDIR "/flowd.conf"
  #define DEFAULT_PIDFILE			PIDFILEDIR "/flowd.pid"
 -#define PRIVSEP_USER			"_flowd"
-+#define PRIVSEP_USER			"flowd"
++#define PRIVSEP_USER			"flow"
  
  /* Initial stateholding limits */
  /* XXX these are not actually tunable yet */
diff --git a/testing/flowd/flowd.initd b/testing/flowd/flowd.initd
index df124451e5..ff117d6eae 100644
--- a/testing/flowd/flowd.initd
+++ b/testing/flowd/flowd.initd
@@ -6,7 +6,7 @@ command=/usr/sbin/flowd
 command_args="-g"
 command_background=yes
 pidfile=/run/flowd.pid
-required_files=/etc/flowd/flowd.conf
+required_files=/etc/flow/flowd.conf
 extra_started_commands="reload reopen"
 description_reload="Reload configuration"
 description_reopen="Reopen log files"
diff --git a/testing/flowd/flowd.pre-install b/testing/flowd/flowd.pre-install
index 52d6273b88..316e61ba4f 100644
--- a/testing/flowd/flowd.pre-install
+++ b/testing/flowd/flowd.pre-install
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-addgroup -S flowd 2>/dev/null
-adduser -S -D -H -h /var/lib/flowd -s /sbin/nologin -G flowd -g flowd flowd 2>/dev/null
+addgroup -S flow 2>/dev/null
+adduser -S -D -H -h /var/lib/flow -s /sbin/nologin -G flow -g flow flow 2>/dev/null
 
 exit 0
-- 
2.12.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---