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 | #
|
---|
9 | use strict;
|
---|
10 | use Data::Dumper;
|
---|
11 | use MondoRescue::Version;
|
---|
12 | use MondoRescue::File;
|
---|
13 | # For pbdebug
|
---|
14 | use ProjectBuilder::Base;
|
---|
15 |
|
---|
16 | =pod
|
---|
17 |
|
---|
18 | =head1 NAME
|
---|
19 |
|
---|
20 | mr-read-all-link keeps track of all the links of a file and display them
|
---|
21 |
|
---|
22 | =head1 DESCRIPTION
|
---|
23 |
|
---|
24 | mr-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.
|
---|
25 |
|
---|
26 | =head1 SYNOPSIS
|
---|
27 |
|
---|
28 | mr-read-all-link /path/to/file ...
|
---|
29 |
|
---|
30 | =head1 ARGUMENTS
|
---|
31 |
|
---|
32 | =over 4
|
---|
33 |
|
---|
34 | =item B</path/to/file>
|
---|
35 |
|
---|
36 | This is the path of the binary file and for which we want its links to be included
|
---|
37 |
|
---|
38 | =back
|
---|
39 |
|
---|
40 | =head1 WEB SITES
|
---|
41 |
|
---|
42 | The 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/>.
|
---|
43 |
|
---|
44 | =head1 USER MAILING LIST
|
---|
45 |
|
---|
46 | For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
|
---|
47 |
|
---|
48 | =head1 AUTHORS
|
---|
49 |
|
---|
50 | The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
|
---|
51 |
|
---|
52 | =head1 COPYRIGHT
|
---|
53 |
|
---|
54 | MondoRescue is distributed under the GPL v2.0 license or later,
|
---|
55 | described in the file C<COPYING> included with the distribution.
|
---|
56 |
|
---|
57 | =cut
|
---|
58 |
|
---|
59 | $pbdebug = 2 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v"));
|
---|
60 |
|
---|
61 | my $file = mr_file_read_all_link(@ARGV) if (defined $ARGV[0]);
|
---|
62 | my %h;
|
---|
63 |
|
---|
64 | #print Dumper($file);
|
---|
65 |
|
---|
66 | foreach my $f (sort keys %$file) {
|
---|
67 | print "$f\n" if ($pbdebug >= 1);
|
---|
68 | print "--\n" if ($pbdebug >= 1);
|
---|
69 | #print Dumper($f);
|
---|
70 | foreach my $l (sort keys %{$file->{$f}}) {
|
---|
71 | print "==" if ($pbdebug >= 1);
|
---|
72 | print "$l\n" if ($pbdebug >= 1);
|
---|
73 | $h{$l} = 1;
|
---|
74 | }
|
---|
75 | print "--\n" if ($pbdebug >= 1);
|
---|
76 | }
|
---|
77 |
|
---|
78 | foreach my $l (sort keys %h) {
|
---|
79 | print "$l\n";
|
---|
80 | }
|
---|