|
21 | 21 |
|
22 | 22 |
|
23 | 23 | staticvoidusage(void); |
24 | | -staticvoidcheck_required_directory(char**dirpath, |
| 24 | +staticvoidcheck_required_directory(char**dirpath,char**configpath, |
25 | 25 | char*envVarName,char*cmdLineOption,char*description); |
26 | 26 |
|
27 | 27 |
|
@@ -203,14 +203,14 @@ parseCommandLine(int argc, char *argv[]) |
203 | 203 | } |
204 | 204 |
|
205 | 205 | /* Get values from env if not already set */ |
206 | | -check_required_directory(&old_cluster.bindir,"PGBINOLD","-b", |
| 206 | +check_required_directory(&old_cluster.bindir,NULL,"PGBINOLD","-b", |
207 | 207 | "old cluster binaries reside"); |
208 | | -check_required_directory(&new_cluster.bindir,"PGBINNEW","-B", |
| 208 | +check_required_directory(&new_cluster.bindir,NULL,"PGBINNEW","-B", |
209 | 209 | "new cluster binaries reside"); |
210 | | -check_required_directory(&old_cluster.pgdata,"PGDATAOLD","-d", |
211 | | -"old cluster data resides"); |
212 | | -check_required_directory(&new_cluster.pgdata,"PGDATANEW","-D", |
213 | | -"new cluster data resides"); |
| 210 | +check_required_directory(&old_cluster.pgdata,&old_cluster.pgconfig, |
| 211 | +"PGDATAOLD","-d","old cluster data resides"); |
| 212 | +check_required_directory(&new_cluster.pgdata,&new_cluster.pgconfig, |
| 213 | +"PGDATANEW","-D","new cluster data resides"); |
214 | 214 | } |
215 | 215 |
|
216 | 216 |
|
@@ -284,15 +284,20 @@ or\n"), old_cluster.port, new_cluster.port, os_info.user); |
284 | 284 | * user hasn't provided the required directory name. |
285 | 285 | */ |
286 | 286 | staticvoid |
287 | | -check_required_directory(char**dirpath,char*envVarName, |
288 | | -char*cmdLineOption,char*description) |
| 287 | +check_required_directory(char**dirpath,char**configpath, |
| 288 | +char*envVarName,char*cmdLineOption, |
| 289 | +char*description) |
289 | 290 | { |
290 | 291 | if (*dirpath==NULL||strlen(*dirpath)==0) |
291 | 292 | { |
292 | 293 | constchar*envVar; |
293 | 294 |
|
294 | 295 | if ((envVar=getenv(envVarName))&&strlen(envVar)) |
| 296 | +{ |
295 | 297 | *dirpath=pg_strdup(envVar); |
| 298 | +if (configpath) |
| 299 | +*configpath=pg_strdup(envVar); |
| 300 | +} |
296 | 301 | else |
297 | 302 | pg_log(PG_FATAL,"You must identify the directory where the %s.\n" |
298 | 303 | "Please use the %s command-line option or the %s environment variable.\n", |
|