This file is indexed.

/usr/bin/libertine-launch is in libertine-tools 1.0.0+16.04.20160411-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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# Copyright (C) 2015 Canonical Ltd.
# Author: Christopher Townsend <christopher.townsend@canonical.com>

# 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; version 3 of the License.
#
# 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, see <http://www.gnu.org/licenses/>.

import argparse
import os
import libertine.utils
import psutil
import shlex
import time
from libertine import LibertineContainer


def set_dbus_session_socket_path():
    unique_id = os.environ['DISPLAY'].strip(':')

    if not os.path.exists(libertine.utils.get_libertine_runtime_dir()):
        os.makedirs(libertine.utils.get_libertine_runtime_dir())

    dbus_session_socket_path = (
        os.path.join(libertine.utils.get_libertine_runtime_dir(), 'host_dbus_session' + unique_id))

    os.environ['DBUS_SESSION_BUS_ADDRESS'] = "unix:path=" + dbus_session_socket_path

    return dbus_session_socket_path


def launch_libertine_session_bridge(session_socket_path):
    libertine_session_bridge_cmd = "libertine-session-bridge " + session_socket_path

    args = shlex.split(libertine_session_bridge_cmd)
    return psutil.Popen(args)


def detect_session_bridge_socket(session_socket_path):
    retries = 0

    while not os.path.exists(session_socket_path):
        if retries >= 10:
            raise RuntimeError("Timeout waiting for Libertine Dbus session bridge socket") 
        
        print("Libertine Dbus session bridge socket is not ready.  Waiting...")
        retries += 1
        time.sleep(.5)


if __name__ == '__main__':
    arg_parser = argparse.ArgumentParser(description='launch an application in a Libertine container')
    arg_parser.add_argument('container_id',
                            help='Libertine container ID')
    arg_parser.add_argument('app_exec_line', nargs=argparse.REMAINDER,
                            help='exec line')
    args = arg_parser.parse_args()

    if not libertine.utils.container_exists(args.container_id):
        raise RuntimeError("Container ID %s does not exist." % args.container_id)

    session_socket_path = set_dbus_session_socket_path()

    session_bridge = launch_libertine_session_bridge(session_socket_path)

    detect_session_bridge_socket(session_socket_path)

    container = LibertineContainer(args.container_id) 

    try:
        container.launch_application(args.app_exec_line)
    except:
        raise
    finally:
        session_bridge.terminate()