Neater Package Management

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
bigbass
Contributor
Contributor
Posts: 151
Joined: 13 Jan 2012, 14:35
Distribution: slackware 14

Re: Neater Package Management

Post#16 by bigbass » 11 Aug 2012, 21:45

well this is even easier I removed the dependency checker into a stand alone app
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
First step is remove lines like libc and linux-gate.
sed -e '/gate/d' -e '/libs/d'
I should do that clean up


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   












Last edited by bigbass on 18 Aug 2012, 17:33, edited 2 times in total.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5503
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Neater Package Management

Post#17 by brokenman » 11 Aug 2012, 22:02

Nice. Modular drop in dependency checker. I should have used this approach earlier. I'll add it to my personal library /usr/lib/librokenman so it can be called from any script with something like.

get_deps gparted
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
bigbass
Contributor
Contributor
Posts: 151
Joined: 13 Jan 2012, 14:35
Distribution: slackware 14

Re: Neater Package Management

Post#18 by bigbass » 11 Aug 2012, 23:04

Image




EDITED above post had to add
# mkdir -p /var/log/setup/tmp/


and reformatted the TABS

brokenman
I'll add it to my personal library /usr/lib/librokenman so it can be called from any script with something like.

get_deps gparted
cool! command line even better for quick checks

EDIT UPDATE Aug 12 added a search using simple names

This is a command line version call it depinstalled
simplified for easier conversion to a lib

Joe

*looks better if you name it then call it from bash sourced or placed in the path


Code: Select all

#!/bin/bash
   
# 
# depinstalled
# this is just the dependency checker routine stand alone
# command line version for non X

# Joe Arose aka..big_bass
# slim and powerful and very fast should be able to use on any slackware derivative

# 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   /;p' > $PKG_MANAGEMENT/temporary_list2
   touch $PKG_MANAGEMENT/temporary_list2
   cat $PKG_MANAGEMENT/temporary_list2
   

echo -e '\E[1;33;44m'"Search for a package just the simple name no verion number or hyphens "
read SEARCH_STRING
echo "----------"
echo ""
clear



egrep "$SEARCH_STRING" $PKG_MANAGEMENT/temporary_list2 


echo ""
echo " "
echo -e '\E[1;33;44m'"Enter a full package name from the above list copy and paste works then press enter "
echo ""
read PKGNAME


echo ""
echo $PKGNAME  >$PKG_MANAGEMENT/return2





echo ""
# 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 for :"


   #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
   
   # check if file is there
   if  [ -s /tmp/missing_libs2.txt ];then
        
    cat /tmp/missing_libs2.txt >> /var/lib/pkgtool/dependencies/$PKGNAME"-depends.txt"
 
   fi
   
   
   
   
   rm -f  /var/lib/pkgtool/dependencies/$PKGNAME"-filtering.txt"  ## clean up the extra unfilted file created
   
   done



#----------------------------------------
# generate view
#----------------------------------------

#make the package selected to view a string value called RETURN2
RETURN2=`cat $PKG_MANAGEMENT/return2`

cat /var/lib/pkgtool/dependencies/$RETURN2-depends.txt

echo ""
echo ""

echo -e '\E[1;37;44m'"A copy of the dependency list was made here  /var/lib/pkgtool/dependencies\033 "



 

Last edited by bigbass on 12 Aug 2012, 16:39, edited 3 times in total.

edge226
Contributor
Contributor
Posts: 98
Joined: 27 Feb 2012, 23:55
Location: Canada

Re: Neater Package Management

Post#19 by edge226 » 12 Aug 2012, 06:56

Uncommented and unfinished but this was the code thus far.

Code: Select all

#!/bin/bash

storage=$(grep -A1 "STORAGE:" /etc/ppm/porteus.conf | tail -1);
name=$(ls $storage/"$1"*);
ldd $(lsxzm "$name") 2>/dev/null | grep '=>';
The plan afterwards was to finish the parse and then do a lsxzm of each module within the modules folder and do checks on them, and also checks on whether any of the dependencies would be orphaned with the removal of the base module, otherwise the module would be kept.

@brokenman you are much more skilled at such tasks, if you are going to add it into your library I will leave it to you ;).

rodyaj
White ninja
White ninja
Posts: 16
Joined: 06 Jul 2012, 23:56
Location: Liverpool

Re: Neater Package Management

Post#20 by rodyaj » 16 Aug 2012, 20:33

About clutter in the porteus/modules directory: I keep all my modules in folders e.g., mpd + all its deps. I assumed it would be easier to selectively backup this way e.g., saving bandwidth backing up to cloud storage. One thing I like about having folders is that I can see clearly which app needs which dependency. I suppose, alternatively, I could just find or make a script that generates a tree of dependencies. Is there one floating about? Then I wouldn't need folders to help me visualise any more, and I could just switch to merged modules.

I'm weary of merging the modules together, however, as I'm not sure if I'd be able to get them back out again to resolve dependency conflicts. Edit: just found out extpkg and rempkg can help me do that.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5503
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Neater Package Management

Post#21 by brokenman » 17 Aug 2012, 01:00

There is also an old script /opt/porteus-scripts/act that will allow you to activate all the modules in one folder which would work well in your setup.

Code: Select all

act /path/to/folder/with/modules/to/activate
It was written a long time ago but still remains useful.
How do i become super user?
Wear your underpants on the outside and put on a cape.

rodyaj
White ninja
White ninja
Posts: 16
Joined: 06 Jul 2012, 23:56
Location: Liverpool

Re: Neater Package Management

Post#22 by rodyaj » 17 Aug 2012, 01:13

brokenman wrote:There is also an old script /opt/porteus-scripts/act that will allow you to activate all the modules in one folder which would work well in your setup.

Code: Select all

act /path/to/folder/with/modules/to/activate
It was written a long time ago but still remains useful.
I tried out 'activate *' the other day and it seemed to work ok. Although I'm not sure if sometimes modules need to be loaded in a certain order.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5503
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Neater Package Management

Post#23 by brokenman » 17 Aug 2012, 13:08

I should have been clearer. When you first run act it asks you where your storage folder is. After this you just need to run: act office- and all modules that have office- at the start will be activated. If there is a folder called office, then all modules in that folder will be activated. Just a small time saver.

Most times the order of activation during run time is not important.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
bigbass
Contributor
Contributor
Posts: 151
Joined: 13 Jan 2012, 14:35
Distribution: slackware 14

Re: Neater Package Management

Post#24 by bigbass » 05 Nov 2012, 01:03

This is an old post but I posted some code in this thread that I have since updated

just to start off clearly PPM will handle over 90% of a typical users needs
and is well organized and well written a fine job (I dont want to leave any room for misunderstandings )

there are some special uses when out of repo use is needed
a command line tool could be helpful and slackyd is very powerful and also works well
but since its compiled in c its more work hacking it

I added to the mix my own version for personal use too (written in bash)
to resolve package names and here is a dev tool only
command line what if X isnt running ?

its call depinstalled UPDATED it checks the installed packages
downloads the official slackware 13.37 MANIFEST and gets the package name for the missing
dependencies its not for the typical user but if you have used slackware for years this will be helpful
a hard copy is kept for dependencies
no magic but its what I use to solve problems with packages manually
and will be useful if modified for slackware 14 development of porteus 2
the mods are already included in the source code

Joe

Code: Select all

#!/bin/bash 

   
# call this depinstalled and make it executable 
# depinstalled version 5.0 preset for slackware 13.37

# Joe Arose aka..big_bass
# slim and powerful and very fast should be able to use on any slackware derivative
# this is just the dependency checker routine stand alone
# command line version for non X
# it also gives you the package name for the missing dependency
# in a text file 

#  if you want to use slackware 14  use this instead 
# cd /tmp && wget http://mirrors.dotsrc.org/slackware/slackware-14.0/slackware/MANIFEST.bz2

#  maybe you want to use slacky but slackware official wont get detected
#cd /tmp && wget  http://www.slackware.org.uk/slacky/slackware-14.0/MANIFEST.bz2



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/lib/pkgtool/needed_packages 
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
:>/tmp/missing_libs2.txt  
:>/tmp/missing_libs3.txt 


# check if file is there this is preset for slackware 13.37
		if !  [ -s /tmp/MANIFEST.bz2  ];then     
		
		    echo ""
		    echo "--------------WARNING FILE NEEDED -------------------------------"
			echo "You must download the MANIFEST.bz2 for your installed version and place it in /tmp"
		    echo "http://mirrors.dotsrc.org/slackware/slackware-13.37/slackware/MANIFEST.bz2"
		    echo " ****** Will try and do it for you  re run the app  if no internet connection *******"
		    cd /tmp && wget  http://mirrors.dotsrc.org/slackware/slackware-13.37/slackware/MANIFEST.bz2
		    
		fi   




#---------------------------------------
# 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   /;p' > $PKG_MANAGEMENT/temporary_list2
touch $PKG_MANAGEMENT/temporary_list2
cat $PKG_MANAGEMENT/temporary_list2


# Prompt user to input a partial package name
echo -e '\E[1;33;44m'"Search for a package just the simple partial name no version number or hyphens "
read SEARCH_STRING
echo "----------"
echo ""
clear


# look for the short name 
egrep "$SEARCH_STRING" $PKG_MANAGEMENT/temporary_list2


# the short list name may have several hits from whats installled
# we get a choice here to select just one package to seach deps for 
echo ""
echo " "
echo -e '\E[1;33;44m'"Enter one full package name from the above list copy and paste works then press enter "
echo ""
read PKGNAME


echo ""
echo $PKGNAME  >$PKG_MANAGEMENT/return2
echo ""

#  We have to get some info from the installed package mostly installed ELF binaries
# 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 for :"


   # 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 "$MISSING_LIBS"  >> /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      
   
      rm -f  /var/lib/pkgtool/dependencies/$PKGNAME"-filtering.txt"  ## clean up the extra unfilted file created
   
      done
      
      

   # check if file is there
   if  [ -s /tmp/missing_libs2.txt ];then      
    
    # fix multiples on one line using a new line instead of a space  and sort 
    cat /tmp/missing_libs2.txt| tr -s ' ' '\n' | sort -u >/tmp/missing_libs3.txt
    # get the packages that contain the missing dependencies 
   
    # here is the tricky part where we use a varible for the missing depencency
    # then search the MANIFEST and give a name to the dependency file 
    # and inside the file is the needed package name to fill the dependency
    
    
    
    
			# Thanks Tomas M for the this awk snippet I modified for a variable input '$dep'
			for dep in  `cat /tmp/missing_libs3.txt`    
				do	
					bzcat /tmp/MANIFEST.bz2 | awk '/Package:/ {pkg=$3} /'$dep'/ {print pkg}' | sort -u >  /var/lib/pkgtool/needed_packages/$dep"-belongs_to.txt"
			done   
			
			# append missing libs 
			echo "has these missing library files:" >> /var/lib/pkgtool/dependencies/$PKGNAME"-depends.txt"
			cat /tmp/missing_libs3.txt| sort -u >> /var/lib/pkgtool/dependencies/$PKGNAME"-depends.txt"
		
			
			
		
	
   fi
   
   

#----------------------------------------
# generate cli view
#----------------------------------------

#make the package selected to view a string value called RETURN2
RETURN2=`cat $PKG_MANAGEMENT/return2`

cat /var/lib/pkgtool/dependencies/$RETURN2-depends.txt

echo ""


echo "______missing below this line ________"
cat /tmp/missing_libs3.txt| sort -u 
 


echo -e '\E[1;37;44m'"A copy of the dependency list was made here  /var/lib/pkgtool/dependencies\033 "

echo -e '\E[1;37;44m'"A copy of the missing lib and package if applied was made here  /var/lib/pkgtool/needed_packages\033 "

echo ""
echo ""

# make a pause then reset the terminal colors 
read -p "press ENTER to continue: and reset the terminal colors" NADA
setterm -reset






Post Reply