This file is indexed.

/usr/share/checkbox/install/config is in checkbox 0.13.7.

This file is owned by root:root, with mode 0o755.

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
#!/usr/bin/python
#
# This program is meant to be called by the debian installer in order to
# create configuration files for the checkbox package and derived packages
# based on the preseed values.

import os
import re
import sys
import commands
import posixpath

from ConfigParser import ConfigParser
from optparse import OptionParser

from debconf import Debconf, DebconfCommunicator


DEFAULT_SECTION = "DEFAULT"


class Config(ConfigParser):

    def write(self, fp):
        """Write an .ini-format representation of the configuration state."""
        if self._defaults:
            fp.write("[%s]\n" % DEFAULT_SECTION)
            defaults = dict(self._defaults)

            # Write includes first
            if 'includes' in defaults:
                key = 'includes'
                value = defaults.pop(key)
                value = str(value).replace('\n', '\n\t')
                fp.write("%s = %s\n" % (key, value))

            for (key, value) in defaults.items():
                value = str(value).replace('\n', '\n\t')
                fp.write("%s = %s\n" % (key, value))

            fp.write("\n")

        # Sort sections and options to prevent diffs
        sections = sorted(self._sections)
        for section in sections:
            fp.write("[%s]\n" % section)
            options = self._sections[section]
            options = [(k, options[k]) for k in sorted(options.keys())]
            for (key, value) in options:
                if key != "__name__":
                    fp.write("%s = %s\n" %
                             (key, str(value).replace('\n', '\n\t')))

            fp.write("\n")


class Install(object):
    """Install module for generating checkbox configuration files.

    The checkbox module and derivatives use a configuration file format
    compatible with ConfigParser. The values for the keys defined in
    this file can be preseeded during the installation of the package by
    using this module during the config phase of the package installation
    process.
    """
    question_separator = "/"
    template_separator = ": "

    configs_base = "/usr/share/%(base_name)s/configs/%(name)s.ini"
    examples_base = "/usr/share/%(base_name)s/examples/%(name)s.ini"

    def __init__(self, name, base_name=None, configs_path=None,
                 examples_path=None, templates_path=None):
        self.name = name
        self.base_name = name if base_name is None else base_name
        self._configs_path = configs_path or self.configs_base \
            % {"name": name, "base_name": self.base_name}
        self._examples_path = examples_path or self.examples_base \
            % {"name": name, "base_name": self.base_name}
        self._templates_path = commands.getoutput(
            "dpkg-query --control-path %(name)s templates"
            % {"name": name, "base_name": self.base_name})

        self._config = Config()
        if os.environ.get("DEBIAN_HAS_FRONTEND"):
            if os.environ.get("DEBCONF_REDIR"):
                write = os.fdopen(3, "w")
            else:
                write = sys.stdout
            self._debconf = Debconf(write=write)
        else:
            self._debconf = DebconfCommunicator(self.name)

    def write(self, file):
        """
        Write phase of the config process which takes a file object
        as argument.
        """
        for path in [self._examples_path, self._configs_path]:
            if path and posixpath.isfile(path):
                self._config.read(path)

        # Hack to retrieve questions from templates file
        if posixpath.exists(self._templates_path):
            templates_file = open(self._templates_path)
            buffer = templates_file.read()
            for block in re.split(r"\n{2,}", buffer):
                if not block:
                    continue

                element = {}
                for line in block.split("\n"):
                    if not line or line.startswith(" "):
                        continue

                    (key, value) = line.split(self.template_separator, 1)
                    key = key.lower()
                    element[key] = value

                question = element["template"]
                old_value = element.get("default", "")
                new_value = self._debconf.get(question)
                # Only set different values
                if old_value != new_value:
                    section, name = question.rsplit(self.question_separator, 1)
                    if not self._config.has_section(section):
                        self._config.add_section(section)
                    self._config.set(section, name, new_value)

        # Write config file
        self._config.write(file)


def main(args):
    """
    Main routine for running this script. The arguments are:

    package_name    Name of the package to configure.
    optional        Optional arguments specific to the given command.
    """
    parser = OptionParser()
    parser.add_option("-o", "--output",
      default="-",
      help="Output file, - for stdout.")
    (options, args) = parser.parse_args(args)

    if len(args) < 1:
        return 1

    install = Install(*args)

    if options.output == "-":
         file = sys.stdout
    else:
         file = open(options.output, "w")
    install.write(file)

    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))