this is complete code as is it works (I'll boot clean and check again) now works on clean install
EDIT had to add
# mkdir -p /var/log/setup/tmp/
@brokenman I was working on this while you posted so I just saw your post with another answer
I should do that clean upFirst step is remove lines like libc and linux-gate.
sed -e '/gate/d' -e '/libs/d'
Code: Select all
#!/bin/bash
# version 2.5
# this is just the dependency checker routine stand alone
# Joe Arose aka..big_bass
# slim and powerful and very fast should be able to use on any slackware derivative
# Light Package Tool MANAGEMENT The Xdialog version
# version 2.2 dependency checking and missing libs viewer added tlz tbz support
# A new GUI frontend was written
# Uses Slackwares tools for the backend but they were modified too
# built the menu so that each selected option is a stand alone subroutine
# mkdir -p /var/log/setup/tmp/
#--------------------------------------------
# ## Dependency_check ##
#--------------------------------------------
# all the ELF executables listed in the find
# are tested with ldd
# a dependency list is generated with the correct program name
# showing all of the dependencies listed for that program
# a missing libs list is also generated
# it is added to the bottom of the depencency list if
# any missing dependencies are found
rm -f /tmp/missing_libs2.txt
mkdir -p /var/lib/pkgtool/dependencies ##everything is saved here
mkdir -p /var/log/setup/tmp/
#set up values
ADM_DIR=/var/log
ADM_PATH=/var/log
PKG_MANAGEMENT=$ADM_DIR/setup/tmp
rm -f $PKG_MANAGEMENT/filtered_list
rm -f $PKG_MANAGEMENT/lld_tmp_file2
rm -f $PKG_MANAGEMENT/lld_tmp_file3
# shows the installed packages
FILES=$(ls $ADM_DIR/packages)
cd $ADM_DIR/packages
{ grep '^PACKAGE DESCRIPTION:$' -Z -H -m1 -A1 $FILES; echo; } \
| sed -n 'h;n;/\x00/{h;n;};x;s/ */ /g;s/ $//;s/[\"`$]/\\&/g
s/\(.*\)\x00\([^:]*:\)\? *\(.*\)/ "\1" "" OFF \\/;p' > $PKG_MANAGEMENT/temporary_list2
touch $PKG_MANAGEMENT/temporary_list2
#----------------------------------------
# generate $PKG_MANAGEMENT/x_dependency_viewer
#----------------------------------------
# this makes a script using echo
# with the new formated PACKAGE DESCRIPTION:
# make the xdialog head
cat << 'EOF' >$PKG_MANAGEMENT/x_dependency_viewer
#!/bin/sh
Xdialog --title " Package you wish to view dependencies" \
--backtitle "Dependency info only ELF executables are shown " \
--radiolist "Select a package to view dependencies \
\n" 0 0 0 \
EOF
# build the list of installed packages
# this the body of the script
echo "`cat $PKG_MANAGEMENT/temporary_list2`">>$PKG_MANAGEMENT/x_dependency_viewer
# the chosen value is used to view just that file from the main list
cat << 'EOF' >>$PKG_MANAGEMENT/x_dependency_viewer
2> $PKG_MANAGEMENT/return2
case $? in
0)
echo "Yes chosen.";;
1)
echo "No chosen."
return
;;
255)
echo "Box closed."
exit
;;
esac
export PKG_MANAGEMENT="/var/log/setup/tmp"
export ADM_DIR="/var/log"
EOF
# make it executable
chmod a+x $PKG_MANAGEMENT/x_dependency_viewer
#----------------------------------------
# run the new "viewscr2"
# automatically from $PKG_MANAGEMENT/x_dependency_viewer
#----------------------------------------
. $PKG_MANAGEMENT/x_dependency_viewer
#all that just for a package name :S
PKGNAME=`cat $PKG_MANAGEMENT/return2`
# since the installed package has a header we remove it but first select a key word
if fgrep "./" $ADM_DIR/packages/$PKGNAME 1> /dev/null 2>&1; then
TRIGGER="^\.\/"
else
TRIGGER="FILE LIST:"
fi
#removes header
sed -n "/$TRIGGER/,/^$/p" < $ADM_DIR/packages/$PKGNAME | \
fgrep -v "FILE LIST:" | sort -u > $PKG_MANAGEMENT/load_list
#---------------------------------------
#generate a list of confirmed ELF files
#----------------------------------------
for i in `cat $PKG_MANAGEMENT/load_list`; do
#the first slash "/"is removed so add it onto the name
#a dependency file will be saved later using this name
echo "/$i" >>$PKG_MANAGEMENT/lld_tmp_file2
done
#---------------------------------------
#make the dependency files
#----------------------------------------
echo "finding dependencies"
#read the list of confirmed ELF files
#it is shown using path+filename
for i in `cat $PKG_MANAGEMENT/lld_tmp_file2 | xargs file | grep ELF | cut -f 1 -d :`
do
#strip off path
#a dependency file will be saved later using this name
echo "$i" | basename $i >$PKG_MANAGEMENT/lld_tmp_file3
#echo "$i" | basename $i
##removed some extra hex code here by filtering it first
ldd "$i">> /var/lib/pkgtool/dependencies/$PKGNAME"-filtering.txt"
#fixed missing dependency checker to display cleanly
LDD_RESULT="`ldd $i`"
MISSING_LIBS="`echo "$LDD_RESULT" | grep "not found" |uniq | cut -f 2 | cut -f 1 -d " " | tr "\n" " " `"
if [ ! "$MISSING_LIBS" = "" ];then
echo "">> /tmp/missing_libs2.txt
echo "-----------------------------------------------">> /tmp/missing_libs2.txt
echo " $PROGNAME has these missing library files:" >> /tmp/missing_libs2.txt
echo " $MISSING_LIBS" >> /tmp/missing_libs2.txt
echo "">> /tmp/missing_libs2.txt
fi
cat /var/lib/pkgtool/dependencies/$PKGNAME"-filtering.txt"| cut -f 1 -d '(' > /var/lib/pkgtool/dependencies/$PKGNAME"-depends.txt"
#if there are missing depends add the warning to the bottom of the list
cat /tmp/missing_libs2.txt >> /var/lib/pkgtool/dependencies/$PKGNAME"-depends.txt"
rm -f /var/lib/pkgtool/dependencies/$PKGNAME"-filtering.txt" ## clean up the extra unfilted file created
done
#----------------------------------------
# generate viewsrc2
#----------------------------------------
#make the package selected to view a string value called RETURN2
RETURN2=`cat $PKG_MANAGEMENT/return2`
#then pipe that into xdialog
echo "`cat /var/lib/pkgtool/dependencies/$RETURN2-depends.txt`" | Xdialog --title " $RETURN2 files " \--backtitle " $RETURN2 list " \--textbox "-" 0 0 0
# end depcheck
done