-
Discover library dependencies on Slackware
Quote:You have inspired me to do the same thing. To post small scripts that I've written in my blog also. In fact, you have yourself to blame (I think) for my becoming aware that there even was the possibility to have a blog.
So for all the time I sit on my @$$ writing scripts, I might as well start sharing them.
Shingoshi
I started the sharing by a next step, see on http://slackwiki.org/Dependency_Discovery . I hope it will help more people than here.Posted 07-08-2009 at 08:17 AM by gabim -
Discover library dependencies on Slackware
You have inspired me to do the same thing. To post small scripts that I've written in my blog also. In fact, you have yourself to blame (I think) for my becoming aware that there even was the possibility to have a blog.
So for all the time I sit on my @$$ writing scripts, I might as well start sharing them.
ShingoshiPosted 07-05-2009 at 03:12 AM by Shingoshi -
Discover library dependencies on Slackware
version: 1.3
Deeper directory discovery via find:
Code:#!/bin/bash # file: sldd # description: Shared library dependency discovery # author: http://www.linuxquestions.org/user/gabim-473488/ # date: 27/05/2009 # version: 1.3 # This is the concatenated MANIFEST file of slackpkg on Slackware64 MANIFEST=/var/lib/slackpkg/slackware64-filelist.gz # Do not trust in any command in PATH, shell builtins, etc. SYSPATH=$PATH PATH=/bin:/usr/bin:/usr/sbin ECHO=/usr/bin/echo PRINTF=/usr/bin/printf # Check all directories in PATH and ld.so.conf # If it is true ELF binary find `$ECHO $SYSPATH | sed 's/:/ /g'` \ `sed 's/\(\/.*\/.*\)\/.*/\1/' /etc/ld.so.conf | sort -u` \ -perm -100 -a -type f \ -exec sh -c 'filename="{}"; /usr/bin/echo -n "." >&2; \ [ "ELF" = `file -b $filename | cut -d" " -f1` ] && \ ldd $filename 2>/dev/null | fgrep "not found" \ | cut -d" " -f1' \; | while read missing_lib do # Print the missing library and its package name $ECHO $missing_lib ": `zgrep $missing_lib $MANIFEST | cut -d" " -f1`" done | sort -u
Posted 07-03-2009 at 07:24 AM by gabim -
Discover library dependencies on Slackware
1.2
This version scans the /etc/ld.so.conf libraries also.
Code:#!/bin/bash # file: sldd # description: Slackware library dependency discovery # author: http://www.linuxquestions.org/user/gabim-473488/ # date: 27/05/2009 # version: 1.2 # This is the concatenated MANIFEST file of slackpkg on Slackware64 MANIFEST=/var/lib/slackpkg/slackware64-filelist.gz # Do not trust in any command in PATH, shell builtins, etc. ECHO=/usr/bin/echo PRINTF=/usr/bin/printf CUT=/usr/bin/cut SORT=/usr/bin/sort GREP=/usr/bin/grep ZGREP=/usr/bin/zgrep SED=/usr/bin/sed AWK=/usr/bin/awk FILE=/usr/bin/file LDD=/usr/bin/ldd NULL=/dev/null # Check all directories in PATH and ld.so.conf for directory in `$ECHO $PATH | $SED 's/:/ /g'` `cat /etc/ld.so.conf` do # Check all binaries in these directories for binary in $directory/* do # If it is true ELF binary if [ 'ELF' == `$FILE -b $binary | $CUT -d' ' -f1` ]; then # Show the progress by printing of actual filename on standard error $PRINTF "%-70s\r" $binary >&2 # Check the missing shared library dependencies $LDD $binary 2>$NULL | $GREP 'not found' | $AWK '{print $1}' | while read missing_lib do # Print the package name of the missing library $ZGREP $missing_lib $MANIFEST | $AWK '{print $1}' done fi done # Clear the progress info $PRINTF "%-80s\r" "" >&2 # Ignore the duplicated package names done | $SORT -u
Posted 06-12-2009 at 05:13 PM by gabim -
Discover library dependencies on Slackware
New version
The new version prints the missing package names instead of the missing library names, so one have to install only the given packages mentioned by this script.
Code:root@slack64:~# cat /usr/local/bin/sldd #!/bin/bash # file: sldd # description: Slackware library dependency discovery # author: http://www.linuxquestions.org/user/gabim-473488/ # date: 27/05/2009 # version: 1.1 # This is the concatenated MANIFEST file of slackpkg on Slackware64 MANIFEST=/var/lib/slackpkg/slackware64-filelist.gz # Do not trust in any command in PATH, shell builtins, etc. ECHO=/usr/bin/echo PRINTF=/usr/bin/printf CUT=/usr/bin/cut SORT=/usr/bin/sort GREP=/usr/bin/grep ZGREP=/usr/bin/zgrep SED=/usr/bin/sed AWK=/usr/bin/awk FILE=/usr/bin/file LDD=/usr/bin/ldd NULL=/dev/null # Check all directories in PATH for directory in `$ECHO $PATH | $SED 's/:/ /g'` do # Check all binaries in PATH directories for binary in $directory/* do # If it is true ELF binary if [ 'ELF' == `$FILE -b $binary | $CUT -d' ' -f1` ]; then # Show the progress by printing of actual filename on standard error $PRINTF "%-70s\r" $binary >&2 # Check the missing shared library dependencies $LDD $binary 2>$NULL | $GREP 'not found' | $AWK '{print $1}' | while read missing_lib do # Print the package name of the missing library $ZGREP $missing_lib $MANIFEST | $AWK '{print $1}' done fi done # Clear the progress info $PRINTF "%-80s\r" "" >&2 # Ignore the duplicated package names done | $SORT -u
Posted 06-11-2009 at 06:07 PM by gabim
Updated 06-12-2009 at 02:33 AM by gabim -
Discover library dependencies on Slackware
This was REAL helpful!!
You are welcome! I'm happy to help by this little script.Posted 06-11-2009 at 04:46 PM by gabim -
Discover library dependencies on Slackware
This was REAL helpful!!
Thanks for writing this. I hope you don't mind. I copied this into a bash script and modified the output to a file instead. I can then check each entry of the file against the MANIFEST.gz, and grap the dependencies as required.
Thanks,
ShingoshiPosted 06-11-2009 at 04:31 PM by Shingoshi