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::File; |
---|
12 | # For pbdebug |
---|
13 | use ProjectBuilder::Base; |
---|
14 | |
---|
15 | =pod |
---|
16 | |
---|
17 | =head1 NAME |
---|
18 | |
---|
19 | mr-read-all-link keeps track of all the links of a file and display them |
---|
20 | |
---|
21 | =head1 DESCRIPTION |
---|
22 | |
---|
23 | 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. |
---|
24 | |
---|
25 | =head1 SYNOPSIS |
---|
26 | |
---|
27 | mr-read-all-link /path/to/file ... |
---|
28 | |
---|
29 | =head1 ARGUMENTS |
---|
30 | |
---|
31 | =over 4 |
---|
32 | |
---|
33 | =item B</path/to/file> |
---|
34 | |
---|
35 | This 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 | |
---|
41 | 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/>. |
---|
42 | |
---|
43 | =head1 USER MAILING LIST |
---|
44 | |
---|
45 | For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel> |
---|
46 | |
---|
47 | =head1 AUTHORS |
---|
48 | |
---|
49 | The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>. |
---|
50 | |
---|
51 | =head1 COPYRIGHT |
---|
52 | |
---|
53 | MondoRescue is distributed under the GPL v2.0 license or later, |
---|
54 | described 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 | |
---|
60 | my $file = mr_file_read_all_link(@ARGV) if (defined $ARGV[0]); |
---|
61 | my %h; |
---|
62 | |
---|
63 | #print Dumper($file); |
---|
64 | |
---|
65 | foreach 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 | |
---|
77 | foreach my $l (sort keys %h) { |
---|
78 | print "$l\n"; |
---|
79 | } |
---|