public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alexander Lakhin <[email protected]>
To: [email protected]
To: Christoph Berg <[email protected]>
Subject: Re: Confusing message on server install
Date: Tue, 29 Oct 2019 10:00:00 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Hello,

18.10.2019 13:19, Alexander Lakhin wrote:
> While installing the postgresql-12 server package on Debian Buster I see
> the following output:
> # apt-get install postgresql-12
> ...
> Creating new PostgreSQL cluster 12/main ...
> /usr/lib/postgresql/12/bin/initdb -D /var/lib/postgresql/12/main
> --auth-local peer --auth-host md5
> ...
> performing post-bootstrap initialization ... ok
> syncing data to disk ... ok
>
> Success. You can now start the database server using:
>
>     pg_ctlcluster 12 main start
> So I see the message "Success. You can now start the database server
> using:", but in fact the server is running.
Please look at the proposed improvement that suppresses this confusing
message.

Best regards,
Alexander

Author: Christoph Berg <[email protected]>
Description: Debian-specific cluster startup message from initdb
Forwarded: No, Debian specific

--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -3361,9 +3361,10 @@
 	/* translator: This is a placeholder in a shell command. */
 	appendPQExpBuffer(start_db_cmd, " -l %s start", _("logfile"));
 
-	printf(_("\nSuccess. You can now start the database server using:\n\n"
+	if (!getenv("CLUSTER_START_COMMAND") || strlen(getenv("CLUSTER_START_COMMAND")) > 0)
+		printf(_("\nSuccess. You can now start the database server using:\n\n"
 			 "    %s\n\n"),
-		   start_db_cmd->data);
+			   getenv("CLUSTER_START_COMMAND") ? getenv("CLUSTER_START_COMMAND") : start_db_cmd->data);
 
 	destroyPQExpBuffer(start_db_cmd);
 


Attachments:

  [text/x-patch] pg_createcluster.diff (610B, 2-pg_createcluster.diff)
  download | inline diff:
--- a/pg_createcluster	2019-07-09 16:57:45.000000000 +0300
+++ b/pg_createcluster	2019-10-29 06:16:00.935081461 +0300
@@ -351,7 +351,9 @@
 } else {
     print "Creating new PostgreSQL cluster $version/$cluster ...\n";
     # ask initdb to print a different cluster start command (Debian patch)
-    $ENV{CLUSTER_START_COMMAND} = "pg_ctlcluster $version $cluster start";
+    if (!defined $ENV{CLUSTER_START_COMMAND}) {
+        $ENV{CLUSTER_START_COMMAND} = "pg_ctlcluster $version $cluster start";
+    }
     init_db $version, $datadir, $owneruid, $ownergid, \@initdb_opts_from_cli;
     $newcluster = 1;
 }


  [text/x-patch] maintscripts-functions.diff (543B, 3-maintscripts-functions.diff)
  download | inline diff:
--- a/maintscripts-functions	2018-09-20 17:02:06.000000000 +0300
+++ b/maintscripts-functions	2019-10-29 07:41:55.892583740 +0300
@@ -86,6 +86,7 @@
         create=$(pg_conftool /etc/postgresql-common/createcluster.conf show -bs create_main_cluster || :)
         if [ -z "$2" ] && [ "$create" != "off" ]; then
             set_system_locale
+            export CLUSTER_START_COMMAND=""
             pg_createcluster -u postgres $VERSION main ||
                 echo "Error: could not create default cluster. Please create it manually with
 


  [text/plain] initdb-startup-message (767B, 4-initdb-startup-message)
  download | inline diff:
Author: Christoph Berg <[email protected]>
Description: Debian-specific cluster startup message from initdb
Forwarded: No, Debian specific

--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -3361,9 +3361,10 @@
 	/* translator: This is a placeholder in a shell command. */
 	appendPQExpBuffer(start_db_cmd, " -l %s start", _("logfile"));
 
-	printf(_("\nSuccess. You can now start the database server using:\n\n"
+	if (!getenv("CLUSTER_START_COMMAND") || strlen(getenv("CLUSTER_START_COMMAND")) > 0)
+		printf(_("\nSuccess. You can now start the database server using:\n\n"
 			 "    %s\n\n"),
-		   start_db_cmd->data);
+			   getenv("CLUSTER_START_COMMAND") ? getenv("CLUSTER_START_COMMAND") : start_db_cmd->data);
 
 	destroyPQExpBuffer(start_db_cmd);
 


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Confusing message on server install
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox