From nobody Thu Jan 11 21:51:25 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T9yzd2HQpz574Yq; Thu, 11 Jan 2024 21:51:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T9yzd1mW4z4Jdv; Thu, 11 Jan 2024 21:51:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705009885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YGaqctreBvJ2xrT5xpGGQOcv70IHqJ+xZa5hog2ynZM=; b=y4Xl9yN3AdhZ8LovVkcN+IBUIF7eMqlGbOdftknbh2T25Fcl2xqknuy+U8ryMID0B0DtwX 7Ju9z5IGikVsz27tlNFt+iF4h7rR1ecNUtDZ8IvdKEa4Y66xlM6nWdnPclHiV+4Km9rPIa +bnDzAk9+8APAhkOtSRtrsW++iRU7QozT9/Vo3brkmDOvrf2R/mcujxGAgZm5NswmCtEvb JPkwvoER53YLmk2kK+jM6ZjvtGQ6V09MmNhbbsyxwK4YGPWnQuu9u5alH2mnsmqWO1P1+1 oi8/3BT2JW6fTJFtXUk4wNpjzOa7EQ41phtSyePivTnELT4GqywJso4PEPT4lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705009885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YGaqctreBvJ2xrT5xpGGQOcv70IHqJ+xZa5hog2ynZM=; b=NvuII6hPxTYOoWLjlFePn/aC8lyo/v1/JTH12hPVs0jG1c1Ifz8FLUrVTnI/zOwNn/aPD7 myZy/s3q4Se992a0QAYjJiDkaZK3DNsz1kO8TJtuNSsQGlTLB76L4VVnVAUx6SWHQ5bzF+ o+rRp9SqxE+m8Hox8wd0EpcXbhlGKGoED56xcumiVUDAgAdxKb5xgRbZtNGirjl8f5u0WV n4zzjH7QV0qe+/s3qnvZ4yj2DgnSEcdS78mYwgQ9W2Q0P4fbrYJzc6PEINUvyi+ALbditU tXKY0ARIMktANjhI+JfAQ/iSAtJu8vy9IsrbesOm6XWjIMunPM5eoikznsUuCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705009885; a=rsa-sha256; cv=none; b=VSvYCgUf75w+6Xm50XApFBedzX7WouYHUPBonHcsFiX3WLcU78B6osbGLeNi02nzVb995a ArtCMAz+uJKYD1uo9m/75PEqsbgjOeWIHcMbAjFy69MVh+kp/Cy1heGZZNKz7EtviRsTvA pUCI0adRRvK/tCThgUeG8mzuXj9ZRR4plY5BaAjZ3UfbVsNlbzzfpbMlfJahhEM45uZ7d9 tKk6IBoYQMHXIJWXr2eC97PQREwhMAOljzbWaaeg8ALlDbjqfgd5oFPhmKm+GNkfqOdicO o0PWNScfBI76YzXRURREjQdSJGNSpNjYSuCBmyiFJ1zvpLpw0gIfE1HVIIoIIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T9yzd0r0nzbvy; Thu, 11 Jan 2024 21:51:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40BLpP3I066155; Thu, 11 Jan 2024 21:51:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40BLpPJr066153; Thu, 11 Jan 2024 21:51:25 GMT (envelope-from git) Date: Thu, 11 Jan 2024 21:51:25 GMT Message-Id: <202401112151.40BLpPJr066153@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Palle Girgensohn Subject: git: 4e2b811c04ce - main - databases/postgresql??-server: honour login class set in /etc/passwd List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: girgen X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e2b811c04ce0643e2f526f65a0cef442c14d4a0 Auto-Submitted: auto-generated The branch main has been updated by girgen: URL: https://cgit.FreeBSD.org/ports/commit/?id=4e2b811c04ce0643e2f526f65a0cef442c14d4a0 commit 4e2b811c04ce0643e2f526f65a0cef442c14d4a0 Author: Palle Girgensohn AuthorDate: 2024-01-11 21:50:31 +0000 Commit: Palle Girgensohn CommitDate: 2024-01-11 21:50:31 +0000 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 --- databases/postgresql12-server/Makefile | 2 +- .../files/pkg-message-server.in | 22 ++++++++++--------- databases/postgresql12-server/files/postgresql.in | 25 ++++++++++++++-------- databases/postgresql13-server/Makefile | 2 +- .../files/pkg-message-server.in | 22 ++++++++++--------- databases/postgresql13-server/files/postgresql.in | 25 ++++++++++++++-------- databases/postgresql14-server/Makefile | 2 +- .../files/pkg-message-server.in | 22 ++++++++++--------- databases/postgresql14-server/files/postgresql.in | 25 ++++++++++++++-------- databases/postgresql15-server/Makefile | 2 +- .../files/pkg-message-server.in | 22 ++++++++++--------- databases/postgresql15-server/files/postgresql.in | 25 ++++++++++++++-------- databases/postgresql16-server/Makefile | 2 +- .../files/pkg-message-server.in | 22 ++++++++++--------- databases/postgresql16-server/files/postgresql.in | 25 ++++++++++++++-------- 15 files changed, 145 insertions(+), 100 deletions(-) diff --git a/databases/postgresql12-server/Makefile b/databases/postgresql12-server/Makefile index 755fc000f558..7762b9b91697 100644 --- a/databases/postgresql12-server/Makefile +++ b/databases/postgresql12-server/Makefile @@ -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 diff --git a/databases/postgresql12-server/files/pkg-message-server.in b/databases/postgresql12-server/files/pkg-message-server.in index 88e83f067edd..6370d4a017cc 100644 --- a/databases/postgresql12-server/files/pkg-message-server.in +++ b/databases/postgresql12-server/files/pkg-message-server.in @@ -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 } ] diff --git a/databases/postgresql12-server/files/postgresql.in b/databases/postgresql12-server/files/postgresql.in index 390c607f323e..ea232a915475 100644 --- a/databases/postgresql12-server/files/postgresql.in +++ b/databases/postgresql12-server/files/postgresql.in @@ -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" diff --git a/databases/postgresql13-server/Makefile b/databases/postgresql13-server/Makefile index a09a2f212118..8ace87490b33 100644 --- a/databases/postgresql13-server/Makefile +++ b/databases/postgresql13-server/Makefile @@ -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 diff --git a/databases/postgresql13-server/files/pkg-message-server.in b/databases/postgresql13-server/files/pkg-message-server.in index 88e83f067edd..6370d4a017cc 100644 --- a/databases/postgresql13-server/files/pkg-message-server.in +++ b/databases/postgresql13-server/files/pkg-message-server.in @@ -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 } ] diff --git a/databases/postgresql13-server/files/postgresql.in b/databases/postgresql13-server/files/postgresql.in index 390c607f323e..ea232a915475 100644 --- a/databases/postgresql13-server/files/postgresql.in +++ b/databases/postgresql13-server/files/postgresql.in @@ -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" diff --git a/databases/postgresql14-server/Makefile b/databases/postgresql14-server/Makefile index 9e885c421f71..0e67fa4dc5d2 100644 --- a/databases/postgresql14-server/Makefile +++ b/databases/postgresql14-server/Makefile @@ -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 diff --git a/databases/postgresql14-server/files/pkg-message-server.in b/databases/postgresql14-server/files/pkg-message-server.in index 88e83f067edd..6370d4a017cc 100644 --- a/databases/postgresql14-server/files/pkg-message-server.in +++ b/databases/postgresql14-server/files/pkg-message-server.in @@ -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 } ] diff --git a/databases/postgresql14-server/files/postgresql.in b/databases/postgresql14-server/files/postgresql.in index 390c607f323e..ea232a915475 100644 --- a/databases/postgresql14-server/files/postgresql.in +++ b/databases/postgresql14-server/files/postgresql.in @@ -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" diff --git a/databases/postgresql15-server/Makefile b/databases/postgresql15-server/Makefile index 7dcc58a4c0fa..c4fa63f7baf1 100644 --- a/databases/postgresql15-server/Makefile +++ b/databases/postgresql15-server/Makefile @@ -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 diff --git a/databases/postgresql15-server/files/pkg-message-server.in b/databases/postgresql15-server/files/pkg-message-server.in index 88e83f067edd..6370d4a017cc 100644 --- a/databases/postgresql15-server/files/pkg-message-server.in +++ b/databases/postgresql15-server/files/pkg-message-server.in @@ -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 } ] diff --git a/databases/postgresql15-server/files/postgresql.in b/databases/postgresql15-server/files/postgresql.in index 390c607f323e..ea232a915475 100644 --- a/databases/postgresql15-server/files/postgresql.in +++ b/databases/postgresql15-server/files/postgresql.in @@ -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" diff --git a/databases/postgresql16-server/Makefile b/databases/postgresql16-server/Makefile index b33f71a47525..9c08dd554452 100644 --- a/databases/postgresql16-server/Makefile +++ b/databases/postgresql16-server/Makefile @@ -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} diff --git a/databases/postgresql16-server/files/pkg-message-server.in b/databases/postgresql16-server/files/pkg-message-server.in index 88e83f067edd..6370d4a017cc 100644 --- a/databases/postgresql16-server/files/pkg-message-server.in +++ b/databases/postgresql16-server/files/pkg-message-server.in @@ -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 } ] diff --git a/databases/postgresql16-server/files/postgresql.in b/databases/postgresql16-server/files/postgresql.in index 390c607f323e..ea232a915475 100644 --- a/databases/postgresql16-server/files/postgresql.in +++ b/databases/postgresql16-server/files/postgresql.in @@ -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"