From d2ed598ea3ccdcc0c9d43261cf316a3e71d82cee Mon Sep 17 00:00:00 2001 From: "Aaron W. Swenson" Date: Sun, 20 Jan 2013 22:33:42 +0000 Subject: Add new function for adding daemon users --- postgres.eclass | 32 ++++++++++++++++++++++++++++---- 1 file 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 +# @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: [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 +} -- cgit v1.2.3-65-gdbad