This file is indexed.

/usr/share/session-migration/scripts/install-default-webapps-in-launcher.py is in unity-webapps-common 2.4.17+14.04.20140416-0ubuntu1.

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
#!/usr/bin/python
from gi.repository import Gio
import os
import sys

PREINSTALLED_LAUNCHER_DESKTOP_FILES = ["application://ubuntu-amazon-default.desktop",]
AFTER_ICON = "unity://running-apps"

UNITY_LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher"
UNITY_LAUNCHER_FAVORITE_KEY = "favorites"

def get_default_favorites():
    settings = Gio.Settings.new(UNITY_LAUNCHER_SETTINGS)
    settings.delay()
    settings.reset(UNITY_LAUNCHER_FAVORITE_KEY)
    return settings.get_strv(UNITY_LAUNCHER_FAVORITE_KEY)

def install_default_webapps_in_launcher():
    # Workaround for the script triggering on systems where it shouldn't.
    if os.path.exists("/usr/share/glib-2.0/schemas/95_edubuntu-artwork.gschema.override"):
        return

    new_desktop_files = PREINSTALLED_LAUNCHER_DESKTOP_FILES

    if len(new_desktop_files) != 0:
        try:
            settings = Gio.Settings.new (UNITY_LAUNCHER_SETTINGS)
            default_favorites = get_default_favorites()
            # "If there are no common elements between these sets..."
            if not set(default_favorites).intersection(set(new_desktop_files)):
                print "Skipping Unity Webapps migration for what seems to be a vendor-patched schema"
                return
            if not settings.is_writable(UNITY_LAUNCHER_FAVORITE_KEY):
                print "Unity Webapps migration process (preinstallation): 'favorites' key not writable"
                return
            favorites = settings.get_strv(UNITY_LAUNCHER_FAVORITE_KEY)

            # only append the desktop icons that are not already present in the favorites list if any
            to_add = [d for d in new_desktop_files if not d in favorites]
            available_desktop_files = [d for d in favorites if ".desktop" in d]
            new_index = -1

            if len(available_desktop_files):
                new_index = favorites.index(available_desktop_files[-1]) + 1
            elif AFTER_ICON in favorites:
                new_index = favorites.index(AFTER_ICON)

            if new_index >= 0:
                new_index = favorites.index(AFTER_ICON)
                next = favorites[new_index:]
                favorites[new_index:] = to_add
                favorites.extend(next)
            else:
                favorites.extend(to_add)

            settings.set_strv(UNITY_LAUNCHER_FAVORITE_KEY, favorites)

            # force sync to avoid race
            settings.sync()
        except Exception, e:
            print "Unity Webapps migration exception:", str(e)

if __name__ == "__main__":
    source = Gio.SettingsSchemaSource.get_default()
    if source.lookup(UNITY_LAUNCHER_SETTINGS, True) is None: # schema not found
        sys.exit(1)
    install_default_webapps_in_launcher()