Code: Select all
esearch -e sylpheed-claws
[ U] sylpheed-claws (0.9.7): Bleeding edge version of Sylpheed
Portage [1] sylpheed-claws-0.9.5-r1
Portage [2] sylpheed-claws-0.9.7
Portage [3] sylpheed-claws-0.9.8
Overlay [4] sylpheed-claws-0.9.5-r2
Show Ebuild:
[/NOTE]
Often I would like to have a fast look in a ebuild. So I have created a short script, called ecat, that is doing this.
Now I must only write
Code: Select all
ecat sylpheed-clawsCode: Select all
evim sylpheed-claws
The last stable version is:
[ U] sylpheed-claws (0.9.7): Bleeding edge version of Sylpheed
Choose a ebuild...:
[ 1 ] sylpheed-claws-0.9.5-r1
[ 2 ] sylpheed-claws-0.9.7
[ 3 ] sylpheed-claws-0.9.8
[ 4 O] sylpheed-claws-0.9.5-r2
...by entering a number:
NOTE: You must have emerged esearch
Code: Select all
#!/bin/bash
# here you can put an editor of your choice, if you
# don't want to use the global $EDITOR
LOCAL_EDITOR=""
if [ "$LOCAL_EDITOR" ]; then
ECAT="$LOCAL_EDITOR"
elif [ "$EDITOR" ]; then
ECAT="$EDITOR"
else
ECAT="cat"
fi
PORTDIR="/usr/portage"
#Looks for ${PORTDIR} and ${PORTDIR_OVERLAY}
source /etc/make.conf
#Set up colors
NO="\x1b[0;0m"
BR="\x1b[0;01m"
CY="\x1b[36;01m"
GR="\x1b[32;01m"
#Use ${PORTDIR} if it exists
if [ -d ${PORTDIR}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'` ]; then
edir=${PORTDIR}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'`
fi
#Use ${PORTDIR_OVERLAY} if it exists, too.
if [ -d ${PORTDIR_OVERLAY}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'` ]; then
edir_overlay=${PORTDIR_OVERLAY}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'`
fi
echo -e $GR"The last stable version is:"$NO
echo " "`esearch -c ^$1\$`
echo " "
echo -e $GR"Choose a ebuild...:"$NO
#List the ebuilds. Ebuilds, that are in ${PORTDIR_OVERLAY} are listen at
#the end with a O next to their number
declare -a ebuild
for i in `ls $edir | awk '/ebuild$/ { print }'`;do
z=$[$z+1]
echo -e "["$CY $z $NO"] "$BR $i $NO | sed 's/\.ebuild//g'
ebuild[$z]=$i
done
for i in `ls $edir_overlay | awk '/ebuild$/ { print }'`; do
z=$[$z+1]
echo -e "["$CY $z" O"$NO"] "$BR $i $NO | sed 's/\.ebuild//g'
ebuild[$z]=$i
done
echo -ne $GR"...by entering a number: "$NO
read number
if [ $number ]; then
echo " "
echo " * * * "$ECAT" "${ebuild[$number]}" * * *"
echo " "
if [ -e $edir/${ebuild[$number]} ]; then
$ECAT $edir/${ebuild[$number]} #| less
else
$ECAT $edir_overlay/${ebuild[$number]} #| less
fi
fi
Changelog
2003-10-03 if you press enter instead of a number, you are leaving the script
2003-10-21 change the editor choosing dialog
2004-01-21 now overlay works correct and I have change the EDITOR dialog again





