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 ($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,12 +1982,15 @@ 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};
return "ERROR" if errm(mount_device($device,$mount_point)) == 2; if ( $fs_type ne "genext2fs" ) {
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; 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");
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 # Now the question is whether or not these next tests depend on
# chroot, since they must have before. # chroot, since they must have before.
@ -2006,8 +2011,11 @@ sub which_tests {
check_nss(); check_nss();
} }
return "ERROR" if errum(sys("umount $mount_point")) == 2; if ( $fs_type ne "genext2fs" ) {
return "ERROR" if errum(sys("umount $mount_point")) == 2;
}
} # end sub which_tests } # end sub which_tests

View File

@ -210,6 +210,7 @@ my @menu_items = ( { path => '/File',
action => 36, action => 36,
type => '<CheckItem>', type => '<CheckItem>',
callback => \&tests }, callback => \&tests },
{ path => '/_Help', { path => '/_Help',
type => '<LastBranch>' }, type => '<LastBranch>' },
@ -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";
} }
@ -742,139 +752,138 @@ my $start_length;
sub yard_box { sub yard_box {
$main::yard_window = new Gtk::Window "toplevel"; $main::yard_window = new Gtk::Window "toplevel";
$main::yard_window->signal_connect("destroy", \&destroy_window, $main::yard_window->signal_connect("destroy", \&destroy_window,
\$main::yard_window); \$main::yard_window);
$main::yard_window->signal_connect("delete_event",\&destroy_window, $main::yard_window->signal_connect("delete_event",\&destroy_window,
\$main::yard_window); \$main::yard_window);
$main::yard_window->signal_connect("destroy", sub { $main::yard_window->signal_connect("destroy", sub {
$search_window->destroy if $search_window; } ); $search_window->destroy if $search_window; } );
$main::yard_window->signal_connect("delete_event", sub { $main::yard_window->signal_connect("delete_event", sub {
$search_window->destroy if $search_window; }); $search_window->destroy if $search_window; });
$main::yard_window->set_usize( 525, 450 ); $main::yard_window->set_usize( 525, 450 );
$main::yard_window->set_policy( $true, $true, $false ); $main::yard_window->set_policy( $true, $true, $false );
$main::yard_window->set_title( "Yard Box - $template" ); $main::yard_window->set_title( "Yard Box - $template" );
$main::yard_window->border_width(0); $main::yard_window->border_width(0);
my $main_vbox = new Gtk::VBox( $false, 0 ); my $main_vbox = new Gtk::VBox( $false, 0 );
$main::yard_window->add( $main_vbox ); $main::yard_window->add( $main_vbox );
$main_vbox->show(); $main_vbox->show();
my $vbox = new Gtk::VBox( $false, 0 ); my $vbox = new Gtk::VBox( $false, 0 );
$vbox->border_width( 0 ); $vbox->border_width( 0 );
$main_vbox->pack_start( $vbox, $false, $true, 0 ); $main_vbox->pack_start( $vbox, $false, $true, 0 );
$vbox->show(); $vbox->show();
#_______________________________________ #_______________________________________
# Item::Factory # Item::Factory
my $menubar = yard_menu($main::yard_window); my $menubar = yard_menu($main::yard_window);
$vbox->pack_start( $menubar, $false, $true, 0 ); $vbox->pack_start( $menubar, $false, $true, 0 );
$menubar->show(); $menubar->show();
$vbox = new Gtk::VBox( $false, 10 ); $vbox = new Gtk::VBox( $false, 10 );
$vbox->border_width( 10 ); $vbox->border_width( 10 );
$main_vbox->pack_start( $vbox, $true, $true, 0 ); $main_vbox->pack_start( $vbox, $true, $true, 0 );
$vbox->show(); $vbox->show();
my $table = new Gtk::Table( 2, 2, $false ); my $table = new Gtk::Table( 2, 2, $false );
$table->set_row_spacing( 0, 2 ); $table->set_row_spacing( 0, 2 );
$table->set_col_spacing( 0, 2 ); $table->set_col_spacing( 0, 2 );
$vbox->pack_start( $table, $true, $true, 0 ); $vbox->pack_start( $table, $true, $true, 0 );
$table->show( ); $table->show( );
#_______________________________________ #_______________________________________
# Manipulate Gtk::ItemFactory - # Manipulate Gtk::ItemFactory -
# The trick here is to use the real path. # The trick here is to use the real path.
# GUIDE TO VARIABLES AND THEIR VALUES # GUIDE TO VARIABLES AND THEIR VALUES
# #
# objcopy <RadioItem> # objcopy <RadioItem>
# ------------------- # -------------------
# $strip_bool strip-all (default) # $strip_bool strip-all (default)
# strip-debug # strip-debug
# #
# stages <RadioItem> # stages <RadioItem>
# ------------------ # ------------------
# one-by-one (default) # one-by-one (default)
# $stages_bool continuous # $stages_bool continuous
# user-defined # user-defined
# #
# stripping <CheckItem> # stripping <CheckItem>
# --------------------- # ---------------------
# on off # on off
# -- --- # -- ---
# $lib_bool 1 (default) 0 # $lib_bool 1 (default) 0
# $bin_bool 1 (default) 0 # $bin_bool 1 (default) 0
# $mod_bool 1 (default) 0 # $mod_bool 1 (default) 0
# #
# Checking Settings <CheckItem> # Checking Settings <CheckItem>
# ----------------------------- # -----------------------------
# $replacement_bool 1 (default) 0 # $replacement_bool 1 (default) 0
# $module_bool 1 (default) 0 # $module_bool 1 (default) 0
# #
# Check Stage Variables HOH = %checks # Check Stage Variables HOH = %checks
# ----------------------------------- # -----------------------------------
# 16 fstab 1 0 (default) # 16 fstab 1 0 (default)
## These next two were removed, because there isn't any ## These next two were removed, because there isn't any
## script to make rc, and I can't remember what the ## script to make rc, and I can't remember what the
# fstab directory name entry was for. :*? # fstab directory name entry was for. :*?
# 17 rc 1 0 (default # 17 rc 1 0 (default
# 18 'fstab directory name' if fstab == 0 # 18 'fstab directory name' if fstab == 0
# #
# Tests <CheckItem> HOH = %tests # Tests <CheckItem> HOH = %tests
# -------------------------------- # --------------------------------
# 30 test_fstab 1 (default) 0 # 30 test_fstab 1 (default) 0
# 31 test_inittab 1 (default) 0 # 31 test_inittab 1 (default) 0
# 32 test_scripts 1 (default) 0 # 32 test_scripts 1 (default) 0
# 33 test_links 1 (default) 0 # 33 test_links 1 (default) 0
# 34 test_passwd 1 (default) 0 # 34 test_passwd 1 (default) 0
# 35 test_pam 1 (default) 0 # 35 test_pam 1 (default) 0
# 36 test_nss 1 (default) 0 # 36 test_nss 1 (default) 0
# Stages # Stages
$one_by_one = $item_factory->get_item('/Edit/Stages/one-by-one'); $one_by_one = $item_factory->get_item('/Edit/Stages/one-by-one');
$continuous = $item_factory->get_item('/Edit/Stages/continuous'); $continuous = $item_factory->get_item('/Edit/Stages/continuous');
$user_defined = $item_factory->get_item('/Edit/Stages/user defined'); $user_defined = $item_factory->get_item('/Edit/Stages/user defined');
$continuous->active(0); $continuous->active(0);
$user_defined->active(0); $user_defined->active(0);
# Stripping # Stripping
# Libraries # Libraries
my $lib_strip = $item_factory->get_item my $lib_strip = $item_factory->get_item
('/Edit/Settings/Stripping/Libraries'); ('/Edit/Settings/Stripping/Libraries');
$lib_strip->active($true); $lib_strip->active($true);
$lib_strip->signal_connect( "activate", $lib_strip->signal_connect( "activate",
sub { sub {
# off # off
if ($lib_bool eq "") { if ($lib_bool eq "") {
$lib_bool = 0; $lib_bool = 0;
} }
if ($lib_bool == 1) { if ($lib_bool == 1) {
$lib_bool--; $lib_bool--;
} }
# on # on
else { else {
$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
('/Edit/Settings/Stripping/settings/strip-all'); ('/Edit/Settings/Stripping/settings/strip-all');
$lib_strip_debug = $item_factory->get_item $lib_strip_debug = $item_factory->get_item
('/Edit/Settings/Stripping/settings/strip-debug'); ('/Edit/Settings/Stripping/settings/strip-debug');
$lib_strip_debug->active(0); $lib_strip_debug->active(0);
# Binaries # Binaries
my $bin_strip = $item_factory->get_item my $bin_strip = $item_factory->get_item
('/Edit/Settings/Stripping/Binaries'); ('/Edit/Settings/Stripping/Binaries');
$bin_strip->active($true); $bin_strip->active($true);
$bin_strip->signal_connect( "activate", $bin_strip->signal_connect( "activate",
sub { sub {
if ($bin_bool eq "") { if ($bin_bool eq "") {
$bin_bool = 0; $bin_bool = 0;
@ -1068,8 +1077,15 @@ sub yard_box {
$save_button->signal_connect( 'clicked', \&saved, 102); $save_button->signal_connect( 'clicked', \&saved, 102);
$vbox->pack_start( $save_button, $true, $true, 0 ); $vbox->pack_start( $save_button, $true, $true, 0 );
$save_button->show(); $save_button->show();
show $main::yard_window; # 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 } # 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>]);