3 # This is a script to read portage log items from einfo, ewarn etc, new in the
6 # Author: Donnie Berkholz <spyderous@gentoo.org>
7 # Updated by: Uwe Klosa <uwe.klosa@gmail.com>
9 # set decent PATH for bug 172969
11 PATH=/usr/bin:/bin:${PATH}
14 PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
15 [ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="/var/log/portage"
16 ELOGDIR="$PORT_LOGDIR/elog"
18 # Verify that ELOGDIR exists
19 if [ ! -d "$ELOGDIR" ]; then
20 echo "ELOG directory: $ELOGDIR does not exist!"
24 # Use the pager from the users environment
25 [ -z "$PAGER" ] && PAGER="less"
27 # Set up select prompt
31 ANY_FILES=$(find . -type f)
32 ANY_FILES=$(echo ${ANY_FILES} | sed -e "s:\./::g")
34 if [[ -z ${ANY_FILES} ]]; then
35 echo "No log items to read"
40 echo "This is a list of portage log items. Choose a number to view that file or type q to quit."
43 # Pick which file to read
44 select FILE in ${ANY_FILES}; do
52 if [ -f "$FILE" ]; then
54 read -p "Delete file? [y/N] " DELETE
64 if [[ ${SUCCESS} = 0 ]]; then
65 echo "Deleted ${FILE}"
67 echo "Unable to delete ${FILE}"
70 # Empty string defaults to N (save file)
75 echo "Invalid response. Saving ${FILE}"
80 echo "Invalid response."
88 pushd ${ELOGDIR} > /dev/null
90 until [[ -n ${QUIT} ]]; do