Subject: misc/6879: /root/.termcap file
To: None <>
From: None <>
List: netbsd-bugs
Date: 01/25/1999 23:43:39
>Number:         6879
>Category:       misc
>Synopsis:       /root/.termcap file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 25 21:50:00 1999
>Originator:     Brian Grayson
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        Jan 25, 1999

	On systems where /usr/share is NFS-mounted, running
	single-user means that /usr/share/misc/termcap is not
	available, and thus vi and emacs won't work.  We can put
	a small termcap in root's home directory to hopefully
	allow the use of vi etc.
	Here's a bit of the needed work.  Someone familiar with
	the distribution/release build process can probably
	improve on this.  Also, I do not know what the console
	term types are for many of the archs, so the 'for' list
	needs to be expanded.

1.  Create a script /usr/src/etc/root/gentermcap that generates
the mini-termcap to stdout, using "tset".
#  Generate a miniature termcap, for use as root's .termcap
#  file.  This should have all of the basic console entries for the
#  various architectures.
#  We want to force tgetent() to look in a particular file.  According
#  to the man page, this should do it:
export TERM=totally_bogus
export TERMCAP=bogus_termcap_entry
export TERMPATH=../../share/termcap/termcap.src

version=`grep "^#.*Version" $TERMPATH`

echo "#  The purpose of this file is to provide essential termcap"
echo "#  entries, to be used e.g. when running single-user and the"
echo "#  full termcap database in /usr/share/misc/termcap isn't accessible."
echo "#  "
echo "#  This file was generated on "`date`", using termcap version:"
echo $version

for terms in vt100 vt220 pc3 pcvt25 \
	; do
	#  Ignore first line, and first word of second line.
	#  Note that simply printing $2 won't work, as some
	#  termcap aliases have spaces in their names.
	#  Also, strip leading space from result.
	tset - -S $terms \
		| awk '{ if (NR==2) {$1=""; print $0;}}' \
		| sed -e 's/^ //'

echo "#  Add any local essential terminal entries here, for when "
echo "#  /usr/share/misc/termcap isn't accessible."

2.  Change the Makefile in /usr/src/etc to invoke the script.
--- Makefile.dist	Mon Jan 25 22:49:19 1999
+++ Makefile	Mon Jan 25 23:28:04 1999
@@ -83,7 +83,9 @@
 		    ${DESTDIR}/root/.profile; \
 		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
 		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
-		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
+		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile; \
+		./gentermcap > ${DESTDIR}/root/.termcap)
+		)
 	(cd mtree; ${MAKE} install)
 	(cd namedb; \
 		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \

3.  Add appropriate essential term names for the various ports.

4.  Add /root/.termcap to file lists for distributions.

5.  I'm sure there's more that I am missing...  :)