source: MondoRescue/branches/3.2/MondoRescue/bin/mr-read-all-link@ 3522

Last change on this file since 3522 was 3311, checked in by Bruno Cornec, 10 years ago
  • Fix an issue reported by Dider Diaz for older perl version where the code was incompatible
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/usr/bin/perl -w
2#
3# $Id$
4# Copyright B. Cornec 2005-2014
5# Provided under the GPL v2
6#
7# Get all links from a file
8#
9use strict;
10use Data::Dumper;
11use MondoRescue::File;
12# For pbdebug
13use ProjectBuilder::Base;
14
15=pod
16
17=head1 NAME
18
19mr-read-all-link keeps track of all the links of a file and display them
20
21=head1 DESCRIPTION
22
23mr-read-all-link keeps track of all the links of a file and display them, by analyzing the path under which the file is located and mentioning all links that are encountered so that all the required content for a chroot environment are given back correctly.
24
25=head1 SYNOPSIS
26
27mr-read-all-link /path/to/file ...
28
29=head1 ARGUMENTS
30
31=over 4
32
33=item B</path/to/file>
34
35This is the path of the binary file and for which we want its links to be included
36
37=back
38
39=head1 WEB SITES
40
41The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>.
42
43=head1 USER MAILING LIST
44
45For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
46
47=head1 AUTHORS
48
49The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
50
51=head1 COPYRIGHT
52
53MondoRescue is distributed under the GPL v2.0 license or later,
54described in the file C<COPYING> included with the distribution.
55
56=cut
57
58$pbdebug = 2 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v"));
59
60my $file = mr_file_read_all_link(@ARGV) if (defined $ARGV[0]);
61my %h;
62
63#print Dumper($file);
64
65foreach my $f (sort keys %$file) {
66 print "$f\n" if ($pbdebug >= 1);
67 print "--\n" if ($pbdebug >= 1);
68 #print Dumper($f);
69 foreach my $l (sort keys %{$file->{$f}}) {
70 print "==" if ($pbdebug >= 1);
71 print "$l\n" if ($pbdebug >= 1);
72 $h{$l} = 1;
73 }
74 print "--\n" if ($pbdebug >= 1);
75}
76
77foreach my $l (sort keys %h) {
78 print "$l\n";
79}
Note: See TracBrowser for help on using the repository browser.