diff options
Diffstat (limited to 'perl-install')
-rwxr-xr-x | perl-install/do_resize_fat | 18 | ||||
-rw-r--r-- | perl-install/fs.pm | 12 | ||||
-rw-r--r-- | perl-install/install_any.pm | 5 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 4 | ||||
-rw-r--r-- | perl-install/my_gtk.pm | 13 | ||||
-rw-r--r-- | perl-install/resize_fat/any.pm | 4 | ||||
-rw-r--r-- | perl-install/resize_fat/boot_sector.pm | 5 | ||||
-rw-r--r-- | perl-install/resize_fat/info_sector.pm | 2 | ||||
-rw-r--r-- | perl-install/resize_fat/main.pm | 7 |
9 files changed, 45 insertions, 25 deletions
diff --git a/perl-install/do_resize_fat b/perl-install/do_resize_fat new file mode 100755 index 000000000..0668ecb19 --- /dev/null +++ b/perl-install/do_resize_fat @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +use diagnostics; +use strict; + +use lib qw(.); +use common; +use resize_fat::main; + +local *log::l = sub { print join(' ', @_), "\n" }; + +@ARGV = qw(/tmp/eee +0); + +@ARGV == 2 or die "usage: fatresize <device> <size>\n <size> = 100 means `resize to 100Mb'\n <size> = +10 means `keep 10Mb of free space'\n"; + +my $fs = new resize_fat::main(common::basename($ARGV[0]), $ARGV[0]); +resize_fat::main::resize($fs, $ARGV[1]); + diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 50cdec0fc..bf06934c2 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -39,7 +39,7 @@ sub check_mounted($) { open H, "/proc/swaps"; foreach (<F>, <G>, <H>) { foreach my $p (@$fstab) { - /$p->{device}\s/ and $p->{isMounted} = 1; + /$p->{device}\s/ and $p->{isMounted} = $p->{isFormatted} = 1; } } } @@ -62,16 +62,16 @@ sub format_ext2($;$) { my ($dev, $bad_blocks) = @_; my @options; - $dev =~ m,(rd|ida)/, and push @options, qw(-b 4096 -R stride=16); # For RAID only. + $dev =~ m,(rd|ida)/, and push @options, qw(-b 4096 -R stride=16); # For RAID only. $bad_blocks and push @options, "-c"; run_program::run("mke2fs", devices::make($dev), @options) or die "ext2 formatting of $dev failed"; } sub format_dos($;$) { - my ($dev, $bad_blocks) = @_; + my ($dev, $bad_blocks, @options) = @_; - run_program::run("mkdosfs", devices::make($dev), $bad_blocks ? "-c" : ()) or die "dos formatting of $dev failed"; + run_program::run("mkdosfs", devices::make($dev), @options, $bad_blocks ? "-c" : ()) or die "dos formatting of $dev failed"; } sub format_part($;$) { @@ -85,6 +85,8 @@ sub format_part($;$) { format_ext2($part->{device}, $bad_blocks); } elsif (isDos($part)) { format_dos($part->{device}, $bad_blocks); + } elsif (isWin($part)) { + format_dos($part->{device}, $bad_blocks, '-F', 32); } elsif (isSwap($part)) { swap::make($part->{device}, $bad_blocks); } else { @@ -139,7 +141,7 @@ sub mount_part($;$) { isSwap($part) ? swap::swapon($part->{device}) : mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), 0); - $part->{isMounted} = 1; + $part->{isMounted} = $part->{isFormatted} = 1; # assume that if mount works, partition is formatted } sub umount_part($;$) { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 514b940e7..34f4c9139 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -74,7 +74,10 @@ sub spawnShell { exec {"/bin/sh"} "-/bin/sh" or log::l("exec of /bin/sh failed: $!"); } - +sub mouse_detect() { + my ($type, $dev) = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed"; + $type, $dev; +} sub upgrFindInstall { # int rc; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index e97ea8e41..fbfc6c12d 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -5,6 +5,7 @@ use strict; use common qw(:file :system); use install_any qw(:all); +use run_program; use lilo; use lang; use keyboard; @@ -28,7 +29,8 @@ sub new($$) { } sub chooseLanguage($) { - $o->{default}->{lang} +# eval { run_program::run('loadkeys', "/tmp/$o->{default}->{lang}) }; $@ and log::l("loadkeys failed"); + $o->{default}->{lang}; } sub selectInstallOrUpgrade($) { $o->{default}->{isUpgrade} || 0; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 82ed7040c..8ab3054e7 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -240,15 +240,14 @@ sub _ask_from_entry($$@) { sub _ask_from_list($\@$@) { my ($o, $l, @msgs) = @_; my $f = sub { $o->{retval} = $_[1]; Gtk->main_quit }; - my @l = map { gtksignal_connect(new Gtk::Button($_), "clicked" => $f, $_) } @$l; + my $list = new Gtk::List(); + map { gtksignal_connect(gtkadd($list, new Gtk::ListItem($_)), selection_changed => $f, $_) } @$l; -# gtkadd($o->{window}, -# gtkpack_(myset_usize(new Gtk::VBox(0,0), 0, 200), +# myadd($o->{window}, +# mypack_(myset_usize(new Gtk::VBox(0,0), 0, 200), # 0, $o->create_box_with_title(@msgs), -# 1, createScrolledWindow(gtkpack(new Gtk::VBox(0,0), @l)))); - gtkadd($o->{window}, - gtkpack($o->create_box_with_title(@msgs), @l)); - $l[0]->grab_focus(); +# 1, createScrolledWindow(mypack(new Gtk::VBox(0,0), @l)))); + gtkadd($o->{window}, gtkpack($o->create_box_with_title(@msgs), $list)); } sub _ask_warn($@) { diff --git a/perl-install/resize_fat/any.pm b/perl-install/resize_fat/any.pm index d78a342be..8c57eb6b0 100644 --- a/perl-install/resize_fat/any.pm +++ b/perl-install/resize_fat/any.pm @@ -21,11 +21,11 @@ $DIRECTORY = 2; # returns the number of clusters for a given filesystem type sub min_cluster_count($) { my ($fs) = @_; - (1 << $ {{ FAT16 => 12, FAT32 => 16 }}{$fs->{fs_type}}) - 12; + (1 << $ {{ FAT16 => 12, FAT32 => 12 }}{$fs->{fs_type}}) - 12; } sub max_cluster_count($) { my ($fs) = @_; - $resize_fat::bad_cluster_value - 2; + 2 ** $fs->{fs_type_size} - 11; } diff --git a/perl-install/resize_fat/boot_sector.pm b/perl-install/resize_fat/boot_sector.pm index c236b1617..cd8f52cac 100644 --- a/perl-install/resize_fat/boot_sector.pm +++ b/perl-install/resize_fat/boot_sector.pm @@ -64,6 +64,7 @@ sub read($) { $fs->{fs_type} = 'FAT16'; $fs->{fs_type_size} = 16; $fs->{fat_length} = $fs->{fat16_fat_length}; + $resize_fat::bad_cluster_value = 0xfff7; # 2**16 - 1 } else { $resize_fat::isFAT32 = 1; $fs->{fs_type} = 'FAT32'; @@ -72,8 +73,8 @@ sub read($) { $fs->{nb_root_dir_entries} = 0; $fs->{info_offset} = $fs->{info_offset_in_sectors} * $fs->{sector_size}; + $resize_fat::bad_cluster_value = 0xffffff7; } - $resize_fat::bad_cluster_value = (1 << $fs->{fs_type_size}) - 9; $fs->{fat_offset} = $fs->{nb_reserved} * $fs->{sector_size}; $fs->{fat_size} = $fs->{fat_length} * $fs->{sector_size}; @@ -88,7 +89,7 @@ sub read($) { $fs->{dir_entries_per_cluster} = divide($fs->{cluster_size}, psizeof($format)); - $fs->{nb_clusters} >= resize_fat::any::min_cluster_count($fs) or die "error: not enough sectors for a $fs->{fs_type}\n"; +# $fs->{nb_clusters} >= resize_fat::any::min_cluster_count($fs) or die "error: not enough sectors for a $fs->{fs_type}\n"; $fs->{nb_clusters} < resize_fat::any::max_cluster_count($fs) or die "error: too many sectors for a $fs->{fs_type}\n"; } diff --git a/perl-install/resize_fat/info_sector.pm b/perl-install/resize_fat/info_sector.pm index c46ae15fc..5b92501ea 100644 --- a/perl-install/resize_fat/info_sector.pm +++ b/perl-install/resize_fat/info_sector.pm @@ -20,7 +20,7 @@ my @fields = ( sub read($) { my ($fs) = @_; - my $info = resize_fat::io::read($fs, $fs->{offset}, psizeof($format)); + my $info = resize_fat::io::read($fs, $fs->{info_offset}, psizeof($format)); @{$fs->{info_sector}}{@fields} = unpack $format, $info; $fs->{info_sector}->{signature} == 0x61417272 or die "Invalid information sector signature\n"; } diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm index 2d5f4f969..d9f7a2181 100644 --- a/perl-install/resize_fat/main.pm +++ b/perl-install/resize_fat/main.pm @@ -15,11 +15,6 @@ use resize_fat::fat; use resize_fat::any; -#@ARGV == 2 or die "usage: fatresize <device> <size>\n <size> = 100 means `resize to 100Mb'\n <size> = +10 means `keep 10Mb of free space'\n"; -# -#my $fs = init($ARGV[0]); -#resize($fs, $ARGV[1]); - 1; # - reads in the boot sector/partition info., and tries to make some sense of it @@ -134,7 +129,7 @@ sub resize { $fs->{nb_sectors} = $size; $fs->{nb_clusters} = $new_nb_clusters; $fs->{clusters}->{count}->{free} = - $fs->{nb_clusters} - $fs->{clusters}->{count}->{used} - $fs->{clusters}->{count}->{bad}; + $fs->{nb_clusters} - $fs->{clusters}->{count}->{used} - $fs->{clusters}->{count}->{bad} - 2; $fs->{system_id} = 'was here!'; $fs->{small_nb_sectors} = 0; |