#!/bin/bash # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 later # $Header: $ . /sbin/functions.sh show_example_disp() { clear cat /etc/profile echo "----------------------------------------" echo "${GOOD}good text (einfo) " echo "${BAD}bad text (eerr) " echo "${WARN}warning text (ewarn) " echo "${NORMAL}normal text " ebegin "ebegin + eend(good)" eend 0 ebegin "ebegin + eend(error)" eend 1 echo "----------------------------------------" } show_menu() { einfo "Usage:" einfo "\tp\t= Show previous font" einfo "\t\t= Show next font" einfo "\ts\t= Save current font to /etc/rc.conf" einfo "\tq\t= Quit" } handle_input() { printf " Command? "; read input case $input in p) let --idx ;; s) ewarn "Backing up /etc/rc.conf to /etc/._cfg1234_rc.conf" cp /etc/rc.conf /etc/._cfg1234_rc.conf sed -e "s:CONSOLEFONT=.*:CONSOLEFONT=\"${f}\":" \ /etc/._cfg1234_rc.conf > /etc/rc.conf einfo "Saved ${f} to /etc/rc.conf" printf "(Press enter to continue)"; read ;; q) exit 0 ;; *) let ++idx ;; esac } input="Y" FONTFILE=/tmp/goodfonts if [ -e ${FONTFILE} ] ; then einfo "Found a list of fonts at ${FONTFILE}" printf " Recreate this file? " read input input="${input/y/Y}" fi if [ "${input}" == "Y" ] ; then for f in `find /usr/share/consolefonts/ -name '*psfu*' -printf '%f '` ; do f="${f:0:${#f}-8}" setfont ${f} show_example_disp einfo "Font == ${f}" printf "Keep Font ? " read input input="${input/y/Y}" [ "${input}" == "Y" ] && echo ${f}>>${FONTFILE} done fi clear declare GOOD_FONTS idx=0 einfo "Reading ${FONTFILE} ..." echo for f in `cat ${FONTFILE}` ; do GOOD_FONTS[$idx]="${f}" let ++idx einfo "Found font ${f}" done MAX_IDX=${idx} echo einfo "Now going through ${MAX_IDX} good fonts ..." read idx=0 while [ ${idx} -lt ${MAX_IDX} ] ; do f=${GOOD_FONTS[${idx}]} #get the font f=${f:0:${#f}-8} #trim .psfu.gz setfont ${f} show_example_disp einfo "You are now viewing font '$f'" show_menu handle_input [ ${idx} -lt 0 ] && idx=0 done