diff --git a/pressure-vessel-test-ui b/pressure-vessel-test-ui index f57c7309f32572250ed955a6ed321a971c8abf5f..3f5a18b3790cf30a6bf322d76bfcc388c6ddc202 100755 --- a/pressure-vessel-test-ui +++ b/pressure-vessel-test-ui @@ -166,6 +166,41 @@ class Gui: row += 1 + var_path = os.getenv('PRESSURE_VESSEL_COPY_RUNTIME_INTO', None) + + if var_path is None: + value = False + var_path = os.getenv( + 'PRESSURE_VESSEL_RUNTIME_BASE', + os.path.dirname(__file__) + '/../..', + ) + '/var' + assert var_path is not None + else: + value = True + + self.var_path = os.path.realpath(var_path) + self.copy_runtime_into_check = Gtk.CheckButton.new_with_label( + 'Create temporary runtime copy on disk' + ) + self.copy_runtime_into_check.set_active(value) + self.grid.attach(self.copy_runtime_into_check, 1, row, 1, 1) + row += 1 + + label = Gtk.Label.new('') + label.set_markup( + '<small><i>' + 'The copy will be in {} and can be modified while the ' + 'container is running. It will be deleted next time you ' + 'run a game in this mode.' + '</i></small>'.format( + GLib.markup_escape_text(self.var_path), + ) + ) + label.set_halign(Gtk.Align.START) + label.set_line_wrap(True) + self.grid.attach(label, 1, row, 1, 1) + row += 1 + self.host_graphics_check = Gtk.CheckButton.new_with_label( 'Use host-system graphics stack' ) @@ -349,8 +384,10 @@ class Gui: def _container_runtime_changed(self, combo): if combo.get_active_id() == '/': + self.copy_runtime_into_check.set_sensitive(False) self.host_graphics_check.set_sensitive(False) else: + self.copy_runtime_into_check.set_sensitive(True) self.host_graphics_check.set_sensitive(True) def _describe_runtime( @@ -460,6 +497,12 @@ class Gui: else: argv.append('--without-host-graphics') + if self.copy_runtime_into_check.get_active(): + os.makedirs(self.var_path, mode=0o755, exist_ok=True) + argv.append('--copy-runtime-into=' + self.var_path) + else: + argv.append('--copy-runtime-into=') + if self.unshare_home_check.get_active(): argv.append('--unshare-home') else: