This file is indexed.

/usr/lib/ubiquity/plugins/myth-passwords.py is in mythbuntu-live-autostart 0.69.

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
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (C) 2006, 2007, 2009 Canonical Ltd.
# Written by Colin Watson <cjwatson@ubuntu.com>.
# Copyright (C) 2007-2010 Mario Limonciello
#
# This file is part of Ubiquity.
#
# Ubiquity 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.
#
# Ubiquity 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 Ubiquity.  If not, see <http://www.gnu.org/licenses/>.

import debconf
from ubiquity.plugin import *
from mythbuntu_common.installer import *
from mythbuntu_common.mysql import MySQLHandler
from ubiquity import install_misc
import os

NAME = 'myth-passwords'
AFTER = 'myth-drivers'
WEIGHT = 10

class PageGtk(MythPageGtk):
    plugin_title = 'ubiquity/text/masterinfo_heading_label'

    def __init__(self, controller, *args, **kwargs):
        self.ui_file = 'mythbuntu_stepPasswords'
        MythPageGtk.__init__(self, controller, *args, **kwargs)
        self.mysql=MySQLHandler()

    def set_type(self,type):
        """Prevents the user from going forward initially because of the
           type that was selected"""
        if "Master" not in type:
            self.controller.allow_go_forward(False)

    def do_connection_test(self,widget):
        """Tests to make sure that the backend is accessible"""
        result = self.mysql.do_connection_test(self.get_key())
        if not result:
            result = "Success"
        self.connection_results.set_text(result)
        self.controller.allow_go_forward(True)
        self.connection_results_label.show()

    def set_key(self,value):
        """Preseeds a security key"""
        self.security_entry.set_text(value)

    def get_key(self):
        return self.security_entry.get_text()

class Page(Plugin):
    def prepare(self):
        questions = []

        answer = self.db.get('mythtv/mysql_mythtv_user')
        if answer.isdigit():
            self.ui.set_key(answer)
        questions.append('^mythtv/mysql_mythtv_user')

        if 'UBIQUITY_AUTOMATIC' not in os.environ:
            #if we are a Master type, we'll skip this page
#
#           Fixme: disabled since connection test is busted until 
#		   python3 MythTV library ready
#
#            type = self.db.get('mythbuntu/install_type')
#            if 'Master' in type:
            if True:
                os.environ['UBIQUITY_AUTOMATIC'] = "2"
                #regrab the key in case it was supposed preseeded
                key = self.ui.get_key()
                self.preseed('mythtv/mysql_mythtv_user', key)
            else:
                self.ui.set_type(type)

        return (['/usr/share/ubiquity/ask-mythbuntu','passwords'], questions)

    def ok_handler(self):
        #security key
        key = self.ui.get_key()
        self.preseed('mythtv/mysql_mythtv_user', key)

        Plugin.ok_handler(self)

    def cleanup(self):
        #Clear out our skipping if we did it only because of Master
        if 'UBIQUITY_AUTOMATIC' in os.environ and os.environ['UBIQUITY_AUTOMATIC'] == "2":
            del os.environ['UBIQUITY_AUTOMATIC']

        Plugin.cleanup(self)

class Install(InstallPlugin):
    def install(self, target, progress, *args, **kwargs):
        user = progress.get('passwd/username')
        type = progress.get('mythbuntu/install_type')
        key  = progress.get('mythtv/mysql_mythtv_user')

        #Create a .mythtv directory
        home_mythtv_dir = target + '/home/' + user + '/.mythtv'
        if not os.path.isdir(home_mythtv_dir):
            #in case someone made a symlink or file for the directory
            if os.path.islink(home_mythtv_dir) or os.path.exists(home_mythtv_dir):
                os.remove(home_mythtv_dir)
            os.makedirs(home_mythtv_dir)

        #Remove mysql.txt from home directory if it's there, then make one
        config_xml= home_mythtv_dir + '/config.xml'
        if os.path.islink(config_xml) or os.path.exists(config_xml):
            os.remove(config_xml)
        try:
            os.symlink('/etc/mythtv/config.xml', config_xml)
        except OSError:
            #on a live disk there is a chance this was a broken link
            #depending on what the user did in the livefs
            pass

        #If they set a security key, try to copy it in
        try:
             import pwd
             uid = os.getenv('PKEXEC_UID', False)
             if uid:
                 home_dir = pwd.getpwuid(int(uid)).pw_dir
             else:
                 home_dir = pwd.getpwnam("mythbuntu").pw_dir
        except KeyError:
            home_dir = ''
        if key.isdigit() and os.path.exists(os.path.join(home_dir,'.mythtv','config.xml')):
            import shutil
            shutil.copy(os.path.join(home_dir,'.mythtv','config.xml'),
                        os.path.join(home_mythtv_dir,'config.xml'))

        #mythtv.desktop autostart
        if 'Frontend' in type:
            config_dir = target + '/home/' + user + '/.config'
            autostart_dir =  config_dir + '/autostart'
            autostart_link = autostart_dir + '/mythtv.desktop'
            if not os.path.isdir(config_dir):
                os.makedirs(config_dir)
            if not os.path.isdir(autostart_dir):
                os.makedirs(autostart_dir)
            elif os.path.islink(autostart_link) or os.path.exists(autostart_link):
                os.remove(autostart_link)
            try:
                os.symlink('/usr/share/applications/mythtv.desktop',autostart_link)
            except OSError:
                #on a live disk, this will appear a broken link, but it works
                pass

        #prep user for stuff we did
        install_misc.chrex(target, 'adduser', user, 'mythtv')
        install_misc.chrex(target, 'adduser', user, 'video')
        install_misc.chrex(target, 'chown','1000:1000','-R', os.path.join('/home',user))

        return InstallPlugin.install(self, target, progress, *args, **kwargs)