From e308bcff5a610d6a3bbe33b3769f03f6d4533b16 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:02:19 +0200 Subject: Adding upstream version 248. Signed-off-by: Daniel Baumann --- run-upgrade-scripts | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100755 run-upgrade-scripts (limited to 'run-upgrade-scripts') diff --git a/run-upgrade-scripts b/run-upgrade-scripts new file mode 100755 index 0000000..aae3e90 --- /dev/null +++ b/run-upgrade-scripts @@ -0,0 +1,114 @@ +#!/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: