helper/wherefrom.sh

31 lines
916 B
Bash
Executable file

#!/bin/bash
INSTALLED_SETS="$(cut -d\@ -f2 < /var/lib/portage/world_sets)"
echo installed sets: $INSTALLED_SETS
DEFAULT_LOCATION="/etc/portage/sets/"
SET_LOCATIONS="$(grep location -rh /etc/portage/repos.conf | sed -e "s/location = \(.*\)$/\1\/sets/") $DEFAULT_LOCATION"
#echo all setlocations: $SET_LOCATIONS
for location in $SET_LOCATIONS ; do
if [[ ! -d $location ]] ; then continue ; fi
for setlocation in $location/* ; do
# echo testing $setlocation
setname=$(basename $setlocation)
if echo $INSTALLED_SETS | grep -qw $setname ; then
echo installed: $setlocation
INSTALLEDSETLOCATION="${INSTALLEDSETLOCATION} ${setlocation}"
fi
done
done
INSTALLEDSETLOCATION="${INSTALLEDSETLOCATION} /var/lib/portage/world"
echo installed setfiles: $INSTALLEDSETLOCATION
echo
echo
for SET in $INSTALLEDSETLOCATION ; do
#echo looking for $1 in $SET
grep -H $1 $SET | grep -v ":#"
done