~ubuntu-branches/ubuntu/lucid/libnss-ldap/lucid

« back to all changes in this revision

Viewing changes to debian/config

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2007-08-01 11:29:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070801112909-il4ra6nj6h23dig7
Tags: 255-1ubuntu1
* Removed all debconf stuff.  This is now in ldap-auth-config.
* Changed back to original /etc/ldap.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
# Debconf configuration script for PADL-ldap tools.
3
 
# By Sami Haahtinen <ressu@debian.org>
4
 
 
5
 
$conffile="/etc/libnss-ldap.conf";
6
 
$action=shift;
7
 
$from_version=shift;
8
 
 
9
 
use Debconf::Client::ConfModule ':all';
10
 
version('2.0');
11
 
 
12
 
# Not yet.. i'll prolly fix this later...
13
 
# my $capb=capb('backup');
14
 
 
15
 
my @ret;
16
 
my @current_config;
17
 
 
18
 
# The 'override' thing really ought to go, but let's see how this works
19
 
# out first.
20
 
 
21
 
if(-e $conffile) {
22
 
        open CONFIG, "<$conffile";
23
 
        if(<CONFIG> =~ /^###DEBCONF###$/) {
24
 
                set("libnss-ldap/override", "true");
25
 
        } else {
26
 
                my $oldval=get("libnss-ldap/override");
27
 
                set("libnss-ldap/override", "false"); 
28
 
                if ($oldval eq "true") {
29
 
                        fset("libnss-ldap/override", "seen", "false")
30
 
                }
31
 
 
32
 
                # well, this was a screwy from the start.. lets make it more
33
 
                # sane. priority is critical when running reconfigure, 
34
 
                # otherwise it's high.. 
35
 
                #           -- i hope thats enough..
36
 
                
37
 
                input($action =~ /reconfigure/ ? "critical" : "high", 
38
 
                        "libnss-ldap/override");
39
 
                $ret=go();
40
 
        };
41
 
        @current_config = <CONFIG>;
42
 
        close CONFIG;
43
 
} else { 
44
 
        set("libnss-ldap/override", "true");
45
 
};
46
 
 
47
 
# ok, previously in Configuring LDAP services.. 
48
 
#  - Configuration file was tested for ###DEBCONF### and override was
49
 
#    set accordingly.
50
 
#  - Eric was dumped because of an secret affair with Karen.
51
 
# Tune in next time for the next episode of, configuring LDAP services..
52
 
 
53
 
if(get("libnss-ldap/override") eq "true") {
54
 
        read_and_input('shared/ldapns/ldap-server', 'uri', 'critical');
55
 
        read_and_input('shared/ldapns/base-dn', 'base', 'critical');
56
 
        read_and_input('shared/ldapns/ldap_version', 'ldap_version', 'critical');
57
 
        $ret = go();  # yeah, we don't need that.. but in case we sometime do
58
 
 
59
 
        # Anyone with database that requires logging in should have 
60
 
        # atleast medium priority..
61
 
        input("medium", "libnss-ldap/dblogin");
62
 
        input("medium", "libnss-ldap/dbrootlogin");
63
 
        input("medium", "libnss-ldap/confperm");
64
 
        $ret = go();
65
 
 
66
 
        if(get("libnss-ldap/dbrootlogin") eq "true") {
67
 
                read_and_input('libnss-ldap/rootbinddn', 'rootbinddn', 'critical');
68
 
                input('critical', 'libnss-ldap/rootbindpw');
69
 
                $ret = go()
70
 
        }
71
 
 
72
 
        if(get("libnss-ldap/dblogin") eq "true") {
73
 
                # user wants to login.. 
74
 
                # we better set these at critical.. just in case
75
 
                read_and_input('libnss-ldap/binddn', 'binddn', 'critical');
76
 
                read_and_input('libnss-ldap/bindpw', 'bindpw', 'critical');
77
 
                $ret = go();
78
 
        }
79
 
}
80
 
 
81
 
input("critical", "libnss-ldap/nsswitch");
82
 
$ret = go();
83
 
 
84
 
sub read_and_input
85
 
{
86
 
        my ($debconf_name, $conffile_name, $priority) = @_;
87
 
        $priority = 'medium' unless $priority;
88
 
 
89
 
        my @valuelist = grep(/^$conffile_name\s/, @current_config);
90
 
        if (@valuelist) {
91
 
                my $value = pop(@valuelist);
92
 
                chomp($value);
93
 
                $value =~ s/^$conffile_name\s+//;
94
 
                set($debconf_name, $value);
95
 
        }
96
 
        input($priority, $debconf_name);
97
 
}