mirror of
				https://github.com/fspc/gbootroot.git
				synced 2025-11-04 08:15:36 -05: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:
		
							parent
							
								
									caca3cae38
								
							
						
					
					
						commit
						5af731e25c
					
				@ -1956,6 +1956,8 @@ sub which_tests {
 | 
				
			|||||||
    my ($chosen_tests) = @_;
 | 
					    my ($chosen_tests) = @_;
 | 
				
			||||||
    my ($action, $label);
 | 
					    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
 | 
					    #  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.
 | 
					    #  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_inittab  = $chosen_tests->{31}{test_inittab};
 | 
				
			||||||
    my $t_scripts  = $chosen_tests->{32}{test_scripts};
 | 
					    my $t_scripts  = $chosen_tests->{32}{test_scripts};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ( $fs_type ne "genext2fs" ) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return "ERROR" if errm(mount_device($device,$mount_point)) == 2;
 | 
						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",
 | 
						sys("/usr/lib/bootroot/yard_chrooted_tests $mount_point $t_fstab $t_inittab $t_scripts", "TESTING"); 
 | 
				
			||||||
	"TESTING"); 
 | 
					 | 
				
			||||||
	return "ERROR" if errum(sys("umount $mount_point")) == 2;
 | 
						return "ERROR" if errum(sys("umount $mount_point")) == 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return "ERROR" if errm(mount_device($device,$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
 | 
					    # Now the question is whether or not these next tests depend on
 | 
				
			||||||
    # chroot, since they must have before.
 | 
					    # chroot, since they must have before.
 | 
				
			||||||
    if ( $chosen_tests->{33}{test_links}   == 1 ) {
 | 
					    if ( $chosen_tests->{33}{test_links}   == 1 ) {
 | 
				
			||||||
@ -2006,8 +2011,11 @@ sub which_tests {
 | 
				
			|||||||
	check_nss();                     
 | 
						check_nss();                     
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ( $fs_type ne "genext2fs" ) {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	return "ERROR" if errum(sys("umount $mount_point")) == 2;
 | 
						return "ERROR" if errum(sys("umount $mount_point")) == 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
} # end sub which_tests
 | 
					} # end sub which_tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -211,6 +211,7 @@ my @menu_items = ( { path        => '/File',
 | 
				
			|||||||
		     type        => '<CheckItem>',
 | 
							     type        => '<CheckItem>',
 | 
				
			||||||
		     callback    => \&tests },
 | 
							     callback    => \&tests },
 | 
				
			||||||
	      
 | 
						      
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                   { path        => '/_Help',
 | 
					                   { path        => '/_Help',
 | 
				
			||||||
                     type        => '<LastBranch>' },
 | 
					                     type        => '<LastBranch>' },
 | 
				
			||||||
		   { path        => '/Help/help_tearoff',
 | 
							   { path        => '/Help/help_tearoff',
 | 
				
			||||||
@ -673,6 +674,15 @@ sub tests {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
sub test { 
 | 
					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); 
 | 
					    my $error = which_tests(\%tests); 
 | 
				
			||||||
    return if $error && $error eq "ERROR";
 | 
					    return if $error && $error eq "ERROR";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -860,8 +870,7 @@ sub yard_box {
 | 
				
			|||||||
					$lib_bool++;               
 | 
										$lib_bool++;               
 | 
				
			||||||
				    }
 | 
									    }
 | 
				
			||||||
				    #print "$lib_bool\n";
 | 
									    #print "$lib_bool\n";
 | 
				
			||||||
				     }
 | 
									} ); 
 | 
				
			||||||
                                   ); 
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # objcopy parameters for Libraries
 | 
					    # objcopy parameters for Libraries
 | 
				
			||||||
    $lib_strip_all = $item_factory->get_item
 | 
					    $lib_strip_all = $item_factory->get_item
 | 
				
			||||||
@ -1069,6 +1078,13 @@ sub yard_box {
 | 
				
			|||||||
       $vbox->pack_start( $save_button, $true, $true, 0 );
 | 
					       $vbox->pack_start( $save_button, $true, $true, 0 );
 | 
				
			||||||
       $save_button->show();
 | 
					       $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;
 | 
					        show $main::yard_window;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} # end sub yard_box
 | 
					} # end sub yard_box
 | 
				
			||||||
@ -1498,6 +1514,8 @@ sub yard_menu {
 | 
				
			|||||||
                                             $accel_group );
 | 
					                                             $accel_group );
 | 
				
			||||||
    $accel_group->attach($window);
 | 
					    $accel_group->attach($window);
 | 
				
			||||||
    $item_factory->create_items(@menu_items);
 | 
					    $item_factory->create_items(@menu_items);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ##$item_factory->delete_item('/File/Checkbox');
 | 
					    ##$item_factory->delete_item('/File/Checkbox');
 | 
				
			||||||
    ##$item_factory->create_item(['/File/Checkbox', undef, undef, <Item>]);
 | 
					    ##$item_factory->create_item(['/File/Checkbox', undef, undef, <Item>]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user