MAJOR=5
MINOR=1
DEVNAME=console
  $   ˆÅÄÈ576Ãa–äY>” ”¾R( 	Å ÍÆ[¸&TÅ£Ç @    ‹      ½–ßo›0ÇßûWx~Øh²˜ºPiQÓ$J3MÓ4M°
63n³î¯Ÿ’A»$KÕ,OøÌ÷ŽûÜáî›`Ô›~_¡�Ó›ú0è÷Ö >[=€`T/lÝ0®†áTÊ¢°X,ô…¥s‘Àt©Ì3J)h(õHFØ?s—sþrÓ˜Dê‰\Ieû}Å?Ÿ#à÷²¤QlAÁK™ˆ¸ü‘�é@N(s¡+wXû»3=.Ãš‡†PÊÕgÉli9¾+Sô@2š0K^`ß¥y‚JzhÈY	³Œ°;=¡sŒH&=üµß}S:�éÒÛw	JE<÷ðûž7¼yö‡$�] Û57Js‰ý)%ÊyDç4ŽvŠo+ñ-ýµ;`Pi‚¸-$å¬–‚Bl¢†<+¢XE�Š¦ª’Dÿª	Ÿc|9¹Nƒþ¤*I´Qg·«!Ø3‰*âPrñ¸N¹òËfeq±1Ñ:!A“Tb!mU¾€âžÝ1¾`MU¤­1{ ‚³\e‹ý†ÑLøY†-£eiÆ;­ÕA¦ÓµÎÚ!´LçÕ(UÓ!)’ï¡Ìtå5Ç~Ã8‰i[§%Ig¤&ÙÇ qtãú¤$jy0Y³ÔæQú¢ŸŸ’æÏ"ßð<�ØOäh†£™md¶»ön"üj¢,ÿgz‘þE¥æöƒÙšÑÑ™V×nýW°Ã[UJ"6]=>Ê¦ÖîìÙ
<‹`}J»°:æ]¨n¿Á”z€        ˆÆÅÉ490Ä¾Ç ê    ‹      Å”]o›0†ïû+Î|±»pòµVJS"-R›Di¦išvalVF¶Û,ûõ3!Q³©Ñ>.6qÁ?œó¾/ú*]N7ŸV3x¿¹»…Õ‡w·ó)�âÇÑ1Ý¤ÝÂ8êg¤ô¾™ n·Ûh;ŠŒ-p³ÆÒWzŒÎ[Å}$¼ Émï%@KÉD8õÊk™Ìk!¿‚ÉÍ£wJÈá±@a*‡NÖ"WZFBV&*]Ä�iÂ a¸ë9§�t·sÈ5s3møê ^¢{ÌÂ‚—:ÁPÈ'Å%f® ØÍŠð ‰fFìZ¥ƒÿ¨*ß‡Ã²½¸¶´	õ%<1­Š:&Þ4$¡ª*ÀYTÜÔmsV?D…Ê	0ícòy>]~	ú²}:¡J+ó˜¼�Æ‹ëeœ’dÁ*I‘½ÌÜæ†$·Ìy¨ŒP¹’â,|ßÁ÷êÛù†iÇ¤Òq«¯LýŒb°xj•í¼¾	J{JuˆøUŒÿÆêf=[lÒùº‹D´-žÕýËwL’³²ö�*+¹7vwˆ¡ÓôºÎ\s}¼„ƒI«ŠÒ“ /’�Ln´�ö4›s©DØŸì� ùX�jýIÜ°?¼ì½QW“ñÀ_¹øÍ¯ ûƒâ~ÏRìþ.ßñ˜3À    5   ˆl–Ãa¾”*i?u8 Y¸î41hß�þDÄ³Ž O4é%u�ùËƒy–^Ê¿È  ’    #!/usr/bin/perl -wT

# Completely delete a PostgreSQL cluster. Fails if there is still a server
# process attached.
#
# (C) 2005-2009 Martin Pitt <mpitt@debian.org>
# (C) 2015-2021 Christoph Berg <myon@debian.org>
#
#  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 warnings;
use Getopt::Long;
use PgCommon;

# untaint environment
$ENV{'PATH'} = '/bin:/usr/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

my $stopserver = 0;
exit 1 unless GetOptions ('stop-server' => \$stopserver, 'stop' => \$stopserver);

# command line options
if ($#ARGV != 1) {
    print "Usage: $0 [--stop] <version> <cluster>\n";
    exit 1;
}

my ($version) = $ARGV[0] =~ /^(\d+\.?\d+)$/;
my ($cluster) = $ARGV[1] =~ /^([-.\w]+)$/;
error 'invalid version' unless defined $version;
error 'invalid cluster name' unless defined $cluster;

my %info;
my $c; # configuration directory
my $startconf;

if (cluster_exists $version, $cluster) {
    %info = cluster_info ($version, $cluster);
    validate_cluster_owner \%info if ($info{pgdata} && -d $info{pgdata}); # ignore missing data directory

    if ($info{'running'}) {
	if ($stopserver) {
	    if ($info{'pgdata'} && -d $info{'pgdata'}) {
		if (system ('pg_ctlcluster', $version, $cluster, 'stop')) {
		    error 'could not stop server, aborting';
		}
	    } else {
		print STDERR "Warning: corrupted cluster: data directory does not exist any more, but server is still running; you have to manually kill the postgres process\n";
	    }
	} else {
	    error 'This cluster is still running. Stop it or supply the --stop option';
	}
    }
    $c = $info{'configdir'};
    $startconf = $info{'start'};
} else {
    $c = "/etc/postgresql/$version/$cluster";

    # check if we have a broken cluster, clean up if necessary
    -d $c or error 'specified cluster does not exist';
}

# disable systemd-enabled clusters
if (not exists $ENV{'PG_CLUSTER_CONF_ROOT'} and -d '/run/systemd/system') {
    if ($> == 0) {
        system "systemctl", "disable", "postgresql\@$version-$cluster";
        system "systemctl", "disable", "--now", "pg_receivewal\@$version-$cluster";
        system "systemctl", "disable", "--now", "pg_basebackup\@$version-$cluster.timer";
        system "systemctl", "disable", "--now", "pg_dump\@$version-$cluster.timer";
    }
}

if ($info{'pgdata'} && -d $info{'pgdata'}) {
    # remove custom wal directory
    if ($info{waldi