Skip to content

Commit

Permalink
Merge pull request #4156 from okurz/fix/ttys0_permissions
Browse files Browse the repository at this point in the history
Use common approach for ensuring serialdev permissions
  • Loading branch information
okurz committed Jan 5, 2018
2 parents 487c820 + 5a754ad commit e652aef
Show file tree
Hide file tree
Showing 20 changed files with 431 additions and 419 deletions.
12 changes: 12 additions & 0 deletions lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ our @EXPORT = qw(
$zkvm_img_path
set_framebuffer_resolution
set_extrabootparams_grub_conf
ensure_shim_import
);

our $zkvm_img_path = "/var/lib/libvirt/images";
Expand Down Expand Up @@ -614,6 +615,17 @@ sub set_extrabootparams_grub_conf {
assert_script_run("sed -ie '/${grub_cmdline_label}=/s/\"\$/ $extrabootparams \"/' /etc/default/grub");
}
}

sub ensure_shim_import {
my (%args) = @_;
$args{tags} //= [qw(inst-bootmenu bootloader-shim-import-prompt)];
assert_screen($args{tags}, 30);
if (match_has_tag("bootloader-shim-import-prompt")) {
send_key "down";
send_key "ret";
}
}

1;

# vim: sw=4 et
4 changes: 2 additions & 2 deletions lib/migration.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2017 SUSE Linux GmbH
# Copyright (C) 2017-2018 SUSE LLC
#
# 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
Expand Down Expand Up @@ -41,7 +41,7 @@ sub setup_migration {
script_run "systemctl mask packagekit.service";
script_run "systemctl stop packagekit.service";

type_string "chown $username /dev/$serialdev\n";
ensure_serialdev_permissions;

# enable Y2DEBUG all time
type_string "echo 'export Y2DEBUG=1' >> /etc/bash.bashrc.local\n";
Expand Down
10 changes: 6 additions & 4 deletions lib/susedistribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package susedistribution;
use base 'distribution';
use serial_terminal ();
use strict;
use utils qw(type_string_slow ensure_unlocked_desktop save_svirt_pty get_root_console_tty get_x11_console_tty);
use utils qw(type_string_slow ensure_unlocked_desktop save_svirt_pty get_root_console_tty get_x11_console_tty ensure_serialdev_permissions);
use version_utils qw(is_hyperv_in_gui sle_version_at_least);

# Base class implementation of distribution class necessary for testapi
Expand Down Expand Up @@ -180,11 +180,13 @@ sub ensure_installed {
$args{timeout} //= 90;

testapi::x11_start_program('xterm');
testapi::assert_script_sudo("chown $testapi::username /dev/$testapi::serialdev");
my $retries = 5; # arbitrary
$self->become_root;
ensure_serialdev_permissions;

# make sure packagekit service is available
testapi::assert_script_sudo('systemctl is-active -q packagekit || (systemctl unmask -q packagekit ; systemctl start -q packagekit)');
testapi::assert_script_run('systemctl is-active -q packagekit || (systemctl unmask -q packagekit ; systemctl start -q packagekit)');
type_string "exit\n";
my $retries = 5; # arbitrary
$self->script_run(
"for i in {1..$retries} ; do pkcon install -yp $pkglist && break ; done ; RET=\$?; echo \"\n pkcon finished\n\"; echo \"pkcon-\${RET}-\" > /dev/$testapi::serialdev",
0
Expand Down
Loading

2 comments on commit e652aef

@mimi1vx
Copy link
Member

@mimi1vx mimi1vx commented on e652aef Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okurz
Copy link
Member Author

@okurz okurz commented on e652aef Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handled in #4163

Please sign in to comment.