File: package.preinst

package info (click to toggle)
localization-config 1.05
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 668 kB
  • ctags: 44
  • sloc: perl: 3,170; sh: 67; makefile: 38
file content (63 lines) | stat: -rwxr-xr-x 2,167 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl
# Example postinst wrapper script to configure a package.
# This calls the appropriate script according to the version map.
# This is an example, modify it according to your needs.

use strict;
use warnings;
use Getopt::Std;

use vars qw(%opts $LIB $debug $package $lang %xvermap $release);

# We use methods in common.pl
require '/usr/lib/localization-config/common/common.pl';

# The path where the scripts are kept
$LIB = '/usr/lib/localization-config';

# call init() to initialize the APT config system
init();

# Define the version map for the package
# For now we only add the minimum versions for woody and sarge.
# Specifically, the version map defines the *minimum* versions
# for which the package changes the way it is configured.
# The method is quite generic, more releases can be added on demand.
# 
# If the package does not change its configuration system, then you
# can do one of two things:
#  a) Leave just one entry in the version map (the minimum possible)
#  b) Leave all entries in the version and make the latter ones links
#     to the first one (relative links, please)
#
# If a package does not exist, for example in woody, then use just one
# release entry and write it's sarge version in the version map.
#
# If you don't want a package to be configured anymore (for example it
# needed configuration in woody but not in sarge) then you can create its
# version map normally as if it was to be configured in the first place.
# Then make the configuration script (sarge/package in this case) a dummy one.
# 
my %vermap = ( '#MINIMUM_WOODY_VERSION#',     => { RELEASE => 'woody' },
               '#MINIMUM_SARGE_VERSION#',     => { RELEASE => 'sarge' }
              );

# Get locale entry
$lang = shift;

# Which script to execute
my $script = "#SCRIPT#"; 
# Which package to search
my $package = "#PACKAGE#";

# This is a preinst script, we don't need the package to be installed.

# Get appropriate release for this package
my $release = get_release($package, %vermap);

# Execute the corresponding script
$script = "$LIB/$release/".$script;
print "Running $script $lang\n";
system ($script, $lang) if -x $script;

1;