aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <titanofold@gentoo.org>2013-01-20 22:33:42 +0000
committerAaron W. Swenson <titanofold@gentoo.org>2013-01-20 22:33:42 +0000
commitd2ed598ea3ccdcc0c9d43261cf316a3e71d82cee (patch)
treeff9e89c8bfbbf3cef6b6832902c1ca26aaa1f85c
parentInitial import (diff)
downloadeclass-d2ed598ea3ccdcc0c9d43261cf316a3e71d82cee.tar.gz
eclass-d2ed598ea3ccdcc0c9d43261cf316a3e71d82cee.tar.bz2
eclass-d2ed598ea3ccdcc0c9d43261cf316a3e71d82cee.zip
Add new function for adding daemon users
-rw-r--r--postgres.eclass32
1 files changed, 28 insertions, 4 deletions
diff --git a/postgres.eclass b/postgres.eclass
index ff4e993..77851c1 100644
--- a/postgres.eclass
+++ b/postgres.eclass
@@ -1,13 +1,17 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# @ECLASS: postgres.eclass
# @MAINTAINER:
-# titanofold@gentoo.org
-# @BLURB: Functions to aid packages that utilize PostgreSQL
+# Aaron W. Swenson <titanofold@gentoo.org>
+# @BLURB: Functions to aid PostgreSQL-related packages
# @DESCRIPTION:
-# The postgres eclass is a suite that enable ebuilds to build against multiple slot version
+# The postgres eclass is a suite that enable ebuilds to build against
+# multiple slots, properly add a new daemon user, and query
+# PostgreSQL-related information from the system.
+
+inherit user
# @FUNCTION: postgres_depend
# @USAGE: postgres_depend [USE,flags] [server] [server,USE,flags]
@@ -32,3 +36,23 @@ postgres_depend() {
}
length=$(expr length ${POSTGRES_MAX})
+
+pgsql_pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+}
+
+# @FUNCTION: pgsql_enewuser
+# @USAGE: <user> [uid] [shell] [homedir]
+# @DESCRIPTION:
+# Same as enewuser, in fact it uses enewuser, you are not required to
+# understand how to properly add a user to the system. The only required
+# parameter is the username. Default uid is (pass -1 for this) next
+# available, default shell is /bin/false, default homedir is /dev/null,
+# and is assigned to the postgres group.
+pgsql_new_user() {
+ local user=$1 uid=$2 shell=$3 home=$4
+
+ pgsql_pkg_setup
+ enewuser $1 $2 $3 $4 postgres
+}