Browse Source

This allows tests to work properly from the Yard Box for non-root users,

chrooted tests disappear, it is assumed that most normal administrators
would never consider giving non-root users chroot capabilities, but you
never know, so only genext2fs is tested for, but room is left if another
fs is choosen.
master
freesource 23 years ago
parent
commit
5af731e25c
  1. 12
      BootRoot/Yard.pm
  2. 22
      BootRoot/YardBox.pm

12
BootRoot/Yard.pm

@ -1956,6 +1956,8 @@ sub which_tests {
my ($chosen_tests) = @_;
my ($action, $label);
# Need to know whether genext2fs is being used
my $fs_type = (split(/\s/,$main::makefs))[0];
# This is a little crude. Technically we should read /etc/conf.getty
# to make sure we're not supposed to be using a different login binary.
@ -1980,13 +1982,16 @@ sub which_tests {
my $t_inittab = $chosen_tests->{31}{test_inittab};
my $t_scripts = $chosen_tests->{32}{test_scripts};
if ( $fs_type ne "genext2fs" ) {
return "ERROR" if errm(mount_device($device,$mount_point)) == 2;
sys("/usr/lib/bootroot/yard_chrooted_tests $mount_point $t_fstab $t_inittab $t_scripts",
"TESTING");
sys("/usr/lib/bootroot/yard_chrooted_tests $mount_point $t_fstab $t_inittab $t_scripts", "TESTING");
return "ERROR" if errum(sys("umount $mount_point")) == 2;
return "ERROR" if errm(mount_device($device,$mount_point)) == 2;
}
# Now the question is whether or not these next tests depend on
# chroot, since they must have before.
if ( $chosen_tests->{33}{test_links} == 1 ) {
@ -2006,8 +2011,11 @@ sub which_tests {
check_nss();
}
if ( $fs_type ne "genext2fs" ) {
return "ERROR" if errum(sys("umount $mount_point")) == 2;
}
} # end sub which_tests

22
BootRoot/YardBox.pm

@ -211,6 +211,7 @@ my @menu_items = ( { path => '/File',
type => '<CheckItem>',
callback => \&tests },
{ path => '/_Help',
type => '<LastBranch>' },
{ path => '/Help/help_tearoff',
@ -673,6 +674,15 @@ sub tests {
sub test {
# Need to know whether genext2fs is being used
my $fs_type = (split(/\s/,$main::makefs))[0];
if ( $fs_type ne "genext2fs" ) {
$tests{30}{test_fstab} = 0;
$tests{31}{test_inittab} = 0;
$tests{32}{test_scripts} = 0;
}
my $error = which_tests(\%tests);
return if $error && $error eq "ERROR";
}
@ -860,8 +870,7 @@ sub yard_box {
$lib_bool++;
}
#print "$lib_bool\n";
}
);
} );
# objcopy parameters for Libraries
$lib_strip_all = $item_factory->get_item
@ -1069,6 +1078,13 @@ sub yard_box {
$vbox->pack_start( $save_button, $true, $true, 0 );
$save_button->show();
# chrooted tests not wanted for non-root user
if ( $> != 0 ) {
$item_factory->delete_item('/Tests/fstab');
$item_factory->delete_item('/Tests/inittab');
$item_factory->delete_item('/Tests/scripts');
}
show $main::yard_window;
} # end sub yard_box
@ -1498,6 +1514,8 @@ sub yard_menu {
$accel_group );
$accel_group->attach($window);
$item_factory->create_items(@menu_items);
##$item_factory->delete_item('/File/Checkbox');
##$item_factory->create_item(['/File/Checkbox', undef, undef, <Item>]);

Loading…
Cancel
Save