2011-04-04 20:16:00 +00:00
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2011 Tomasz Sterna <tomek@xiaoka.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; 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.
|
|
|
|
#
|
|
|
|
#
|
2015-11-20 10:15:38 +00:00
|
|
|
import grp
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import string
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import threading
|
|
|
|
import time
|
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
import gtk
|
2011-07-20 14:55:43 +00:00
|
|
|
import libuser
|
2011-04-04 20:16:00 +00:00
|
|
|
|
|
|
|
from firstboot.config import *
|
|
|
|
from firstboot.constants import *
|
|
|
|
from firstboot.functions import *
|
|
|
|
from firstboot.module import *
|
|
|
|
|
|
|
|
import gettext
|
2016-02-05 01:40:02 +00:00
|
|
|
import pyudev
|
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
_ = lambda x: gettext.ldgettext("firstboot", x)
|
|
|
|
N_ = lambda x: x
|
|
|
|
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def is_package_installed(pkgname):
|
|
|
|
return not subprocess.call(['rpm', '-q', pkgname],
|
|
|
|
stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
|
|
|
|
|
2016-02-05 01:40:02 +00:00
|
|
|
def usb_keyboard_present():
|
|
|
|
context = pyudev.Context()
|
|
|
|
keyboards = context.list_devices(subsystem='input', ID_INPUT_KEYBOARD='1')
|
|
|
|
return any([d.get('ID_USB_INTERFACES', False) for d in keyboards])
|
|
|
|
|
|
|
|
def started_from_usb():
|
|
|
|
def get_all_used_devices(dev):
|
|
|
|
stat = os.stat(dev)
|
|
|
|
if stat.st_rdev:
|
|
|
|
# XXX any better idea how to handle device-mapper?
|
|
|
|
sysfs_slaves = '/sys/dev/block/{}:{}/slaves'.format(
|
|
|
|
os.major(stat.st_rdev), os.minor(stat.st_rdev))
|
|
|
|
if os.path.exists(sysfs_slaves):
|
|
|
|
for slave_dev in os.listdir(sysfs_slaves):
|
|
|
|
for d in get_all_used_devices('/dev/{}'.format(slave_dev)):
|
|
|
|
yield d
|
|
|
|
else:
|
|
|
|
yield dev
|
|
|
|
|
|
|
|
context = pyudev.Context()
|
|
|
|
mounts = open('/proc/mounts').readlines()
|
|
|
|
for mount in mounts:
|
|
|
|
device = mount.split(' ')[0]
|
|
|
|
if not os.path.exists(device):
|
|
|
|
continue
|
|
|
|
for dev in get_all_used_devices(device):
|
|
|
|
udev_info = pyudev.Device.from_device_file(context, dev)
|
|
|
|
if udev_info.get('ID_USB_INTERFACES', False):
|
|
|
|
return True
|
|
|
|
|
|
|
|
return False
|
2015-11-20 10:15:38 +00:00
|
|
|
|
|
|
|
class QubesChoice(object):
|
|
|
|
instances = []
|
2016-02-08 01:15:39 +00:00
|
|
|
def __init__(self, label, states, depend=None, extra_check=None,
|
2016-02-08 01:17:33 +00:00
|
|
|
replace=None, indent=False):
|
2015-11-20 10:15:38 +00:00
|
|
|
self.widget = gtk.CheckButton(label)
|
|
|
|
self.states = states
|
|
|
|
self.depend = depend
|
|
|
|
self.extra_check = extra_check
|
|
|
|
self.selected = None
|
2016-02-08 01:15:39 +00:00
|
|
|
self.replace = replace
|
2016-02-08 01:17:33 +00:00
|
|
|
if indent:
|
|
|
|
self.outer_widget = gtk.Alignment()
|
|
|
|
self.outer_widget.add(self.widget)
|
|
|
|
self.outer_widget.set_padding(0, 0, 20, 0)
|
|
|
|
else:
|
|
|
|
self.outer_widget = self.widget
|
2015-11-20 10:15:38 +00:00
|
|
|
|
|
|
|
if self.depend is not None:
|
|
|
|
self.depend.widget.connect('toggled', self.friend_on_toggled)
|
2016-02-08 01:18:13 +00:00
|
|
|
self.friend_on_toggled(self.depend.widget)
|
2015-11-20 10:15:38 +00:00
|
|
|
|
|
|
|
self.instances.append(self)
|
|
|
|
|
|
|
|
|
|
|
|
def friend_on_toggled(self, other_widget):
|
|
|
|
self.set_sensitive(other_widget.get_active())
|
|
|
|
|
|
|
|
|
|
|
|
def get_selected(self):
|
|
|
|
return self.selected if self.selected is not None \
|
|
|
|
else self.widget.get_sensitive() and self.widget.get_active()
|
|
|
|
|
|
|
|
|
|
|
|
def store_selected(self):
|
|
|
|
self.selected = self.get_selected()
|
|
|
|
|
|
|
|
|
|
|
|
def set_sensitive(self, sensitive):
|
2016-02-05 01:40:02 +00:00
|
|
|
self.widget.set_sensitive(sensitive)
|
2015-11-20 10:15:38 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def on_check_advanced_toggled(cls, widget):
|
|
|
|
selected = widget.get_active()
|
|
|
|
|
|
|
|
# this works, because you cannot instantiate the choices in wrong order
|
|
|
|
# (cls.instances is a list and have deterministic ordering)
|
|
|
|
for choice in cls.instances:
|
|
|
|
choice.set_sensitive(not selected and
|
|
|
|
(choice.depend is None or choice.depend.get_selected()))
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get_states(cls):
|
2016-02-08 01:15:39 +00:00
|
|
|
replaced = reduce(
|
|
|
|
lambda x, y: x+y if y else x,
|
|
|
|
(choice.replace for choice in cls.instances if
|
|
|
|
choice.get_selected()),
|
|
|
|
()
|
|
|
|
)
|
2015-11-20 10:15:38 +00:00
|
|
|
for choice in cls.instances:
|
|
|
|
if choice.get_selected():
|
|
|
|
for state in choice.states:
|
2016-02-08 01:15:39 +00:00
|
|
|
if state not in replaced:
|
|
|
|
yield state
|
2015-11-20 10:15:38 +00:00
|
|
|
|
|
|
|
|
2016-02-05 01:40:02 +00:00
|
|
|
class DisabledChoice(QubesChoice):
|
|
|
|
def __init__(self, label):
|
|
|
|
super(DisabledChoice, self).__init__(label, ())
|
|
|
|
self.widget.set_sensitive(False)
|
|
|
|
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
class moduleClass(Module):
|
2011-04-04 20:16:00 +00:00
|
|
|
def __init__(self):
|
|
|
|
Module.__init__(self)
|
|
|
|
self.priority = 10000
|
2015-11-20 10:15:38 +00:00
|
|
|
self.sidebarTitle = N_("Create VMs")
|
|
|
|
self.title = N_("Create VMs")
|
2011-04-04 20:16:00 +00:00
|
|
|
self.icon = "qubes.png"
|
2011-07-20 14:55:43 +00:00
|
|
|
self.admin = libuser.admin()
|
2015-11-28 15:03:57 +00:00
|
|
|
self.default_template = 'fedora-23'
|
2015-11-20 10:15:38 +00:00
|
|
|
self.choices = []
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2014-04-08 03:27:18 +00:00
|
|
|
def _showErrorMessage(self, text):
|
|
|
|
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
|
|
|
|
dlg.set_position(gtk.WIN_POS_CENTER)
|
|
|
|
dlg.set_modal(True)
|
|
|
|
rc = dlg.run()
|
|
|
|
dlg.destroy()
|
|
|
|
return None
|
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
def apply(self, interface, testing=False):
|
|
|
|
try:
|
2011-07-20 14:55:43 +00:00
|
|
|
|
|
|
|
qubes_users = self.admin.enumerateUsersByGroup('qubes')
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
if len(qubes_users) < 1:
|
|
|
|
self._showErrorMessage(_("You must create a user account to create default VMs."))
|
|
|
|
return RESULT_FAILURE
|
|
|
|
else:
|
|
|
|
self.qubes_user = qubes_users[0]
|
|
|
|
|
|
|
|
for choice in QubesChoice.instances:
|
|
|
|
choice.store_selected()
|
|
|
|
choice.widget.set_sensitive(False)
|
|
|
|
self.check_advanced.set_sensitive(False)
|
|
|
|
interface.nextButton.set_sensitive(False)
|
2016-02-05 01:46:37 +00:00
|
|
|
interface.backButton.set_sensitive(False)
|
2011-04-06 10:43:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
if self.progress is None:
|
|
|
|
self.progress = gtk.ProgressBar()
|
|
|
|
self.progress.set_pulse_step(0.06)
|
|
|
|
self.vbox.pack_start(self.progress, True, False)
|
|
|
|
self.progress.show()
|
|
|
|
|
|
|
|
if testing:
|
|
|
|
return RESULT_SUCCESS
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
if self.check_advanced.get_active():
|
2011-04-06 10:43:38 +00:00
|
|
|
return RESULT_SUCCESS
|
|
|
|
|
2015-04-14 21:40:49 +00:00
|
|
|
errors = []
|
|
|
|
|
2015-11-23 01:34:53 +00:00
|
|
|
# Finish template(s) installation, because it wasn't fully possible
|
|
|
|
# from anaconda (it isn't possible to start a VM there).
|
|
|
|
# This is specific to firstboot, not general configuration.
|
|
|
|
for template in os.listdir('/var/lib/qubes/vm-templates'):
|
|
|
|
try:
|
|
|
|
self.configure_template(template)
|
|
|
|
except Exception as e:
|
|
|
|
errors.append((self.stage, str(e)))
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
self.configure_default_template()
|
|
|
|
self.configure_qubes()
|
|
|
|
self.configure_network()
|
2016-02-11 15:47:09 +00:00
|
|
|
if self.choice_usb.get_selected() \
|
|
|
|
and not self.choice_usb_with_net.get_selected():
|
2015-11-29 03:16:09 +00:00
|
|
|
# Workaround for #1464 (so qvm.start from salt can't be used)
|
|
|
|
self.run_command_in_thread(['systemctl', 'start',
|
|
|
|
'qubes-vm@sys-usb.service'])
|
2015-04-15 10:11:16 +00:00
|
|
|
|
2015-04-14 21:40:49 +00:00
|
|
|
try:
|
2015-11-20 10:15:38 +00:00
|
|
|
self.configure_default_dvm()
|
2015-04-14 21:40:49 +00:00
|
|
|
except Exception as e:
|
|
|
|
errors.append((self.stage, str(e)))
|
2015-04-15 10:11:16 +00:00
|
|
|
|
2015-04-14 21:40:49 +00:00
|
|
|
if errors:
|
|
|
|
msg = ""
|
|
|
|
for (stage, error) in errors:
|
|
|
|
msg += "{} failed:\n{}\n\n".format(stage, error)
|
|
|
|
self.stage = "firstboot"
|
|
|
|
raise Exception(msg)
|
2011-04-06 10:43:38 +00:00
|
|
|
|
2014-03-21 01:49:59 +00:00
|
|
|
interface.nextButton.set_sensitive(True)
|
2011-04-04 20:16:00 +00:00
|
|
|
return RESULT_SUCCESS
|
|
|
|
except Exception as e:
|
|
|
|
md = gtk.MessageDialog(interface.win, gtk.DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
|
|
|
|
self.stage + " failure!\n\n" + str(e))
|
|
|
|
md.run()
|
|
|
|
md.destroy()
|
|
|
|
self.show_stage("Failure...")
|
|
|
|
self.progress.hide()
|
2011-04-06 11:15:20 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
self.check_advanced.set_active(True)
|
2014-03-21 01:49:59 +00:00
|
|
|
interface.nextButton.set_sensitive(True)
|
2011-04-06 11:15:20 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
return RESULT_FAILURE
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
def show_stage(self, stage):
|
|
|
|
self.stage = stage
|
|
|
|
self.progress.set_text(stage)
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def run_command(self, command, stdin=None):
|
|
|
|
try:
|
|
|
|
os.setgid(self.qubes_gid)
|
|
|
|
os.umask(0007)
|
|
|
|
cmd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=stdin)
|
|
|
|
out = cmd.communicate()[0]
|
|
|
|
if cmd.returncode == 0:
|
|
|
|
self.process_error = None
|
|
|
|
else:
|
|
|
|
self.process_error = "{} failed:\n{}".format(command, out)
|
|
|
|
except Exception as e:
|
|
|
|
self.process_error = str(e)
|
2015-11-28 15:04:24 +00:00
|
|
|
if self.process_error:
|
|
|
|
# not only inform main thread, but also interrupt task thread
|
|
|
|
raise Exception(self.process_error)
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-04-15 10:11:16 +00:00
|
|
|
def run_in_thread(self, method, args = None):
|
|
|
|
thread = threading.Thread(target=method, args = (args if args else ()))
|
2011-04-04 20:16:00 +00:00
|
|
|
thread.start()
|
|
|
|
while thread.is_alive():
|
|
|
|
self.progress.pulse()
|
|
|
|
while gtk.events_pending():
|
|
|
|
gtk.main_iteration(False)
|
|
|
|
time.sleep(0.1)
|
|
|
|
if self.process_error is not None:
|
|
|
|
raise Exception(self.process_error)
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def run_command_in_thread(self, *args):
|
|
|
|
self.run_in_thread(self.run_command, args)
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-11-23 01:34:53 +00:00
|
|
|
def configure_template(self, name):
|
|
|
|
self.show_stage(_("Configuring TemplateVM {}".format(name)))
|
|
|
|
self.run_in_thread(self.do_configure_template, args=(name,))
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def configure_qubes(self):
|
|
|
|
self.show_stage('Executing qubes configuration')
|
2015-11-29 03:17:59 +00:00
|
|
|
try:
|
|
|
|
# get rid of initial entries (from package installation time)
|
|
|
|
os.rename('/var/log/salt/minion', '/var/log/salt/minion.install')
|
|
|
|
except OSError:
|
|
|
|
pass
|
2015-11-23 01:27:18 +00:00
|
|
|
# Refresh minion configuration to make sure all installed formulas are included
|
|
|
|
self.run_command_in_thread(['qubesctl', 'state.sls', 'config',
|
|
|
|
'-l', 'quiet', '--out', 'quiet'])
|
2015-11-20 10:15:38 +00:00
|
|
|
for state in QubesChoice.get_states():
|
|
|
|
self.run_command_in_thread(['qubesctl', 'top.enable', state,
|
|
|
|
'saltenv=dom0', '-l', 'quiet', '--out', 'quiet'])
|
2015-11-29 03:17:59 +00:00
|
|
|
try:
|
|
|
|
self.run_command_in_thread(['qubesctl', 'state.highstate'])
|
|
|
|
except Exception as e:
|
|
|
|
raise Exception(
|
|
|
|
"Qubes initial configuration failed. Login to the system and "
|
|
|
|
"check /var/log/salt/minion for details. "
|
|
|
|
"You can retry configuration by calling "
|
|
|
|
"'sudo qubesctl state.highstate' in dom0 (you will get "
|
|
|
|
"detailed state there).")
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def configure_default_template(self):
|
|
|
|
self.show_stage('Setting default template')
|
|
|
|
self.run_command_in_thread(['/usr/bin/qubes-prefs', '--set',
|
|
|
|
'default-template', self.default_template])
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def configure_network(self):
|
|
|
|
self.show_stage('Setting up networking')
|
2015-11-27 22:02:38 +00:00
|
|
|
self.run_in_thread(
|
|
|
|
self.do_configure_network,
|
2015-11-28 21:28:26 +00:00
|
|
|
args=('sys-whonix' if self.choice_whonix_default.get_selected() else
|
|
|
|
'sys-firewall',))
|
2011-04-05 17:14:35 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def configure_default_dvm(self):
|
|
|
|
self.show_stage(_("Creating default DisposableVM"))
|
|
|
|
self.run_in_thread(self.do_configure_default_dvm)
|
2011-04-06 10:43:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
def do_configure_default_dvm(self):
|
|
|
|
try:
|
|
|
|
self.run_command(['su', '-c', '/usr/bin/qvm-create-default-dvm --default-template --default-script', self.qubes_user])
|
|
|
|
except:
|
|
|
|
# Kill DispVM template if still running
|
|
|
|
# Do not use self.run_command to not clobber process output
|
|
|
|
subprocess.call(['qvm-kill', '{}-dvm'.format(self.default_template)])
|
|
|
|
raise
|
2015-03-19 10:09:16 +00:00
|
|
|
|
2015-11-27 22:02:38 +00:00
|
|
|
def do_configure_network(self, default_netvm):
|
2015-11-20 10:15:38 +00:00
|
|
|
self.run_command(['/usr/bin/qvm-prefs', '--force-root', '--set', 'sys-firewall', 'netvm', 'sys-net'])
|
2015-11-27 22:02:38 +00:00
|
|
|
self.run_command(['/usr/bin/qubes-prefs', '--set', 'default-netvm',
|
|
|
|
default_netvm])
|
|
|
|
self.run_command(['/usr/bin/qubes-prefs', '--set', 'updatevm',
|
|
|
|
default_netvm])
|
2016-02-11 11:30:08 +00:00
|
|
|
self.run_command(['/usr/bin/qubes-prefs', '--set', 'clockvm',
|
|
|
|
'sys-net'])
|
2015-04-14 21:40:49 +00:00
|
|
|
self.run_command(['/usr/sbin/service', 'qubes-netvm', 'start'])
|
2011-04-05 17:14:35 +00:00
|
|
|
|
2015-11-23 01:34:53 +00:00
|
|
|
def do_configure_template(self, template):
|
|
|
|
self.run_command(['qvm-start', '--no-guid', template])
|
|
|
|
self.run_command(['su', '-c',
|
|
|
|
'qvm-sync-appmenus {}'.format(template),
|
|
|
|
'-', self.qubes_user])
|
|
|
|
self.run_command(['qvm-shutdown', '--wait', template])
|
2011-04-06 10:43:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
def createScreen(self):
|
|
|
|
self.vbox = gtk.VBox(spacing=5)
|
|
|
|
|
2011-04-06 17:06:00 +00:00
|
|
|
label = gtk.Label(_("Almost there! We just need to create a few system service VM.\n\n"
|
2011-07-02 12:56:56 +00:00
|
|
|
"We can also create a few AppVMs that might be useful for most users, "
|
|
|
|
"or you might prefer to do it yourself later.\n\n"
|
2011-04-06 10:43:38 +00:00
|
|
|
"Choose an option below and click 'Finish'..."))
|
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
label.set_line_wrap(True)
|
|
|
|
label.set_alignment(0.0, 0.5)
|
|
|
|
label.set_size_request(500, -1)
|
|
|
|
self.vbox.pack_start(label, False, True, padding=20)
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
self.choice_network = QubesChoice(
|
|
|
|
_('Create default system qubes (sys-net, sys-firewall)'),
|
|
|
|
('qvm.sys-net', 'qvm.sys-firewall'))
|
|
|
|
|
|
|
|
self.choice_default = QubesChoice(
|
|
|
|
_('Create default application qubes '
|
|
|
|
'(personal, work, untrusted, vault)'),
|
|
|
|
('qvm.personal', 'qvm.work', 'qvm.untrusted', 'qvm.vault'),
|
|
|
|
depend=self.choice_network)
|
|
|
|
|
2016-02-05 01:40:02 +00:00
|
|
|
if is_package_installed('qubes-template-whonix-gw') and \
|
|
|
|
is_package_installed('qubes-template-whonix-ws'):
|
|
|
|
self.choice_whonix = QubesChoice(
|
|
|
|
_('Create Whonix Gateway and Workstation qubes '
|
|
|
|
'(sys-whonix, anon-whonix)'),
|
|
|
|
('qvm.sys-whonix', 'qvm.anon-whonix'),
|
|
|
|
depend=self.choice_network)
|
|
|
|
else:
|
|
|
|
self.choice_whonix = DisabledChoice(_("Whonix not installed"))
|
2015-11-20 10:15:38 +00:00
|
|
|
|
2015-11-27 22:02:38 +00:00
|
|
|
self.choice_whonix_default = QubesChoice(
|
2015-11-28 15:09:48 +00:00
|
|
|
_('Route applications traffic and updates through Tor anonymity '
|
|
|
|
'network [experimental]'),
|
2015-11-27 22:02:38 +00:00
|
|
|
(),
|
2016-02-08 01:17:33 +00:00
|
|
|
depend=self.choice_whonix,
|
|
|
|
indent=True)
|
2015-11-27 22:02:38 +00:00
|
|
|
|
2016-02-05 01:40:02 +00:00
|
|
|
if not usb_keyboard_present() and not started_from_usb():
|
|
|
|
self.choice_usb = QubesChoice(
|
|
|
|
_('Create USB qube holding all USB controllers (sys-usb) '
|
|
|
|
'[experimental]'),
|
|
|
|
('qvm.sys-usb',))
|
|
|
|
else:
|
|
|
|
self.choice_usb = DisabledChoice(
|
|
|
|
_('USB qube configuration disabled - you are using USB '
|
|
|
|
'keyboard or USB disk'))
|
2015-11-27 22:03:06 +00:00
|
|
|
|
2016-02-08 01:15:39 +00:00
|
|
|
self.choice_usb_with_net = QubesChoice(
|
|
|
|
_("Use sys-net qube for both networking and USB devices"),
|
|
|
|
('qvm.sys-net-with-usb',),
|
|
|
|
depend=self.choice_usb,
|
|
|
|
replace=('qvm.sys-usb',),
|
2016-02-08 01:17:33 +00:00
|
|
|
indent=True
|
2016-02-08 01:15:39 +00:00
|
|
|
)
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
self.check_advanced = gtk.CheckButton(
|
|
|
|
_('Do not configure anything (for advanced users)'))
|
|
|
|
self.check_advanced.connect('toggled',
|
|
|
|
QubesChoice.on_check_advanced_toggled)
|
|
|
|
|
|
|
|
for choice in QubesChoice.instances:
|
2016-02-08 01:17:33 +00:00
|
|
|
self.vbox.pack_start(choice.outer_widget, False, True)
|
2015-11-20 10:15:38 +00:00
|
|
|
#self.vbox.pack_start(gtk.HSeparator())
|
|
|
|
self.vbox.pack_end(self.check_advanced, False, True)
|
2011-04-06 10:43:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
self.progress = None
|
|
|
|
|
2015-11-20 10:15:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
def initializeUI(self):
|
2015-11-20 10:15:38 +00:00
|
|
|
self.check_advanced.set_active(False)
|
|
|
|
|
|
|
|
self.choice_network.widget.set_active(True)
|
|
|
|
self.choice_default.widget.set_active(True)
|
2015-11-23 18:10:45 +00:00
|
|
|
if self.choice_whonix.widget.get_sensitive():
|
|
|
|
self.choice_whonix.widget.set_active(True)
|
2015-11-20 10:15:38 +00:00
|
|
|
|
2011-04-04 20:16:00 +00:00
|
|
|
self.qubes_gid = grp.getgrnam('qubes').gr_gid
|
|
|
|
self.stage = "Initialization"
|
|
|
|
self.process_error = None
|