#!/bin/sh # pkgfscaner.sh # looks if a file in a package exist in the system # yeah i know, it looks ugly.. but seems to make the work # at this moment, any suggestion-idea: hba.nihilismus at gmail.com # installpkg $pkg | pkgfscaner.sh tmpfile='tmpfile' while read input; do inputbuf+="$input\n" done pkglinksin=$(echo -e $inputbuf | \ sed \ -e '/^The following files/,// d' \ -e '/^#### Scanning the contents/,/^locations that you want/ d' \ | sed "s/^ */\//" | sed "s/ \/ //g" | sed '/^$/ d' \ ) pkgfilesin=$(echo -e $inputbuf | \ sed -e '/^#### Scanning the contents/,/^Be sure they/ d' | \ awk '{$1 = ""; $2 = ""; $3 = ""; $4 = ""; $5 = ""; print}' | \ sed 's/^ *install\/.*//' | \ sed -e 's/^ */\//' | sed -e 's/^\/$//' | sed '/^$/ d'\ ) echo -e "$pkglinksin" > $tmpfile echo -e "$pkgfilesin" >> $tmpfile numfiles=$( sed -n '$=' $tmpfile) for i in `seq 1 $numfiles` do file=$(sed -n "$i p" $tmpfile) if [ -e "$file" ]; then echo "$file exists in the system" fi done