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>
10 EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}
12 # set decent PATH for bug 172969
14 PATH=${EPREFIX}/usr/bin:${EPREFIX}/bin:${PATH}
17 PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
18 [ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="${EPREFIX}/var/log/portage"
19 ELOGDIR="$PORT_LOGDIR/elog"
21 # Verify that ELOGDIR exists
22 if [ ! -d "$ELOGDIR" ]; then
23 echo "ELOG directory: $ELOGDIR does not exist!"
27 # Use the pager from the users environment
28 [ -z "$PAGER" ] && PAGER="less"
30 # Set up select prompt
34 ANY_FILES=$(find . -type f)
35 ANY_FILES=$(echo ${ANY_FILES} | sed -e "s:\./::g")
37 if [[ -z ${ANY_FILES} ]]; then
38 echo "No log items to read"
43 echo "This is a list of portage log items. Choose a number to view that file or type q to quit."
46 # Pick which file to read
47 select FILE in ${ANY_FILES}; do
55 if [ -f "$FILE" ]; then
57 read -p "Delete file? [y/N] " DELETE
67 if [[ ${SUCCESS} = 0 ]]; then
68 echo "Deleted ${FILE}"
70 echo "Unable to delete ${FILE}"
73 # Empty string defaults to N (save file)
78 echo "Invalid response. Saving ${FILE}"
83 echo "Invalid response."
91 pushd ${ELOGDIR} > /dev/null
93 until [[ -n ${QUIT} ]]; do