diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2012-05-30 16:46:05 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2012-05-30 16:47:53 +1200 |
commit | 3865d9a25853995474f9141a5fdfc6cfe4477186 (patch) | |
tree | 21b5c3cf21577a707055ac807d0a32cc04261170 /clubber | |
parent | Sort output for tidiness (diff) | |
download | clubber-3865d9a25853995474f9141a5fdfc6cfe4477186.tar.gz clubber-3865d9a25853995474f9141a5fdfc6cfe4477186.zip |
Include all the libnss libraries we can find
Diffstat (limited to 'clubber')
-rwxr-xr-x | clubber | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -21,6 +21,7 @@ use warnings; use Cwd qw(abs_path); use Digest::MD5; use File::Basename; +use File::Find; use Getopt::Long; # @@ -83,6 +84,30 @@ foreach my $binary (@$binaries) { } # +# Include all libnss libraries available, because even static binaries depend +# on these for reading files like /etc/passwd. I leave importing those files to +# you because it's entirely possible you actually intend to have a different +# /etc/passwd or /etc/resolv.conf in your chroot environment. Good practice, +# even. +# +# If two of the libraries have the exact same filename, use the one with the +# shortest complete path. +# +my $nsslibs = {}; +my $nssfind = sub { + my $basename = $_; + if ($File::Find::name =~ /libnss/) { + if (!exists $nsslibs->{$basename} or length($File::Find::name) < length($nsslibs->{$basename})) { + $nsslibs->{$basename} = $File::Find::name; + } + } +}; +find($nssfind, qw(/lib /usr/lib)); +foreach my $nsslib (keys(%$nsslibs)) { + $libraries->{$nsslibs->{$nsslib}} = 1; +} + +# # If we have a chroot, we need to figure out what libraries require importing # and which directories require creating. # |