Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Bash Script] - POO (Port of Origin) aka fun with qpkg!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
vesik
n00b
n00b


Joined: 16 Sep 2002
Posts: 14

PostPosted: Thu Dec 12, 2002 10:24 pm    Post subject: [Bash Script] - POO (Port of Origin) aka fun with qpkg! Reply with quote

hello all,
just thought i would post this ugly little script that i was toying with. it just uses qpkg to locate the package that the input file(s) came from. lol. i'm such a geek, :mrgreen: i was as giddy as a school girl :mrgreen: watching it chug through my /usr/bin. *cough* yes, i do see the sun sometimes!

Code:

poo() {
    local FILEPATH
    echo
    echo -e " \E[1m\E[32mChecking Port of Origin\E[0m"
    for filename in $@
    do
   FILEPATH=""
   if [ -d ${filename} ]; then continue; fi
   if [ -e ${PWD}/${filename} ] && [ -f ${PWD}/${filename} ]
   then   
       FILEPATH="${PWD}/${filename}"
   elif [ -e ${filename#${PWD}/} ] && [ -f ${filename#${PWD}/} ]
   then
       FILEPATH=${filename}
   elif [ -n "$(which ${filename} 2>/dev/null)" ]
   then
       FILEPATH=$(which ${filename} 2>/dev/null)
   else
       echo -e "  \E[34m*\E[1m \E[31m${filename} not found!\E[34m*\E[1m\E[0m"
   fi

   if [ -n "${FILEPATH}" ]
   then
       echo -ne "  \E[34m|\E[0m \E[33m$(basename "${filename}")"
       echo -ne "\E[34m|\E[1m\E[31m <--- \E[0m"
       echo "$(qpkg -f "${FILEPATH}")"
       echo -ne "  \E[34m[ \E[35m${FILEPATH}\E[0m \E[34m]\E[35m   "
       echo -e "$(ls -lh ${FILEPATH} | \
      awk '{ print  $3 ":" $4 "\t" $1 "\t" $6 " " $7 " " $8 }')\E[0m"
   fi
    done
    echo
}


-vesik
ps. stick it in your .bashrc[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum