:: [DNG] How to unmerge /usr (was Re: …
Startseite
Nachricht löschen
Nachricht beantworten
Autor: karl
Datum:  
To: dng
Alte Treads: Re: [DNG] /usr to merge or not to merge... that is the question
Betreff: [DNG] How to unmerge /usr (was Re: /usr to merge or not to merge... that is the question)
Rich Moen:
> Quoting KatolaZ (katolaz@???):

...
> > # ldd /bin/ps | grep "/usr"
> >         liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fd7f6ebc000)

>
> Yeah, those two are really annoying. FWIW, my server system has older
> versions of those two utilities that do _not_ have that (IMO) build
> error. Local packages will be an immediate resort, when/if I hit that.

...

Attached is a program to find possible /-/usr link breakage.
It could possible be changed into an un-usrmerge-program if we want.

Example output on a smallish system:
# usr.pl
/bin/nano
        /usr/lib64/libmagic.so.1
/bin/ping
        /usr/lib64/libcrypto.so.1.0.0
#


Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden

#!/usr/bin/perl -w

use strict;

sub run($) {
    my $file = shift;
    my @lib = split /\n/, `ldd $file`;
    my @usr = grep /\/usr/, @lib;
    if (@usr) {
    print "$file\n";
    for my $l (@usr) {
        $l =~ m/=>\s(\S*)\s/;
        my $n = $1;
        print "\t$n\n";
    }
    }
}


sub main() {
    my @file = split /\n/, `find /bin /sbin -type f`;


    for my $file (@file) {
    run($file);
    }
}


main();