This file is indexed.

postinst is in libapache-sessionx-perl 2.01-4.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#! /usr/bin/perl -w

package Debconf::Client::ConfModuleX;

#
# Add the error checking behaviour that I think
# Debconf::Client::ConfModule should have anyway
#

use Debconf::Client::ConfModule;

use base qw(Exporter);

BEGIN {
  *EXPORT_OK = \@Debconf::Client::ConfModule::EXPORT_OK;
  *EXPORT_TAGS = \%Debconf::Client::ConfModule::EXPORT_TAGS;
}

sub AUTOLOAD {
  my $cmd = our $AUTOLOAD;
  $cmd =~ s|.*:||;

  my ($ret, $text) = &{"Debconf::Client::ConfModule::$cmd"}(@_);
  if ($ret == 0 or $ret >= 30 && $ret < 100) {
    # expected return values
    return wantarray ? ($ret, $text) : $text;
  }

  $cmd = uc $cmd;
  my $msg = $text ? "$text ($ret)" : "code $ret";

  require Carp;
  if ($ret < 10 || $ret >= 110) {
    Carp::confess("Debconf $cmd returned reserved error code? $msg");
  } elsif ($ret < 20) {
    # Dump @_ ?
    Carp::croak("Debconf $cmd: invalid parameters: $msg");
  } elsif ($ret < 30) {
    Carp::confess("Debconf $cmd: syntax error: $msg");
  } else { # $ret < 110
    Carp::confess("Debconf $cmd: debconf internal error: $msg");
  }
}

1;



package main;

use IO::File;
use Data::Dumper;

#use Debconf::Client::ConfModuleX qw(get);
BEGIN { Debconf::Client::ConfModuleX->import(qw(get)) }

use strict;

my $configfile = '/var/lib/libapache-sessionx-perl/Config.pm';


# read config vales out of debconf and build A::SX::Config structures

# from Apache::SessionX Makefile.PL:
my %Store =
    (
    'File' => 
        {
        param =>
            {
            'Store'     => 'File',
            'Lock'      => 'Semaphore',
            'Serialize' => 'Storable',
            'Directory' => '?',
            },
        },

    'FileFile' => 
        {
        param =>
            {
            'Store'     => 'File',
            'Lock'      => 'File',
            'Serialize' => 'Storable',
            'Directory' => '?',
            'LockDirectory' => '?',
            },
        },

    'DB_File' => 
        {
        param =>
            {
            'Lock'      => 'File',
            'Serialize' => 'Storable',
            'FileName' => '?',
            'LockDirectory' => '?',
            },
        },

    'Mysql' => 
        {
        param =>
            {
            'Store'     => 'MySQL',
            'Lock'      => 'Semaphore',
            'Serialize' => 'Storable',
            'DataSource' => '?',
            'UserName'   => '?',
            'Password'   => '?',
            },
        'require'   => 
            [
            'DBD::mysql',
            ],
        },

    'MysqlMysql' => 
        {
        param =>
            {
            'Store'     => 'MySQL',
            'Lock'      => 'MySQL',
            'Serialize' => 'Storable',
            'DataSource' => '?',
            'UserName'   => '?',
            'Password'   => '?',
            'LockDataSource' => '?',
            'LockUserName'   => '?',
            'LockPassword'   => '?',
            },
        'require'   => 
            [
            'DBD::mysql',
            ],
        },

    'Oracle' => 
        {
        param =>
            {
            'Lock'      => 'Null',
            'Serialize' => 'Base64',
            'Commit'     => 1,
            'DataSource' => '?',
            'UserName'   => '?',
            'Password'   => '?',
            },
        'require'   => 
            [
            'DBD::Oracle',
            ],
        },
    'Sybase' =>
        {
        param =>
            {
            'Lock'      => 'Null',
            'Serialize' => 'Sybase',
            'Commit'     => 1,
            'DataSource' => '?',
            'UserName'   => '?',
            'Password'   => '?',
            },
        'require'   => 
            [
            'DBD::Sybase',
            ],
        },
    'Postgres' => 
        {
        param =>
            {
            'Lock'      => 'Null',
            'Serialize' => 'Base64',
            'Commit'     => 1,
            'DataSource' => '?',
            'UserName'   => '?',
            'Password'   => '?',
            },
        'require'   => 
            [
            'DBD::Pg',
            ],
        },
    ) ;

my @confs = ();
my %param = ();

sub get_store_val {
  my $lc = lc $_[1];
  get "libapache-sessionx-perl/store_$_[0]_$lc";
}

foreach (split ',', get 'libapache-sessionx-perl/priv_keys') {
  my %this = ();
  my $type = get_store_val $_, 'type';
  my $name = get_store_val $_, 'name';

  # copy across values from %Store, filling '?' with debconf values
  while (my ($param, $value) = each %{$Store{$type}{param}}) {
    $this{$param} = $value eq '?' ? get_store_val($_, $param) : $value;
  }

  $this{Store}	   ||= $type;
  $this{Serialize} ||= 'Storeable';
  $this{Lock}	   ||= 'Semaphore';
  $this{Generate}  ||= 'MD5';

  push @confs, $name;
  $param{$name} = \%this;
}

my $default = get 'libapache-sessionx-perl/default_store';

my $newconfig = "$configfile.new";

my $newfh = new IO::File $newconfig, 'w' or
  die "Couldn't write to $newconfig: $!\n";

END {
  # cleanup if something went wrong
  if ($newfh) {
    undef $newfh;
    unlink $newconfig;
  }
}

# generate config file

print $newfh <<'EOF';
#
# Apache::SessionX configuration
#
# Autogenerated by libapache-sessionx-perl Debconf script, do not edit!
# Run dpkg-reconfigure libapache-sessionx-perl if you wish to make changes.
#

package Apache::SessionX::Config ;

EOF

$newfh->print(Data::Dumper->Dump([$default, \@confs, \%param],
				 [qw(default *confs *param)]));

print $newfh <<'EOF';

1;
EOF

# commit changes
close $newfh
  or die "Error flushing $newconfig: $!\n";
rename $newconfig, $configfile
  or die "Error renaming $newconfig to $configfile: $!\n";


# and the usual debhelper guff
my $temp = "set -e\nset -- @ARGV\n" . << 'MYEOF';

MYEOF
system($temp) == 0
  or die "Problem with debhelper scripts: $!\n";