summaryrefslogtreecommitdiffstats
path: root/rescue/bin/lsparts
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-12-02 23:40:22 +0000
committerColin Guthrie <colin@mageia.org>2013-12-07 18:32:06 +0000
commite7aedc3aa7e08f3337c86085c6da10ca83445024 (patch)
tree4005be196198d60c655e345d43fef926bbac6702 /rescue/bin/lsparts
parent2ad4c4fc0b990dd0db23cdee815ac2a13c60929d (diff)
downloaddrakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.gz
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.bz2
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.xz
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.zip
rescue: Move files around and introduce proper dep tracking.
This moves any perl files into bin and sbin folders which will be directly installed in /usr/bin and /usr/sbin. This is done such that the extract modes in list.xml still work and the files end up in the right places. All other files have been moved into the tree folder in their final destination.
Diffstat (limited to 'rescue/bin/lsparts')
-rwxr-xr-xrescue/bin/lsparts45
1 files changed, 45 insertions, 0 deletions
diff --git a/rescue/bin/lsparts b/rescue/bin/lsparts
new file mode 100755
index 000000000..8d36a02f4
--- /dev/null
+++ b/rescue/bin/lsparts
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+#
+# Main author Pascal Rigaux (pixel)
+# 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);
+ }
+ }
+}