pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/databases/postgresql14-server/files Remove unneded dou...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/10b486a8c2f4
branches:  trunk
changeset: 386165:10b486a8c2f4
user:      martin <martin%pkgsrc.org@localhost>
date:      Sun Oct 02 14:24:50 2022 +0000

description:
Remove unneded double evaluation from big parts (fixing quoting bugs).
Split command line arguments in regular "command_args" and the
daemon command args, as some of the latter are not working when initializing
the system database tables.
Avoid obsolete "-a" operator to test.

diffstat:

 databases/postgresql14-server/files/pgsql.sh |  27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diffs (92 lines):

diff -r b1fb60e56569 -r 10b486a8c2f4 databases/postgresql14-server/files/pgsql.sh
--- a/databases/postgresql14-server/files/pgsql.sh      Sun Oct 02 13:49:41 2022 +0000
+++ b/databases/postgresql14-server/files/pgsql.sh      Sun Oct 02 14:24:50 2022 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: pgsql.sh,v 1.1 2021/10/08 10:23:44 adam Exp $
+# $NetBSD: pgsql.sh,v 1.2 2022/10/02 14:24:50 martin Exp $
 #
 # PostgreSQL database rc.d control script
 #
@@ -30,6 +30,7 @@
 : ${pgsql_group:=@PGGROUP@}
 : ${pgsql_home:=@PGHOME@}
 
+pgsql_nfiles=4096
 extra_commands="initdb reload"
 initdb_cmd="pgsql_initdb"
 start_precmd="pgsql_precmd"
@@ -39,7 +40,7 @@
 stop_cmd="pgsql_stop"
 reload_cmd="pgsql_reload"
 
-if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+if [ -f /etc/rc.subr ] && [ -d /etc/rc.d ] && [ -f /etc/rc.d/DAEMON ]; then
        load_rc_config $name
 elif [ -f /etc/rc.conf ]; then
        . /etc/rc.conf
@@ -48,13 +49,14 @@
 cd /
 
 command_args="-w -s -D ${pgsql_home}/data -m fast -l ${pgsql_home}/errlog"
+command_args_daemon="${command_args}"
 if [ -n "${pgsql_flags}" ]; then
-       command_args="${command_args} -o \\\"${pgsql_flags}\\\""
+       command_args_daemon="${command_args} -o \"${pgsql_flags}\""
 fi
 
 pgsql_precmd()
 {
-       ulimit -n 4096
+       ulimit -n ${pgsql_nfiles}
        if [ ! -d ${pgsql_home}/data/base ]; then
                pgsql_initdb
        fi
@@ -71,40 +73,35 @@
                @CHOWN@ ${pgsql_user} ${pgsql_home}
                @CHGRP@ ${pgsql_group} ${pgsql_home}
                @CHMOD@ 0700 ${pgsql_home}
-               doit="@SU@ -m ${pgsql_user} -c '${command} init ${command_args}'"
-               eval $doit
+               @SU@ -m ${pgsql_user} -c "${command} init ${command_args}"
        fi
 }
 
 pgsql_start()
 {
        @ECHO@ "Starting ${name}."
-       doit="@SU@ -m ${pgsql_user} -c '${command} start ${command_args}'"
-       eval $doit
+       @SU@ -m ${pgsql_user} -c "${command} start ${command_args_daemon}"
 }
 
 pgsql_restart()
 {
        @ECHO@ "Restarting ${name}."
-       doit="@SU@ -m ${pgsql_user} -c '${command} restart ${command_args}'"
-       eval $doit
+       @SU@ -m ${pgsql_user} -c "${command} restart ${command_args_daemon}"
 }
 
 pgsql_stop()
 {
        @ECHO@ "Stopping ${name}."
-       doit="@SU@ -m ${pgsql_user} -c '${command} stop ${command_args}'"
-       eval $doit
+       @SU@ -m ${pgsql_user} -c "${command} stop ${command_args}"
 }
 
 pgsql_reload()
 {
        @ECHO@ "Reloading ${name}."
-       doit="@SU@ -m ${pgsql_user} -c '${command} reload ${command_args}'"
-       eval $doit
+       @SU@ -m ${pgsql_user} -c "${command} reload ${command_args_daemon}"
 }
 
-if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+if [ -f /etc/rc.subr ] && [ -d /etc/rc.d ] && [ -f /etc/rc.d/DAEMON ]; then
        run_rc_command "$1"
 else
        pidfile="${pgsql_home}/data/postmaster.pid"



Home | Main Index | Thread Index | Old Index