aboutsummaryrefslogtreecommitdiff
blob: 77851c13ecbfad154bee62f05e0cfcee88e9f30e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: postgres.eclass
# @MAINTAINER:
# 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 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]
# @DESCRIPTION:
# Called after DEPEND is declared. Takes up to two optional arguments. The 'server'
postgres_depend() {
	if [[ -n ${POSTGRES_ONLY} ]] ; then
		DEPEND+=" dev-db/postgresql-base:${POSTGRES_ONLY}[${BASE_FLAGS}]"
	elif [[ -n ${POSTGRES_MIN} ]]
		if [[ -n ${POSTGRES_MAX} ]] ; then

		else
		#blarg
		fi
	elif [[ -n ${POSGRES_MAX} ]] ; then
	#blah
	else
		[[POSTGRES_MAX]]
		[[POSTGRES_MIN]]
		[[POSTGRES_ONLY]]
	fi
}

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
}