#!/usr/bin/perl -w # Run all upgrade scripts. # # (C) 2005-2009 Martin Pitt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. use strict; use PgCommon; error "Usage: $0 " if $#ARGV != 0; # Return the cluster's databases that match the given scope. # Arguments: sub dbs_from_scope { my ($v, $c, $scope) = @_; my @dbs = get_cluster_databases $v, $c; unless (defined $dbs[0]) { print ' Error: cluster is not running'; return (); } # filter out the postgres database @dbs = grep { $_ ne 'postgres' } @dbs; return @dbs if $scope eq 't0'; return grep { $_ ne 'template0' } @dbs if $scope eq 't1'; return grep { $_ ne 'template0' && $_ ne 'template1' } @dbs if $scope eq 'db'; return grep { $_ eq 'template1' } @dbs if $scope eq 'cluster'; } # Arguments: