#!/bin/sh - # # Copyright (C) 2005 by Oliver Fromme, Munich, Germany # All rights reserved. # Standard BSD 2-clause copyright license and disclaimer applies. # # This tool creates a set of font files for FreeBSD's syscons. # These fonts are basically an ISO8859-15 subset that contains # additional line-drawing characters (so-called ACS characters) # that can be used by curses-based applications like sysinstall # or midnight-commander. # # Simply run this script as root and follow the instructions. # set -e # Exit immediately if anything bad happens. PATH="/bin:/usr/bin:/sbin:/usr/sbin" # Set a sane default path. font_data() { # # WARNING -- Do not change the following table, # unless you know EXACTLY what it means! # cat <<-"tac" l 218 194 upper left corner m 192 195 lower left corner k 191 128 upper right corner j 217 129 lower right corner t 195 217 tee pointing right u 180 130 tee pointing left v 193 218 tee pointing up w 194 219 tee pointing down q 196 213 horizontal line x 179 131 vertical line n 197 202 large plus or crossover ` 4 132 diamond a 176 133 checker board (stipple) f - 176 degree symbol g - 177 plus/minus ~ - 183 bullet , 27 134 arrow pointing left + 26 135 arrow pointing right . 25 136 arrow pointing down - 24 137 arrow pointing up h 177 138 board of squares i - 167 lantern symbol 0 219 221 solid square block y 243 139 less/equal z 242 140 greater/equal { 227 141 Pi } - 163 UK pound sign tac } FONT_DIR="/usr/share/syscons/fonts" if [ ! -f iso15-8x16.fnt ]; then cd $FONT_DIR fi echo "Creating syscons font files ..." for SIZE in 8 14 16; do CP437="cp437-8x$SIZE" ISO15="iso15-8x$SIZE" ACS15="iso-acs-8x$SIZE" DD_ARGS="if=$CP437 of=$ACS15 bs=$SIZE count=1 conv=notrunc" uudecode -p $CP437.fnt > $CP437 uudecode -p $ISO15.fnt > $ACS15 font_data | while read SYM SRC DST COMMENT; do if [ -n "$SRC" -a ".$SRC" != ".-" -a -n "$DST" ]; then dd $DD_ARGS skip=$SRC seek=$DST 2>/dev/null fi done uuencode $ACS15 $ACS15 > $ACS15.fnt echo " - $FONT_DIR/$ACS15.fnt" rm $CP437 $ACS15 done echo "Done." echo "Loading new fonts ..." echo " (To do this permanently, please modify /etc/rc.con.)" for SIZE in 8 14 16; do vidcontrol -f iso-acs-8x$SIZE < /dev/ttyv0 done echo "Done." echo "Modifying cons25l1 termcap entry ..." echo " (To undo this, type 'make' in /usr/src/share/termcap.)" TC_ENTRY=$( font_data | awk ' BEGIN { printf "%s\n", "cons25l1|cons25-iso8859-1:\\" printf "\t%s", ":ac=" } /[0-9]/{ printf "%s\\%03o", $1, $3 } END { printf "%s\n", ":\\" printf "\t%s\n", ":tc=cons25w:" } ' ) TC_DIR=/usr/share/misc ( sed '/^cons25l1|/,$d' $TC_DIR/termcap echo "$TC_ENTRY" sed '1,/^cons25l1|/d' $TC_DIR/termcap | sed '1,/:tc=/d' ) > $TC_DIR/termcap.new mv -f $TC_DIR/termcap.new $TC_DIR/termcap echo "Done." echo "Rebuilding termcap.db file ..." cd $TC_DIR cap_mkdb termcap echo "Done." if [ $(egrep -c '^ttyv.*cons[0-9]+l1' /etc/ttys) -lt 1 ]; then echo "" echo "IMPORTANT: You must edit your /etc/ttys file to specify the type ''cons25l1''" echo "as the terminal type for the ttyvX lines. That's twenty-five lowercase-L one," echo "*NOT* twenty-five eleven. Type ''kill -HUP 1'' after changing /etc/ttys." fi echo "" echo "NOTE: You have to logout and login again for all changes to take effect." echo "" #--