How to check & install missing deps (by Shador)

Post Reply
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

How to check & install missing deps (by Shador)

Post by zAchAry »

salix@chat.meticul.eu wrote:(10:41:20 PM) zachary: shador: this script is only checking for new/missing deps, it won't install them automatically, am I right?
(10:41:49 PM) shador: yes, it will
(10:41:55 PM) shador: but it runs slapt-get with --prompt
(10:42:03 PM) shador: so you can choose
You neither need sh, nor bash -x. Especially the second is only for debugging purpose. Unless you feel like reading a lot. If you 'chmod +x' the script, you need neither of "sh", "bash", ... either. That's what the first line is for.

Code: Select all

sh <path to script>

Code: Select all

bash -x <path to script>
The script:

Code: Select all

#!/bin/sh

unset TMP new newpkgs line

quit() {
    rm -rf $TMP
    exit $@
}

trap 'echo "Killed by signal"; quit 2' INT TERM
TMP=`mktemp -d` || quit 1

# list of installed, (still) available pkgs
LANG=C slapt-get --available | grep 'inst=yes' | awk '{ print $1 }' >$TMP/reinst

if egrep -q '^ *$' $TMP/reinst; then
    echo "Nothing to install"
    quit
fi

# missing deps will be listed as new pkgs
LANG=C slapt-get -s --reinstall -i $(cat $TMP/reinst) >$TMP/sget || quit 1

# extract new pkgs
while read line; do
    if [ "x$new" == "xtrue" ]; then 
        newpkgs="$newpkgs$line "
    fi
    if [ "x$line" != "xThe following packages will be upgraded:" ]; then
        new="false"
    fi
    if [ "x$line" == "xThe following NEW packages will be installed:" ]; then
        new="true"
    fi
done <$TMP/sget

if echo "$newpkgs" | egrep -q '^ *$'; then
    echo "Nothing to install"
    quit
fi

# install new pkgs (i.e. missing deps)
slapt-get -p -i $newpkgs || quit 1

quit
Image
Help to make Slackware easier Donate to Salix
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to check & install missing deps (by Shador)

Post by damNageHack »

What about using depcheck or in other words: Why do you not use depcheck?
Please consult the manpage if this tool can do what you want by using the options.
gapan is maintaining depcheck as I can see from the SLKBUILD.
I used that tool in past also for accomplishing some missing dependencies.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: How to check & install missing deps (by Shador)

Post by Shador »

It doesn't check all packages installed on the system for missing dependencies, does it?
Image
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to check & install missing deps (by Shador)

Post by damNageHack »

Shador wrote:It doesn't check all packages installed on the system for missing dependencies, does it?
No, i do not think this is actually possible. But it would probably be able if it is called for each package individually.
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: How to check & install missing deps (by Shador)

Post by zAchAry »

Related: pkgdepcheck.py - script to find deps of a new package http://salixos.org/forum/viewtopic.php?f=22&t=3856
Image
Help to make Slackware easier Donate to Salix
Post Reply