@@ -139,6 +139,7 @@ static const char *authmethodhost = NULL;
139
139
static const char * authmethodlocal = NULL ;
140
140
static bool debug = false;
141
141
static bool noclean = false;
142
+ static bool noinstructions = false;
142
143
static bool do_sync = true;
143
144
static bool sync_only = false;
144
145
static bool show_setting = false;
@@ -2294,6 +2295,7 @@ usage(const char *progname)
2294
2295
printf (_ (" -L DIRECTORY where to find the input files\n" ));
2295
2296
printf (_ (" -n, --no-clean do not clean up after errors\n" ));
2296
2297
printf (_ (" -N, --no-sync do not wait for changes to be written safely to disk\n" ));
2298
+ printf (_ (" --no-instructions do not print instructions for next steps\n" ));
2297
2299
printf (_ (" -s, --show show internal settings\n" ));
2298
2300
printf (_ (" -S, --sync-only only sync data directory\n" ));
2299
2301
printf (_ ("\nOther options:\n" ));
@@ -2955,6 +2957,7 @@ main(int argc, char *argv[])
2955
2957
{"no-clean" , no_argument , NULL , 'n' },
2956
2958
{"nosync" , no_argument , NULL , 'N' }, /* for backwards compatibility */
2957
2959
{"no-sync" , no_argument , NULL , 'N' },
2960
+ {"no-instructions" , no_argument , NULL , 13 },
2958
2961
{"sync-only" , no_argument , NULL , 'S' },
2959
2962
{"waldir" , required_argument , NULL , 'X' },
2960
2963
{"wal-segsize" , required_argument , NULL , 12 },
@@ -3095,6 +3098,9 @@ main(int argc, char *argv[])
3095
3098
case 12 :
3096
3099
str_wal_segment_size_mb = pg_strdup (optarg );
3097
3100
break ;
3101
+ case 13 :
3102
+ noinstructions = true;
3103
+ break ;
3098
3104
case 'g' :
3099
3105
SetDataDirectoryCreatePerm (PG_DIR_MODE_GROUP );
3100
3106
break ;
@@ -3245,34 +3251,40 @@ main(int argc, char *argv[])
3245
3251
"--auth-local and --auth-host, the next time you run initdb.\n" ));
3246
3252
}
3247
3253
3248
- /*
3249
- * Build up a shell command to tell the user how to start the server
3250
- */
3251
- start_db_cmd = createPQExpBuffer ();
3254
+ if (!noinstructions )
3255
+ {
3256
+ /*
3257
+ * Build up a shell command to tell the user how to start the server
3258
+ */
3259
+ start_db_cmd = createPQExpBuffer ();
3260
+
3261
+ /* Get directory specification used to start initdb ... */
3262
+ strlcpy (pg_ctl_path , argv [0 ], sizeof (pg_ctl_path ));
3263
+ canonicalize_path (pg_ctl_path );
3264
+ get_parent_directory (pg_ctl_path );
3265
+ /* ... and tag on pg_ctl instead */
3266
+ join_path_components (pg_ctl_path , pg_ctl_path , "pg_ctl" );
3252
3267
3253
- /* Get directory specification used to start initdb ... */
3254
- strlcpy (pg_ctl_path , argv [0 ], sizeof (pg_ctl_path ));
3255
- canonicalize_path (pg_ctl_path );
3256
- get_parent_directory (pg_ctl_path );
3257
- /* ... and tag on pg_ctl instead */
3258
- join_path_components (pg_ctl_path , pg_ctl_path , "pg_ctl" );
3268
+ /* path to pg_ctl, properly quoted */
3269
+ appendShellString (start_db_cmd , pg_ctl_path );
3259
3270
3260
- /* path to pg_ctl, properly quoted */
3261
- appendShellString (start_db_cmd , pg_ctl_path );
3271
+ /* add -D switch, with properly quoted data directory */
3272
+ appendPQExpBufferStr (start_db_cmd , " -D " );
3273
+ appendShellString (start_db_cmd , pgdata_native );
3262
3274
3263
- /* add -D switch, with properly quoted data directory */
3264
- appendPQExpBufferStr ( start_db_cmd , " -D " );
3265
- appendShellString (start_db_cmd , pgdata_native );
3275
+ /* add suggested -l switch and "start" command */
3276
+ /* translator: This is a placeholder in a shell command. */
3277
+ appendPQExpBuffer (start_db_cmd , " -l %s start" , _ ( "logfile" ) );
3266
3278
3267
- /* add suggested -l switch and "start" command */
3268
- /* translator: This is a placeholder in a shell command. */
3269
- appendPQExpBuffer ( start_db_cmd , " -l %s start" , _ ( "logfile" ) );
3279
+ printf ( _ ( "\nSuccess. You can now start the database server using:\n\n"
3280
+ " %s\n\n" ),
3281
+ start_db_cmd -> data );
3270
3282
3271
- printf (_ ("\nSuccess. You can now start the database server using:\n\n"
3272
- " %s\n\n" ),
3273
- start_db_cmd -> data );
3283
+ destroyPQExpBuffer (start_db_cmd );
3284
+
3285
+ printf (_ ("\nSuccess.\n" ));
3286
+ }
3274
3287
3275
- destroyPQExpBuffer (start_db_cmd );
3276
3288
3277
3289
success = true;
3278
3290
return 0 ;
0 commit comments