diff options
author | Antoine Ginies <aginies@mandriva.com> | 2011-01-19 10:44:49 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2011-01-19 10:44:49 +0000 |
commit | 530a16ec071db0e24e6e949e265a96848864967c (patch) | |
tree | fe40cacd28d67b98186754c551b7fd339ebc7e17 /rescue/lsparts | |
download | drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.gz drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.bz2 drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.xz drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.zip |
add mes5-2.6.33 branch
Diffstat (limited to 'rescue/lsparts')
-rwxr-xr-x | rescue/lsparts | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/rescue/lsparts b/rescue/lsparts new file mode 100755 index 000000000..e1e866db4 --- /dev/null +++ b/rescue/lsparts @@ -0,0 +1,45 @@ +#!/usr/bin/perl +# +# Main author Pascal Rigaux (pixel@mandriva.com) +# Put together by Guillaume Cottenceau +# +# Copyright 1999-2005 Mandriva +# +# This software may be freely redistributed under the terms of the GNU +# public license. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# +# Detects partition types using signatures +# + +use lib qw(/usr/lib/libDrakX); +use common; +use fs::type; +use fs::proc_partitions; + +my $params = join '', @ARGV; +my $verbose = $params =~ /-v/; + +$params =~ /-h/ and die "usage: lsparts [-v]\n"; + + +foreach (fs::proc_partitions::read_raw()) { + if (my $err = $_->{size} <= 1 ? + "Skipping <$_->{dev}> because too little blocks ($_->{size})" : + $_->{dev} !~ /\d$/ ? + "Skipping <$_->{dev}> because doesn't end with a number (e.g. seems to not be a partition)" : + $_->{dev} =~ /^loop\d+$/ ? + "Skipping <$_->{dev}>" : + '') { + print STDERR "$err\n" if $verbose; + } else { + $_->{device} = $_->{dev}; + if (my $type = fs::type::type_subpart_from_magic($_)) { + printf "$_->{dev}: %6s, fs %s (%s)\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type); + } + } +} |