databases/postgresql??-server: honour login class set in /etc/passwd

If postgresql_login_class is not set, honour the setting in /etc/passwd.
The previous commit ignored the passwd setting and set the login class
to "default" if it was left unset.

PR:     275851
This commit is contained in:
Palle Girgensohn
2024-01-11 22:50:31 +01:00
parent 59429c73b8
commit 4e2b811c04
15 changed files with 145 additions and 100 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
DISTVERSION?= 12.17
# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
# not their own. Probably best to keep it at ?=0 when reset here too.
PORTREVISION?= 2
PORTREVISION?= 3
MAINTAINER?= pgsql@FreeBSD.org
@@ -14,7 +14,7 @@ is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~postgres/data/postgresql.conf.
~%%PG_USER%%/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
@@ -30,28 +30,33 @@ To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
%%PG_USER%%:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_login_class="postgres"' to /etc/rc.conf.
Then add 'postgresql_login_class="%%PG_USER%%"' to /etc/rc.conf, or
set it as the %%PG_USER%% user's login class in /etc/passwd.
======================================================================
To use PostgreSQL, enable it in rc.conf using
sysrc postgresql_enable=yes
To initialize the database, run
%%PREFIX%%/etc/rc.d/postgresql initdb
service postgresql initdb
You can then start PostgreSQL by running:
%%PREFIX%%/etc/rc.d/postgresql start
service postgresql start
For postmaster settings, see ~postgres/data/postgresql.conf
For postmaster settings, see ~%%PG_USER%%/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~postgres/data/postgresql.conf for more info
See ~%%PG_USER%%/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can be enabled during
@@ -61,9 +66,6 @@ NB. If you're not using a checksumming filesystem like ZFS, you might
and make sure you understand the performance implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
EOM
}
]
@@ -11,7 +11,8 @@
# postgresql_data="/var/db/%%PG_USER%%/data%%PG_VERSION%%"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# postgresql_login_class="default"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See %%PREFIX%%/share/doc/postgresql/README-server for more info
@@ -29,12 +30,13 @@ command=%%PREFIX%%/bin/pg_ctl
load_rc_config postgresql
# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=${postgresql_user:-"%%PG_USER%%"}
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data%%PG_VERSION%%"}
postgresql_login_class=${postgresql_login_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
: ${postgresql_enable:="NO"}
: ${postgresql_flags:="-w -s -m fast"}
: ${postgresql_user:="%%PG_USER%%"}
eval _pgdir="~${postgresql_user}/data%%PG_VERSION%%"
: ${postgresql_data:="${_pgdir}"}
: ${postgresql_login_class:=""}
: ${postgresql_initdb_flags:="--encoding=utf-8 --lc-collate=C"}
name=postgresql
rcvar=postgresql_enable
@@ -62,6 +64,7 @@ if [ -n "$2" ]; then
eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}"
eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}"
eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
eval postgresql_login_class="\$postgresql_${profile}_login_class:-${postgresql_login_class}}"
eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
fi
else
@@ -104,12 +107,16 @@ command_args="-D ${postgresql_data} ${postgresql_flags}"
postgresql_command()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec ${command} ${command_args} ${rc_arg}"
}
postgresql_initdb()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
}
run_rc_command "$1"
+1 -1
View File
@@ -1,7 +1,7 @@
DISTVERSION?= 13.13
# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
# not their own. Probably best to keep it at ?=0 when reset here too.
PORTREVISION?= 2
PORTREVISION?= 3
MAINTAINER?= pgsql@FreeBSD.org
@@ -14,7 +14,7 @@ is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~postgres/data/postgresql.conf.
~%%PG_USER%%/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
@@ -30,28 +30,33 @@ To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
%%PG_USER%%:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_login_class="postgres"' to /etc/rc.conf.
Then add 'postgresql_login_class="%%PG_USER%%"' to /etc/rc.conf, or
set it as the %%PG_USER%% user's login class in /etc/passwd.
======================================================================
To use PostgreSQL, enable it in rc.conf using
sysrc postgresql_enable=yes
To initialize the database, run
%%PREFIX%%/etc/rc.d/postgresql initdb
service postgresql initdb
You can then start PostgreSQL by running:
%%PREFIX%%/etc/rc.d/postgresql start
service postgresql start
For postmaster settings, see ~postgres/data/postgresql.conf
For postmaster settings, see ~%%PG_USER%%/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~postgres/data/postgresql.conf for more info
See ~%%PG_USER%%/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can be enabled during
@@ -61,9 +66,6 @@ NB. If you're not using a checksumming filesystem like ZFS, you might
and make sure you understand the performance implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
EOM
}
]
@@ -11,7 +11,8 @@
# postgresql_data="/var/db/%%PG_USER%%/data%%PG_VERSION%%"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# postgresql_login_class="default"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See %%PREFIX%%/share/doc/postgresql/README-server for more info
@@ -29,12 +30,13 @@ command=%%PREFIX%%/bin/pg_ctl
load_rc_config postgresql
# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=${postgresql_user:-"%%PG_USER%%"}
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data%%PG_VERSION%%"}
postgresql_login_class=${postgresql_login_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
: ${postgresql_enable:="NO"}
: ${postgresql_flags:="-w -s -m fast"}
: ${postgresql_user:="%%PG_USER%%"}
eval _pgdir="~${postgresql_user}/data%%PG_VERSION%%"
: ${postgresql_data:="${_pgdir}"}
: ${postgresql_login_class:=""}
: ${postgresql_initdb_flags:="--encoding=utf-8 --lc-collate=C"}
name=postgresql
rcvar=postgresql_enable
@@ -62,6 +64,7 @@ if [ -n "$2" ]; then
eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}"
eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}"
eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
eval postgresql_login_class="\$postgresql_${profile}_login_class:-${postgresql_login_class}}"
eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
fi
else
@@ -104,12 +107,16 @@ command_args="-D ${postgresql_data} ${postgresql_flags}"
postgresql_command()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec ${command} ${command_args} ${rc_arg}"
}
postgresql_initdb()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
}
run_rc_command "$1"
+1 -1
View File
@@ -1,7 +1,7 @@
DISTVERSION?= 14.10
# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
# not their own. Probably best to keep it at ?=0 when reset here too.
PORTREVISION?= 2
PORTREVISION?= 3
MAINTAINER?= pgsql@FreeBSD.org
@@ -14,7 +14,7 @@ is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~postgres/data/postgresql.conf.
~%%PG_USER%%/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
@@ -30,28 +30,33 @@ To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
%%PG_USER%%:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_login_class="postgres"' to /etc/rc.conf.
Then add 'postgresql_login_class="%%PG_USER%%"' to /etc/rc.conf, or
set it as the %%PG_USER%% user's login class in /etc/passwd.
======================================================================
To use PostgreSQL, enable it in rc.conf using
sysrc postgresql_enable=yes
To initialize the database, run
%%PREFIX%%/etc/rc.d/postgresql initdb
service postgresql initdb
You can then start PostgreSQL by running:
%%PREFIX%%/etc/rc.d/postgresql start
service postgresql start
For postmaster settings, see ~postgres/data/postgresql.conf
For postmaster settings, see ~%%PG_USER%%/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~postgres/data/postgresql.conf for more info
See ~%%PG_USER%%/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can be enabled during
@@ -61,9 +66,6 @@ NB. If you're not using a checksumming filesystem like ZFS, you might
and make sure you understand the performance implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
EOM
}
]
@@ -11,7 +11,8 @@
# postgresql_data="/var/db/%%PG_USER%%/data%%PG_VERSION%%"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# postgresql_login_class="default"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See %%PREFIX%%/share/doc/postgresql/README-server for more info
@@ -29,12 +30,13 @@ command=%%PREFIX%%/bin/pg_ctl
load_rc_config postgresql
# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=${postgresql_user:-"%%PG_USER%%"}
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data%%PG_VERSION%%"}
postgresql_login_class=${postgresql_login_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
: ${postgresql_enable:="NO"}
: ${postgresql_flags:="-w -s -m fast"}
: ${postgresql_user:="%%PG_USER%%"}
eval _pgdir="~${postgresql_user}/data%%PG_VERSION%%"
: ${postgresql_data:="${_pgdir}"}
: ${postgresql_login_class:=""}
: ${postgresql_initdb_flags:="--encoding=utf-8 --lc-collate=C"}
name=postgresql
rcvar=postgresql_enable
@@ -62,6 +64,7 @@ if [ -n "$2" ]; then
eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}"
eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}"
eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
eval postgresql_login_class="\$postgresql_${profile}_login_class:-${postgresql_login_class}}"
eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
fi
else
@@ -104,12 +107,16 @@ command_args="-D ${postgresql_data} ${postgresql_flags}"
postgresql_command()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec ${command} ${command_args} ${rc_arg}"
}
postgresql_initdb()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
}
run_rc_command "$1"
+1 -1
View File
@@ -1,7 +1,7 @@
DISTVERSION?= 15.5
# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
# not their own. Probably best to keep it at ?=0 when reset here too.
PORTREVISION?= 2
PORTREVISION?= 3
MAINTAINER?= pgsql@FreeBSD.org
@@ -14,7 +14,7 @@ is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~postgres/data/postgresql.conf.
~%%PG_USER%%/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
@@ -30,28 +30,33 @@ To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
%%PG_USER%%:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_login_class="postgres"' to /etc/rc.conf.
Then add 'postgresql_login_class="%%PG_USER%%"' to /etc/rc.conf, or
set it as the %%PG_USER%% user's login class in /etc/passwd.
======================================================================
To use PostgreSQL, enable it in rc.conf using
sysrc postgresql_enable=yes
To initialize the database, run
%%PREFIX%%/etc/rc.d/postgresql initdb
service postgresql initdb
You can then start PostgreSQL by running:
%%PREFIX%%/etc/rc.d/postgresql start
service postgresql start
For postmaster settings, see ~postgres/data/postgresql.conf
For postmaster settings, see ~%%PG_USER%%/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~postgres/data/postgresql.conf for more info
See ~%%PG_USER%%/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can be enabled during
@@ -61,9 +66,6 @@ NB. If you're not using a checksumming filesystem like ZFS, you might
and make sure you understand the performance implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
EOM
}
]
@@ -11,7 +11,8 @@
# postgresql_data="/var/db/%%PG_USER%%/data%%PG_VERSION%%"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# postgresql_login_class="default"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See %%PREFIX%%/share/doc/postgresql/README-server for more info
@@ -29,12 +30,13 @@ command=%%PREFIX%%/bin/pg_ctl
load_rc_config postgresql
# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=${postgresql_user:-"%%PG_USER%%"}
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data%%PG_VERSION%%"}
postgresql_login_class=${postgresql_login_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
: ${postgresql_enable:="NO"}
: ${postgresql_flags:="-w -s -m fast"}
: ${postgresql_user:="%%PG_USER%%"}
eval _pgdir="~${postgresql_user}/data%%PG_VERSION%%"
: ${postgresql_data:="${_pgdir}"}
: ${postgresql_login_class:=""}
: ${postgresql_initdb_flags:="--encoding=utf-8 --lc-collate=C"}
name=postgresql
rcvar=postgresql_enable
@@ -62,6 +64,7 @@ if [ -n "$2" ]; then
eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}"
eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}"
eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
eval postgresql_login_class="\$postgresql_${profile}_login_class:-${postgresql_login_class}}"
eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
fi
else
@@ -104,12 +107,16 @@ command_args="-D ${postgresql_data} ${postgresql_flags}"
postgresql_command()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec ${command} ${command_args} ${rc_arg}"
}
postgresql_initdb()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
}
run_rc_command "$1"
+1 -1
View File
@@ -2,7 +2,7 @@ PORTNAME?= postgresql
DISTVERSION?= 16.1
# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
# not their own. Probably best to keep it at ?=0 when reset here too.
PORTREVISION?= 2
PORTREVISION?= 3
CATEGORIES?= databases
MASTER_SITES= PGSQL/source/v${DISTVERSION}
PKGNAMESUFFIX?= ${PORTVERSION:R}${COMPONENT}
@@ -14,7 +14,7 @@ is a periodic script, %%PREFIX%%/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~postgres/data/postgresql.conf.
~%%PG_USER%%/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
@@ -30,28 +30,33 @@ To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
%%PG_USER%%:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_login_class="postgres"' to /etc/rc.conf.
Then add 'postgresql_login_class="%%PG_USER%%"' to /etc/rc.conf, or
set it as the %%PG_USER%% user's login class in /etc/passwd.
======================================================================
To use PostgreSQL, enable it in rc.conf using
sysrc postgresql_enable=yes
To initialize the database, run
%%PREFIX%%/etc/rc.d/postgresql initdb
service postgresql initdb
You can then start PostgreSQL by running:
%%PREFIX%%/etc/rc.d/postgresql start
service postgresql start
For postmaster settings, see ~postgres/data/postgresql.conf
For postmaster settings, see ~%%PG_USER%%/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~postgres/data/postgresql.conf for more info
See ~%%PG_USER%%/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can be enabled during
@@ -61,9 +66,6 @@ NB. If you're not using a checksumming filesystem like ZFS, you might
and make sure you understand the performance implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
EOM
}
]
@@ -11,7 +11,8 @@
# postgresql_data="/var/db/%%PG_USER%%/data%%PG_VERSION%%"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# postgresql_login_class="default"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See %%PREFIX%%/share/doc/postgresql/README-server for more info
@@ -29,12 +30,13 @@ command=%%PREFIX%%/bin/pg_ctl
load_rc_config postgresql
# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=${postgresql_user:-"%%PG_USER%%"}
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data%%PG_VERSION%%"}
postgresql_login_class=${postgresql_login_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"}
: ${postgresql_enable:="NO"}
: ${postgresql_flags:="-w -s -m fast"}
: ${postgresql_user:="%%PG_USER%%"}
eval _pgdir="~${postgresql_user}/data%%PG_VERSION%%"
: ${postgresql_data:="${_pgdir}"}
: ${postgresql_login_class:=""}
: ${postgresql_initdb_flags:="--encoding=utf-8 --lc-collate=C"}
name=postgresql
rcvar=postgresql_enable
@@ -62,6 +64,7 @@ if [ -n "$2" ]; then
eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}}"
eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}}"
eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}"
eval postgresql_login_class="\$postgresql_${profile}_login_class:-${postgresql_login_class}}"
eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}"
fi
else
@@ -104,12 +107,16 @@ command_args="-D ${postgresql_data} ${postgresql_flags}"
postgresql_command()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec ${command} ${command_args} ${rc_arg}"
}
postgresql_initdb()
{
${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
${su_cmd} ${postgresql_login_class:+-c ${postgresql_login_class}} \
-l ${postgresql_user} \
-c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
}
run_rc_command "$1"