This file is indexed.

/usr/bin/update-boinc-applinks is in boinc-client 7.2.42+dfsg-1.

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
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# This script creates symlinks for anonymous BOINC applications.
# Copyright © 2006 Debian BOINC Maintainers
#                  <pkg-boinc-devel@lists.alioth.debian.org>
#
# This file is licensed under the terms of the GNU General Public License,
# Version 2 or any later version published by the Free Software Foundation.

import ConfigParser
import optparse
import os
import sys

APPS_INFO_DIR = '/usr/share/boinc-apps/info/'

def main():
    opts = parse_options()

    if not os.path.isdir(APPS_INFO_DIR):
        sys.exit(0)

    projects = parse_app_info_files()

    # Show list of all available projects.
    if opts.list_projects == True:
        for project in projects:
            print project

    # Manage symbolic links and directories.
    if opts.create == None:
        return
    for project in projects:
        if opts.project == '' or project == opts.project:
            for url in projects[project]['urls']:
                project_dir = opts.data_dir + '/projects/' + url + '/'
                manage_symlink(projects[project]['app_info'],
                    project_dir + 'app_info.xml', opts.create)

                for app_src in projects[project]['apps']:
                    app_dst = project_dir + os.path.basename(app_src)
                    manage_symlink(app_src, app_dst, opts.create)
    return

def get_list(res):
    """ convert a space separated option value to a list """
    res = res.replace('\n', ' ')
    if ' ' in res:
        res = res.split(' ')
    else:
        res = [res]
    while '' in res:
        res.remove('')
    return res

def parse_app_info_files():
    projects = {}

    for file in os.listdir(APPS_INFO_DIR):
        if file.endswith('.cfg'):
            cfg = ConfigParser.ConfigParser()
            cfg.readfp(open(APPS_INFO_DIR + file))

            project = cfg.get('DEFAULT', 'project')
            cfg.remove_option('DEFAULT', 'project')

            projects[project] = {}
            list_options = ['apps', 'urls']
            for item in cfg.items('DEFAULT'):
                if item[0] in list_options:
                    projects[project][item[0]] = get_list(item[1])
                else:
                    projects[project][item[0]] = item[1]
    return projects

def manage_symlink(src, dst, bool):
    dirname = os.path.dirname(dst)

    try:
        if bool == True:
            if not os.path.isdir(dirname):
                os.makedirs(dirname)
            os.symlink(src, dst)
        else:
            if os.path.isfile(dst) and not os.path.islink(dst):
                return
            elif os.path.islink(dst):
                os.remove(dst)
            os.removedirs(dirname)
    except OSError:
        pass
    return

def parse_options():
    parser = optparse.OptionParser()

    parser.add_option('--create', action='store_true', dest='create',
        help='create symlinks and project directories')

    parser.add_option('--remove', action='store_false', dest='create',
        help='remove symlinks and empty project directories')

    parser.add_option('--data-dir', dest='data_dir', default='.',
        metavar='DIR', help='destination directory for the symlinks')

    parser.add_option('--project', dest='project', default='',
        metavar='PROJECT', help='create only symlinks for project PROJECT')

    parser.add_option('--list-projects', action='store_true',
        dest='list_projects', default=False,
        help='list all available projects')

    (opts, args) = parser.parse_args()
    return opts

if __name__ == '__main__':
    main()