a script to find broken packages before they break you!

Frederik Sdun frederik.sdun at googlemail.com
Wed Jul 29 22:40:39 CEST 2009


* Previdi Roberto <previdi.roberto at gmail.com> [27.07.2009 13:07]:
>    hello list. I wrote this little script taking inspiration from the
>    powerful gentoo command "revdep-rebuild". It scans all the binary files in
>    /usr/bin and shows the broken ones (the ones linking non existent library)
> 
>    #!/bin/sh
>    for i in $(find /usr/bin/*); do
>            broken=$(ldd $i | grep "not found")
>            if [ "$broken" != "" ]; then
>                    echo $i: $broken
>            fi
>    done
> 
>    i called it "/usr/local/bin/revdep-scan"
>    when you run it it prints an output like this:
> 
>    /usr/bin/fsousaged: libfsoframework.so.0 => not found
> 
>    i have also seen that you can issue an "opkg search missing_lib_path" to
>    find the package to reinstall, but you must pass the whole path, like
>    "/usr/lib/libfsoframework.so.0" for it to work, so i'm not able to guess
>    it automatically (i could just try /usr/lib ...)
>    --
>    roby

> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community

Nice script. You can use regex to search the package:

LIB=$(echo $broken | awk '{print $2}')
PKG=$(opkg search */${LIB} | awk '{print $1}')
opkg install $PKG

or build a list of packages and install them at the end of the script

regards, Frederik
-- 
IRC: playya @ Freenode, Gimpnet
xmpp: playya at draugr.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.openmoko.org/pipermail/community/attachments/20090729/9486d529/attachment.pgp 


More information about the community mailing list