This file is indexed.

/usr/share/backintime/common/create-manpage-backintime-config.py is in backintime-common 1.1.12-1.

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

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
#    Back In Time
#    Copyright (C) 2012-2016 Germar Reitze
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import re
import os
import sys
from time import strftime, gmtime

PATH = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))

CONFIG = os.path.join(PATH, 'config.py')
MAN    = os.path.join(PATH, 'man/C/backintime-config.1')
with open(os.path.join(PATH, '../VERSION'), 'r') as f:
    VERSION = f.read().strip('\n')
SORT = True #True = sort by alphabet; False = sort by line numbering

c_list = re.compile(r'.*?self\.get((?:_profile)?)_(list)_value ?\( ?[\'"](.*?)[\'"], ?((?:\(.*\)|[^,]*)), ?[\'"]?([^\'",\)]*)[\'"]?')
c =      re.compile(r'.*?self\.get((?:_profile)?)_(.*?)_value ?\( ?[\'"](.*?)[\'"] ?(%?[^,]*?), ?[\'"]?([^\'",\)]*)[\'"]?')
c_default = re.compile(r'(^DEFAULT[\w]*)[\s]*= (.*)')

HEADER = '''.TH backintime-config 1 "%s" "version %s" "USER COMMANDS"
.SH NAME
config \- BackInTime configuration files.
.SH SYNOPSIS
~/.config/backintime/config
.br
/etc/backintime/config
.SH DESCRIPTION
Back In Time was developed as pure GUI program and so most functions are only
useable with backintime-qt4. But it is possible to use
Back In Time e.g. on a headless server. You have to create the configuration file
(~/.config/backintime/config) manually. Look inside /usr/share/doc/backintime\-common/examples/ for examples.
.PP
The configuration file has the following format:
.br
keyword=arguments
.PP
Arguments don't need to be quoted. All characters are allowed except '='.
.PP
Run 'backintime check-config' to verify the configfile, create the snapshot folder and crontab entries.
.SH POSSIBLE KEYWORDS
''' % (strftime('%b %Y', gmtime()), VERSION)

FOOTER = '''.SH SEE ALSO
backintime, backintime-qt4.
.PP
Back In Time also has a website: https://github.com/bit-team/backintime
.SH AUTHOR
This manual page was written by BIT Team(<bit\-team@lists.launchpad.net>).
'''

INSTANCE  = 'instance'
NAME      = 'name'
VALUES    = 'values'
DEFAULT   = 'default'
COMMENT   = 'comment'
REFERENCE = 'reference'
LINE      = 'line'

def output(instance = '', name = '', values = '', default = '', comment = '', reference = '', line = 0):
    if not default:
        default = "''"
    ret  = '.IP "\\fI%s\\fR" 6\n' % name
    ret += '.RS\n'
    ret += 'Type: %-10sAllowed Values: %s\n' %(instance, values)
    ret += '.br\n'
    ret += '%s\n' % comment
    ret += '.PP\n'
    if SORT:
        ret += 'Default: %s\n' % default
    else:
        ret += 'Default: %-18s %s line: %d\n' % (default, reference, line)
    ret += '.RE\n'
    return ret

def select(a, b):
    if a:
        return a
    return b

def select_values(instance, values):
    if values:
        return values
    if instance == 'bool':
        return 'true|false'
    if instance == 'str':
        return 'text'
    if instance == 'int':
        return '0-99999'

def process_line(d, key, profile, instance, name, var, default, commentline, values, force_var, force_default, replace_default, counter):
    #Ignore commentlines with #?! and 'config.version'
    comment = None
    if not commentline.startswith('!') and not name == 'config.version' and not key in d:
        d[key] = {}
        commentline = commentline.split(';')
        try:
            comment       = commentline[0]
            values        = commentline[1]
            force_default = commentline[2]
            force_var     = commentline[3]
        except IndexError:
            pass

        if default.startswith('self.') and default[5:] in replace_default:
            default = replace_default[default[5:]]

        if isinstance(force_default, str) and force_default.startswith('self.') and force_default[5:] in replace_default:
            force_default = replace_default[force_default[5:]]

        if instance == 'bool':
            default = default.lower()
        d[key][INSTANCE]  = instance
        d[key][NAME]      = re.sub(r'%[\S]', '<%s>' % select(force_var, var).upper(), name)
        d[key][VALUES]    = select_values(instance, values)
        d[key][DEFAULT]   = select(force_default, default)
        d[key][COMMENT]   = re.sub(r'\\n', '\n.br\n', comment)
        d[key][REFERENCE] = 'config.py'
        d[key][LINE]      = counter

def main():
    replace_default = {}
    d = {}
    d['profiles.version'] = {INSTANCE  : 'int',
                             NAME      : 'profiles.version',
                             VALUES    : '1',
                             DEFAULT   : '1',
                             COMMENT   : 'Internal version of profiles config.',
                             REFERENCE : 'configfile.py',
                             LINE      : 180}
    d['profiles'] = {INSTANCE  : 'str',
                     NAME      : 'profiles',
                     VALUES    : 'int separated by colon (e.g. 1:3:4)',
                     DEFAULT   : '1',
                     COMMENT   : 'All active Profiles (<N> in profile<N>.snapshots...).',
                     REFERENCE : 'configfile.py',
                     LINE      : 273}
    d['profile<N>.name'] = {INSTANCE  : 'str',
                            NAME      : 'profile<N>.name',
                            VALUES    : 'text',
                            DEFAULT   : 'Main profile',
                            COMMENT   : 'Name of this profile.',
                            REFERENCE : 'configfile.py',
                            LINE      : 246}
    with open(CONFIG, 'r') as f:
        commentline = ''
        values = force_var = force_default = instance = name = var = default = None
        for counter, line in enumerate(f, 1):
            line = line.lstrip()
            m_default = c_default.match(line)
            if m_default:
                replace_default[m_default.group(1)] = m_default.group(2).replace('\\$', '\\\$')
                continue
            if line.startswith('#?'):
                if commentline and not ';' in commentline and not commentline.endswith('\\n'):
                    commentline += ' '
                commentline += line.lstrip('#?').rstrip('\n')
                continue
            if line.startswith('#'):
                commentline = ''
                continue
            # m = c_list_tuple.match(line)
            # if not m:
            m = c_list.match(line)
            if not m:
                m = c.match(line)
            if m:
                profile, instance, name, var, default = m.groups()
                if profile == '_profile':
                    name = 'profile<N>.' + name
                var = var.lstrip('% ')
                if instance == 'list':
                    type_key = [x.strip('"\'') for x in re.findall(r'["\'].*?["\']', var)]
                    commentline_split = commentline.split('::')
                    for i, tk in enumerate(type_key):
                        t, k = tk.split(':', maxsplit = 1)
                        process_line(d, key, profile, 'int', '%s.size' %name, var, '\-1', 'Quantity of %s.<I> entries.' %name, values, force_var, force_default, replace_default, counter)
                        key = '%s.%s' %(name, k)
                        key = key.lower()
                        process_line(d, key, profile, t, '%s.<I>.%s' %(name, k), var, '', commentline_split[i], values, force_var, force_default, replace_default, counter)
                else:
                    key = re.sub(r'%[\S]', var, name).lower()
                process_line(d, key, profile, instance, name, var, default, commentline, values, force_var, force_default, replace_default, counter)

                values = force_var = force_default = instance = name = var = default = None
                commentline = ''

    with open(MAN, 'w') as f:
        f.write(HEADER)
        if SORT:
            s = lambda x: x
        else:
            s = lambda x: d[x][LINE]
        f.write('\n'.join(output(**d[key]) for key in sorted(d, key = s)))
        f.write(FOOTER)

if __name__ == "__main__":
    main()