This is the old SliTaz forum - Please use the main forum.slitaz.org

tazorphan - find orphaned packages similar to deborphan
  • FilouFilou May 2010
    Hi there,

    in order to squeeze Slitaz to the minimum I found it useful to identify packages that are no dependencies and might therefore be removed. Since the (r)depend option of tazpkg comes a bit unhandy I figured out an ash-script that does the job. It's not very performant and there might be more elegant ways to do the job but see it as a start.

    Have fun!

    -=[Filou]=-

    Here's the script:

    #! /bin/ash
    tazpkg list > /var/lib/tazpkg/packages.txt # necessary for 'tazpkg rdepends' command
    ls /var/lib/tazpkg/installed > /tmp/installed.txt # list of installed packages for testing each one
    ACT=`head -n 1 /tmp/installed.txt` # name of the first package in the list (to start with)
    LAST=`tail -n 1 /tmp/installed.txt` # name of the last package in the list
    Pkg=1 # Init the line to read out of package list

    until [ "$ACT" = "$LAST" ] # loop through the package list till last package
    do
    Pkg=$((Pkg+1)) # increment line = package name to read
    Parameter="${Pkg}p" # add a 'p' to the line (e.g. 15p) as sed parameter
    ACT=`sed -ne $Parameter /tmp/installed.txt` # read the name of the actual package to test
    DEPs=`tazpkg rdepends $ACT` # use tazpkg rdepends to test for dependencies
    if [ "$DEPs" = '' ] # if none are reported back
    then
    echo $ACT # echo the name of the package
    fi
    done # and continue the loop
    rm /tmp/installed.txt # remove the package list out of /tmp
  • FilouFilou May 2010
    Since readability is not what I expected the same script without comments:

    #! /bin/ash
    tazpkg list > /var/lib/tazpkg/packages.txt
    ls /var/lib/tazpkg/installed > /tmp/installed.txt
    ACT=`head -n 1 /tmp/installed.txt`
    LAST=`tail -n 1 /tmp/installed.txt`
    Pkg=1

    until [ "$ACT" = "$LAST" ]
    do
    Pkg=$((Pkg+1))
    Parameter="${Pkg}p"
    ACT=`sed -ne $Parameter /tmp/installed.txt`
    DEPs=`tazpkg rdepends $ACT`
    if [ "$DEPs" = '' ]
    then
    echo $ACT
    fi
    done
    rm /tmp/installed.txt

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

SliTaz Social