~oem-qa/checkbox/patch_deselect_ancestors_when_no_child_is_selected

« back to all changes in this revision

Viewing changes to debian/hwtest.config

  • Committer: Marc Tardif
  • Date: 2007-10-08 21:19:49 UTC
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: marc.tardif@canonical.com-20071008211949-90dkeczjb6xxsalg
Extended configuration file model to centralize variables in a single location to fix bug #149630. This also made it possible to simplify extensively each package derived from hwtest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
# Debconf configuration script for this package
3
 
 
4
 
$package = "hwtest";
5
 
$conffile = "/etc/default/$package.conf";
6
 
$action = shift;
7
 
$from_version = shift;
8
 
 
9
 
use Debconf::Client::ConfModule ':all';
10
 
version('2.0');
11
 
 
12
 
my @ret;
13
 
my @current_config;
14
 
 
15
 
if (-e $conffile) {
16
 
    open CONFIG, "<$conffile";
17
 
    if (<CONFIG> =~ /^###DEBCONF###$/) {
18
 
        set("$package/override", "true");
19
 
    } else {
20
 
        my $oldval = get("$package/override");
21
 
        set("$package/override", "false");
22
 
        if ($oldval eq "true") {
23
 
            fset("$package/override", "seen", "false")
24
 
        }
25
 
 
26
 
        input($action =~ /reconfigure/ ? "critical" : "high",
27
 
            "$package/override");
28
 
        $ret = go();
29
 
    };
30
 
    @current_config = <CONFIG>;
31
 
    close CONFIG;
32
 
} else {
33
 
    set("$package/override", "true");
34
 
}
35
 
 
36
 
if (get("$package/override") eq "true") {
37
 
    foreach my $config ("question_dirs", "scripts_path", "transport_url") {
38
 
        read_and_input("$package/$config", $config, "medium");
39
 
    }
40
 
    $ret = go();
41
 
}
42
 
 
43
 
sub read_and_input {
44
 
    my ($debconf_name, $conffile_name, $priority) = @_;
45
 
    $priority = "medium" unless $priority;
46
 
 
47
 
    my @valuelist = grep(/^$conffile_name=/, @current_config);
48
 
    if (@valuelist) {
49
 
        my $value = pop(@valuelist);
50
 
        chomp($value);
51
 
        $value =~ s/^$conffile_name=//;
52
 
        set($debconf_name, $value);
53
 
    }
54
 
    input($priority, $debconf_name);
55
 
}
 
1
#!/usr/bin/python
 
2
 
 
3
import sys
 
4
 
 
5
from hwtest.install import Install
 
6
 
 
7
 
 
8
def main(args):
 
9
    if len(args) < 1:
 
10
        return 1
 
11
 
 
12
    install = Install("hwtest",
 
13
        variables=[
 
14
            "hwtest/plugins/directory",
 
15
            "hwtest/plugins/question_prompt/questions_path",
 
16
            "hwtest/plugins/manual_question/scripts_path",
 
17
            "hwtest/plugins/manual_question/data_path",
 
18
            "hwtest/plugins/launchpad_exchange/transport_url"])
 
19
 
 
20
    if args[0] == "write":
 
21
        install.write(args[1])
 
22
 
 
23
    elif args[0] == "configure":
 
24
        install.configure()
 
25
 
 
26
    return 0
 
27
 
 
28
 
 
29
if __name__ == "__main__":
 
30
    sys.exit(main(sys.argv[1:]))