aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql/templates
ModeNameSize
-rw-r--r--pam154logstatsplain
-rw-r--r--pg_hba.conf5700logstatsplain
-rw-r--r--pg_ident.conf1685logstatsplain
-rw-r--r--postgresql.conf18033logstatsplain
'n85' href='#n85'>85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
# vim: set et ts=4 sw=4:
package ManaTools::Rpmdragora::DB;

#============================================================= -*-perl-*-

=head1 NAME

    ManaTools::Rpmdragora::DB - Rpmdragora extension of urpm DB object

=head1 SYNOPSIS

    use ManaTools::Rpmdragora::DB;

    my $db_man = ManaTools::Rpmdragora::DB->new();
    my $urpm = $db_man->fast_open_urpmi_db();


=head1 DESCRIPTION

    This module is the Rpmdragora extension for the backend to urpm open db

=head1 SUPPORT

    You can find documentation for this module with the perldoc command:

    perldoc ManaTools::Rpmdragora::DB

=head1 SEE also

    ManaTools::Shared::urpmi_backend::DB


=head1 AUTHOR

    Angelo Naselli <anaselli@linux.it>

=head1 COPYRIGHT and LICENSE

Copyright (c) 2015-2016 Angelo Naselli <anaselli@linux.it>
    from Rpmdrake::open_db:
     Copyright (c) 2002 Guillaume Cottenceau
     Copyright (C) 2008 Aurelien Lefebvre <alkh@mandriva.org>
     Copyright (c) 2002-2014 Thierry Vignaud <thierry.vignaud@gmail.com>
     Copyright (c) 2003, 2004, 2005 MandrakeSoft SA
     Copyright (c) 2005-2007 Mandriva SA

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2, as
published by the Free Software Foundation.

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.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

=head1 METHODS

=cut

use Sys::Syslog;
use MDK::Common::File qw(cat_ mkdir_p);use ManaTools::rpmdragora;
use MDK::Common::Func qw(if_);

use Moose;
extends 'ManaTools::Shared::urpmi_backend::DB';
use feature 'state';

#=============================================================

=head2 open_rpm_db

=head3 OUTPUT

    URPM::DB: an URPM opened dataase

=head3 DESCRIPTION

    this method return an URPM::DB object

=cut

#=============================================================
override 'open_rpm_db' => sub {
    my ($self, $o_force) = @_;

    $self->rpm_root($::rpmdragora_options{'rpm-root'}[0]) if $::rpmdragora_options{'rpm-root'}[0];

    my $host;
    Sys::Syslog::syslog('info|local1', "opening the RPM database");
    if ($::rpmdragora_options{parallel} && ((undef, $host) = @{$::rpmdragora_options{parallel}})) {
        state $done;
        my $dblocation = "/var/cache/urpmi/distantdb/$host";
        if (!$done || $o_force) {

            print "syncing db from $host to $dblocation...";

            mkdir_p "$dblocation/var/lib/rpm";
            system "rsync -Sauz -e ssh $host:/var/lib/rpm/ $dblocation/var/lib/rpm";
            $? == 0 or die "Couldn't sync db from $host to $dblocation";
            $done = 1;

            print "done.\n";
        }
        URPM::DB::open($dblocation) or die "Couldn't open RPM DB";
    } else {
        my $db;
        if ($::env) {
            #- URPM has same methods as URPM::DB and empty URPM will be seen as empty URPM::DB.
            $db = new URPM;
            $db->parse_synthesis("$::env/rpmdb.cz");
        } else {
            $db = super();
        }
        $db or die "Couldn't open RPM DB (" . ($::env ? "$::env/rpmdb.cz" : $::rpmdragora_options{'rpm-root'}[0]) . ")";
    }
};

#=============================================================

=head2 fast_open_urpmi_db

=head3 OUTPUT

urpm: an urpm object

=head3 DESCRIPTION

    this method return an urpm object

=cut

#=============================================================
override 'fast_open_urpmi_db' => sub  {
    my $self = shift;

    $self->urpmi_root($::rpmdragora_options{'urpmi-root'}[0]) if $::rpmdragora_options{'urpmi-root'}[0];
    $self->rpm_root($::rpmdragora_options{'rpm-root'}[0]) if $::rpmdragora_options{'rpm-root'}[0];
    $self->wait_lock($::rpmdragora_options{'wait-lock'}) if $::rpmdragora_options{'wait-lock'};
    $self->verify_rpm(!$::rpmdragora_options{'no-verify-rpm'}) if defined $::rpmdragora_options{'no-verify-rpm'};
    $self->auto($::rpmdragora_options{auto}) if $::rpmdragora_options{auto};
    $self->set_verbosity(1);
    $self->justdb($::rpmdragora_options{justdb}) if $::rpmdragora_options{justdb};

    my $urpm = super();

    if ($::rpmdragora_options{env} && $::rpmdragora_options{env}[0]) {
        $::env = $::rpmdragora_options{env}[0];
        # prevent crashing in URPM.pm prevent when using --env:
        $::env = "$ENV{PWD}/$::env" if $::env !~ m!^/!;