|
@ -57,6 +57,7 @@ my($Warnings) = 0; |
|
|
my $verbosity; |
|
|
my $verbosity; |
|
|
my ($text_insert,$red,$blue); |
|
|
my ($text_insert,$red,$blue); |
|
|
my $logadj; |
|
|
my $logadj; |
|
|
|
|
|
my $mount_point; |
|
|
|
|
|
|
|
|
# This solves an annoying problem with the new Perl-5.6 built in glob, |
|
|
# This solves an annoying problem with the new Perl-5.6 built in glob, |
|
|
# allowing earlier versions of Perl to run. |
|
|
# allowing earlier versions of Perl to run. |
|
@ -281,7 +282,7 @@ sub extra_links { |
|
|
|
|
|
|
|
|
my ($contents_file) = @_; |
|
|
my ($contents_file) = @_; |
|
|
|
|
|
|
|
|
info(0, "\n\nPASS 2: Picking up extra files from links...\n"); |
|
|
info(0, "PASS 2: Picking up extra files from links...\n"); |
|
|
|
|
|
|
|
|
for (keys %Included) { |
|
|
for (keys %Included) { |
|
|
# watch for "" - GBteam |
|
|
# watch for "" - GBteam |
|
@ -747,18 +748,19 @@ sub create_filesystem { |
|
|
$strip_bin, $strip_module, $obj_count) = @_; |
|
|
$strip_bin, $strip_module, $obj_count) = @_; |
|
|
|
|
|
|
|
|
my $device = "$mnt/$filename"; |
|
|
my $device = "$mnt/$filename"; |
|
|
my $mount_point = "$mnt/loopback"; |
|
|
$mount_point = "$mnt/loopback"; |
|
|
|
|
|
|
|
|
my $file; |
|
|
my $file; |
|
|
my $error; |
|
|
my $error; |
|
|
|
|
|
|
|
|
|
|
|
info(0, "Creating root filesystem.\n"); |
|
|
|
|
|
info(0, "Description: $fs_size K ext2 file system\n"); |
|
|
|
|
|
info(0, "Where: $device\n"); |
|
|
|
|
|
|
|
|
sync(); |
|
|
sync(); |
|
|
sys("dd if=/dev/zero of=$device bs=1k count=$fs_size"); |
|
|
sys("dd if=/dev/zero of=$device bs=1k count=$fs_size"); |
|
|
sync(); |
|
|
sync(); |
|
|
|
|
|
|
|
|
info(0, "Creating $fs_size K ext2 file system on $device\n"); |
|
|
|
|
|
|
|
|
|
|
|
if (-f $device) { |
|
|
if (-f $device) { |
|
|
##### If device is a plain file, it means we're using some loopback |
|
|
##### If device is a plain file, it means we're using some loopback |
|
|
##### device. Use -F switch in mke2fs so it won't complain. |
|
|
##### device. Use -F switch in mke2fs so it won't complain. |
|
@ -912,9 +914,10 @@ sub create_filesystem { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
## Probably will want to umount here |
|
|
## Probably will want to umount here |
|
|
|
|
|
return "ERROR" if errum(sys("umount $mount_point")) == 2; |
|
|
|
|
|
|
|
|
info(0, "\nDone with $PROGRAM_NAME. $Warnings warnings.\n", |
|
|
info(0, "\nDone making the root filesystem. $Warnings warnings.\n", |
|
|
"$device is still mounted on $mount_point\n\n"); |
|
|
"$device is now umounted from $mount_point\n\n"); |
|
|
|
|
|
|
|
|
} # end sub create_filesystem |
|
|
} # end sub create_filesystem |
|
|
|
|
|
|
|
@ -1002,11 +1005,11 @@ sub copy_strip_file { |
|
|
$strip_lib, $strip_bin, $strip_module) = @_; |
|
|
$strip_lib, $strip_bin, $strip_module) = @_; |
|
|
my $error; |
|
|
my $error; |
|
|
|
|
|
|
|
|
if ($strip_objfiles and defined($objcopy) and $strippable{$from}) { |
|
|
if ($strippable{$from}) { |
|
|
# Copy it stripped |
|
|
# Copy it stripped |
|
|
|
|
|
|
|
|
|
|
|
if ($strip_lib) { |
|
|
if (defined($lib_needed_by{$from}) && $strip_lib) { |
|
|
if (defined($lib_needed_by{$from})) { |
|
|
# It's a library |
|
|
# It's a library |
|
|
if ($strip_objfiles == 1) { |
|
|
if ($strip_objfiles == 1) { |
|
|
info(1, "Copy/stripping library $from to $to\n"); |
|
|
info(1, "Copy/stripping library $from to $to\n"); |
|
@ -1016,28 +1019,60 @@ sub copy_strip_file { |
|
|
info(1, "Copy/stripping library $from to $to\n"); |
|
|
info(1, "Copy/stripping library $from to $to\n"); |
|
|
sys("$objcopy --strip-debug $from $to"); |
|
|
sys("$objcopy --strip-debug $from $to"); |
|
|
} |
|
|
} |
|
|
} elsif (defined($is_module{$from}) && $strip_module) { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Copy file perms and owner |
|
|
|
|
|
my($mode, $uid, $gid); |
|
|
|
|
|
(undef, undef, $mode, undef, $uid, $gid) = stat $from; |
|
|
|
|
|
my $from_base = basename($from); |
|
|
|
|
|
chown($uid, $gid, $to) or ($error = |
|
|
|
|
|
error("chown: $! \($from_base\)\n")); |
|
|
|
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
|
|
|
chmod($mode, $to) or ($error = |
|
|
|
|
|
error("chmod: $! \($from_base\)\n")); |
|
|
|
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
|
|
|
} |
|
|
|
|
|
elsif ($strip_module) { |
|
|
info(1, "Copy/stripping module $from to $to\n"); |
|
|
info(1, "Copy/stripping module $from to $to\n"); |
|
|
sys("$objcopy --strip-debug $from $to"); |
|
|
sys("$objcopy --strip-debug $from $to"); |
|
|
|
|
|
|
|
|
|
|
|
# Copy file perms and owner |
|
|
|
|
|
my($mode, $uid, $gid); |
|
|
|
|
|
(undef, undef, $mode, undef, $uid, $gid) = stat $from; |
|
|
|
|
|
my $from_base = basename($from); |
|
|
|
|
|
chown($uid, $gid, $to) or ($error = |
|
|
|
|
|
error("chown: $! \($from_base\)\n")); |
|
|
|
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
|
|
|
chmod($mode, $to) or ($error = |
|
|
|
|
|
error("chmod: $! \($from_base\)\n")); |
|
|
|
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
} elsif ($strip_bin) { |
|
|
} elsif ($strip_bin) { |
|
|
# It's a binary executable |
|
|
# It's a binary executable |
|
|
info(1, "Copy/stripping binary executable $from to $to\n"); |
|
|
info(1, "Copy/stripping binary executable $from to $to\n"); |
|
|
sys("$objcopy --strip-all $from $to"); |
|
|
sys("$objcopy --strip-all $from $to"); |
|
|
} |
|
|
|
|
|
# Copy file perms and owner |
|
|
# Copy file perms and owner |
|
|
my($mode, $uid, $gid); |
|
|
my($mode, $uid, $gid); |
|
|
(undef, undef, $mode, undef, $uid, $gid) = stat $from; |
|
|
(undef, undef, $mode, undef, $uid, $gid) = stat $from; |
|
|
chown($uid, $gid, $to) or ($error = error("chown: $!")); |
|
|
my $from_base = basename($from); |
|
|
|
|
|
chown($uid, $gid, $to) or ($error = |
|
|
|
|
|
error("chown: $! \($from_base\)\n")); |
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
chmod($mode, $to) or ($error = error("chmod: $!")); |
|
|
chmod($mode, $to) or ($error = |
|
|
|
|
|
error("chmod: $! \($from_base\)\n")); |
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
return "ERROR"if $error && $error eq "ERROR"; |
|
|
|
|
|
} |
|
|
} else { |
|
|
else { |
|
|
# Normal copy, no strip |
|
|
# Normal copy, no strip |
|
|
sys("cp $from $to"); |
|
|
sys("cp $from $to"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
# Normal copy, no strip |
|
|
|
|
|
sys("cp $from $to"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##### End of make_root_fs |
|
|
##### End of make_root_fs |
|
@ -1114,7 +1149,8 @@ sub sys { |
|
|
0; # like system() |
|
|
0; # like system() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
## history |
|
|
# Maybe history but @mount_device_if_necessary() uses it. |
|
|
|
|
|
# Just need to add error_window. |
|
|
sub load_mount_info { |
|
|
sub load_mount_info { |
|
|
undef %::mounted; |
|
|
undef %::mounted; |
|
|
undef %::fs_type; |
|
|
undef %::fs_type; |
|
@ -1578,23 +1614,15 @@ __END__ |
|
|
## |
|
|
## |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
#BEGIN { require "yard_utils.pl" } |
|
|
|
|
|
#require "Config.pl"; |
|
|
|
|
|
|
|
|
|
|
|
### GLOBAL VARIABLES |
|
|
### GLOBAL VARIABLES |
|
|
my(%Termcap); # Defs from /etc/termcap |
|
|
my(%Termcap); # Defs from /etc/termcap |
|
|
my($checked_for_getty_files); # Scalar -- have we checked getty files yet? |
|
|
my($checked_for_getty_files); # Scalar -- have we checked getty files yet? |
|
|
my(%checked); # Hash table of files we've already checked |
|
|
my(%checked); # Hash table of files we've already checked |
|
|
# 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. |
|
|
my($login_binary) = "$::mount_point/bin/login"; |
|
|
my($login_binary) = "$mount_point/bin/login"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STDOUT->autoflush(1); |
|
|
## Maybe this |
|
|
|
|
|
|
|
|
# Won't have to do this. |
|
|
|
|
|
##@ start_logging_output(); |
|
|
|
|
|
#info(0, "check_root_fs @yard_version@\n"); |
|
|
|
|
|
##@mount_device_if_necessary(); |
|
|
##@mount_device_if_necessary(); |
|
|
|
|
|
|
|
|
# This goes first so we define %Termcap for use in children |
|
|
# This goes first so we define %Termcap for use in children |
|
@ -1609,16 +1637,18 @@ check_passwd(); |
|
|
check_pam(); |
|
|
check_pam(); |
|
|
check_nss(); |
|
|
check_nss(); |
|
|
|
|
|
|
|
|
info(0, "All done.\n"); |
|
|
info(0, "All done!\n"); |
|
|
info(0, "If this is acceptable, continue with write_rescue_disk\n"); |
|
|
info(0, "You can run more tests with the UML kernel,\n |
|
|
exit; |
|
|
or construct a distribution by using this root\n |
|
|
|
|
|
filesystem with a boot method."); |
|
|
|
|
|
|
|
|
|
|
|
########################## |
|
|
############################################################################## |
|
|
|
|
|
sub warning { |
|
|
# I think we will just add all warnings together |
|
|
info(0, "\n", @_); |
|
|
#sub warning { |
|
|
|
|
|
# info(0, "\n", @_); |
|
|
# $Warnings++; |
|
|
# $Warnings++; |
|
|
} |
|
|
#} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This takes a procedure call, forks off a subprocess, chroots to |
|
|
# This takes a procedure call, forks off a subprocess, chroots to |
|
|