1
0
mirror of https://github.com/fspc/gbootroot.git synced 2025-04-04 07:43:22 -04:00

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.
This commit is contained in:
freesource 2001-11-17 07:55:03 +00:00
parent caca3cae38
commit 5af731e25c
2 changed files with 156 additions and 130 deletions

View File

@ -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

View File

@ -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>]);