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

Re: trouble with /sbin/termwrap



On Wed, May 23, 2001 at 07:43:15PM +0100, Richard Hirst wrote:
> 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?

Thanks for all the explanation.  The following patch should
implement the above, though you will probably have to manually
move termwrap into scripts/rootdisk/prototype/sbin/.  If someone
could test this out and verify that it works, I'll commit it.

Matt

Index: scripts/rootdisk/prototype/sbin/termwrap
===================================================================
RCS file: termwrap
diff -N termwrap
--- /dev/null	Sun Nov 12 00:28:38 2000
+++ termwrap	Wed May 23 12:18:42 2001
@@ -0,0 +1,98 @@
+#!/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 $@
Index: utilities/dbootstrap/extract_base.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/extract_base.c,v
retrieving revision 1.34
diff -u -r1.34 extract_base.c
--- utilities/dbootstrap/extract_base.c	2001/05/15 06:47:13	1.34
+++ utilities/dbootstrap/extract_base.c	2001/05/23 19:18:42
@@ -371,6 +371,9 @@
   }
   sprintf(prtbuf,"cp %s %s","/etc/inittab.install","/target/etc/inittab"); 
   execlog(prtbuf, LOG_INFO);
+
+  sprintf(prtbuf, "cp %s %s", "/sbin/termwrap", "/target/sbin/termwrap");
+  execlog(prtbuf, LOG_INFO);
   
   sync();
   return 0;



Reply to: