From: Sandro Santilli Date: Mon, 16 May 2005 07:49:21 +0000 (+0000) Subject: Allowed custom args passing to createdb invocation X-Git-Tag: pgis_1_1_0~375 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0aab872cb93576ab9f309595c91c556ef60ec07f;p=postgis Allowed custom args passing to createdb invocation git-svn-id: http://svn.osgeo.org/postgis/trunk@1703 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/utils/postgis_restore.pl b/utils/postgis_restore.pl index 0e034d416..c299381f9 100644 --- a/utils/postgis_restore.pl +++ b/utils/postgis_restore.pl @@ -40,7 +40,7 @@ eval "exec perl -w $0 $@" if (0); -(@ARGV == 3) || die "Usage: postgis_restore.pl \nRestore a custom dump (pg_dump -Fc) of a postgis enabled database.\n"; +(@ARGV >= 3) || die "Usage: postgis_restore.pl []\nRestore a custom dump (pg_dump -Fc) of a postgis enabled database.\n"; $DEBUG=1; @@ -98,15 +98,19 @@ my %obsoleted_function = ( 'unite_finalfunc', 1 ); -my $postgissql = $ARGV[0]; -my $dbname = $ARGV[1]; -my $dump = $ARGV[2]; +my $postgissql = $ARGV[0]; shift(@ARGV); +my $dbname = $ARGV[0]; shift(@ARGV); +my $dump = $ARGV[0]; shift(@ARGV); +my $createdb_opt = ''; my $dumplist=$dump.".list"; my $dumpascii=$dump.".ascii"; +$createdb_opt = join(' ', @ARGV) if @ARGV; + print "postgis.sql is $postgissql\n"; print "dbname is $dbname\n"; print "dumpfile is $dump\n"; +print "database creation options: $createdb_opt\n" if $createdb_opt; # # Scan postgis.sql @@ -595,8 +599,8 @@ close(OUTPUT); # Create the new db and install plpgsql language # print "Creating db ($dbname)\n"; -`createdb $dbname`; -die "Can't restore in an existing database\n" if ($?); +`createdb $dbname $createdb_opt`; +die "Database creation failed\n" if ($?); print "Adding plpgsql\n"; `createlang plpgsql $dbname`;