[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trouble with /sbin/termwrap



On Wed, May 23, 2001 at 01:52:25PM -0400, Joey Hess wrote:
> konstantin cherkasoff wrote:
> > What is "/sbin/termwrap" and where is it?
> 
> Sigh, something needs to be done about this. Does anyone at all:
> 
> a) know what termwrap does

Seems to set up env variables, does special stuff for japanese
fonts, etc.

> b) know where the code to it went

See below.

> c) want to package it up, and maintain the package

It's just a shell script, could it not be added in to something else?
It is referenced from inittab.install, part of boot-floppies, so
maybe dbootstrap could copy it in to /target/sbin when it copies
inittab.install in?

Richard


#!/bin/sh
######################################################################
##	Ignore some signals.
######################################################################
trap fail SIGTERM SIGINT

######################################################################
##	Set some environment variables.
######################################################################
# reads /etc/environment.
test -f /etc/environment && . /etc/environment

# Set all locale related environment variables.
LC_ALL=$LANG
export LANG LC_ALL

######################################################################
##	Display usage if no argument.
######################################################################
if [ -z "$1" ]; then
	echo "usage: $0 [-nnt] <command> [...]"
	echo "-nnt: don't run another terminal"
	exit 0
fi

######################################################################
##	Recognize terminal type.
######################################################################
case `/usr/bin/tty` in
/dev/tty|/dev/console|/dev/tty[1-9]*)
	TERMINAL=console
	;;
/dev/tty[p-za-e]*)
	TERMINAL=pseudo
	if [ ! -z "$DISPLAY" ]; then
		TERMINAL=x
	else
		case $TERM in
		rxvt|xterm*|kterm)	TERMINAL=x;;
		esac
	fi
	;;
/dev/tty[A-Z]*|/dev/cu*)
	TERMINAL=serial
	;;
esac

case $TERM in
dumb)	TERMINAL=dumb
esac

export TERMINAL

# Why don't we use dpkg-architecture? 
# Because it isn't in the base archive.

case $HOSTTYPE in 
i386)	/bin/grep -q 9800 /proc/version && SUBARCH=pc9800 ;;
esac

######################################################################
##	Select suitable terminal as wrapper.
######################################################################
WRAPPER=""

case $LANG in
ja*)	
	case $TERMINAL in
	x)
		#WRAPPER="/usr/X11R6/bin/kterm -e"
		WRAPPER="/usr/X11R6/bin/krxvt -e"
		;;
	console)
		if [ "$SUBARCH" != pc9800 -a "$TERMINAL" = console ]; then
			# Any plathome except PC9800 require jfbterm
			# to display japanese fonts on console.
			WRAPPER="/usr/bin/jfbterm -e"
		fi
		;;
	# On pseudo and serial, we couldn't know
	# that terminal can display japanese fonts...
	esac
	;;
esac

if [ "$1" = "-nnt" ]; then
	WRAPPER=""
	shift
fi

######################################################################
##	Execute Wrapper.
######################################################################
if [ ! -z "$WRAPPER" -a -x "$WRAPPER" ]; then
	$WRAPPER /bin/true && exec $WRAPPER $@
fi

exec $@



Reply to: