#!/bin/sh REPO=/var/lib/sbopkg/slackbuilds QUEUEDIR=/var/lib/sbopkg/queues APP=$1 TMP=deps.tmp TMP2=deps.tmp2 CATEGORY=$(pwd | rev | cut -d'/' -f1 | rev) QUEUE=$CATEGORY.sqf LIST=$CATEGORY.lst DEPS=$CATEGORY.deps echo -n > $TMP echo -n > $TMP2 echo -n > $DEPS caps() { res=$(echo $1 | tr [a-z] [A-Z]) } checkinstalled() { let found=0 for p in $(ls /var/log/packages/ | grep $1) do caps $1 newdep=$res caps $(echo $p | cut -d'/' -f4 | rev | cut -d- -f4- | rev) inst=$res if [ "$newdep" = "$inst" ]; then let found=1 break fi done } getdeps() { result=$(grep REQUIRES $REPO/*/$1/$1.info | cut -d'"' -f2 | sed 's/\ /\n/g') if [ -n "$result" ]; then for dep in $result do checkinstalled $dep if [ $found -eq 0 ]; then if [ -n "$(grep -x $CATEGORY/$dep $DEPS)" ]; then sed -i "/$CATEGORY\/$dep/d" $DEPS fi if [ "$dep" = "%README%" ]; then echo "README found in $1 REQUIRES" echo "press enter when ready to contine" read else echo $dep | tee -a $TMP echo $CATEGORY/$dep >> $DEPS getdeps $dep fi fi done fi } for pkg in `cat $LIST | sed 's/\/$//g; s/^.*\///g'` do checkinstalled $pkg if [ $found -eq 0 ]; then echo $pkg >> $TMP getdeps $pkg fi done if [ -r $TMP ]; then tac $TMP > $TMP2 sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P' $TMP2 > $QUEUE rm -f $TMP $TMP2 cp $QUEUE $QUEUEDIR fi