dot.profile revision 1.4
11.4Sperry#	$NetBSD: dot.profile,v 1.4 1998/01/09 21:51:32 perry Exp $
21.1Sis#
31.1Sis# Copyright (c) 1995 Jason R. Thorpe
41.1Sis# Copyright (c) 1994 Christopher G. Demetriou
51.1Sis# All rights reserved.
61.1Sis# 
71.1Sis# Redistribution and use in source and binary forms, with or without
81.1Sis# modification, are permitted provided that the following conditions
91.1Sis# are met:
101.1Sis# 1. Redistributions of source code must retain the above copyright
111.1Sis#    notice, this list of conditions and the following disclaimer.
121.1Sis# 2. Redistributions in binary form must reproduce the above copyright
131.1Sis#    notice, this list of conditions and the following disclaimer in the
141.1Sis#    documentation and/or other materials provided with the distribution.
151.1Sis# 3. All advertising materials mentioning features or use of this software
161.1Sis#    must display the following acknowledgement:
171.1Sis#	This product includes software developed by Christopher G. Demetriou.
181.1Sis# 4. The name of the author may not be used to endorse or promote products
191.1Sis#    derived from this software without specific prior written permission
201.1Sis#
211.1Sis# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.1Sis# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.1Sis# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.1Sis# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.1Sis# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.1Sis# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.1Sis# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.1Sis# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.1Sis# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301.1Sis# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Sis#
321.1Sis
331.1SisPATH=/sbin:/bin:/usr/bin:/usr/sbin:/
341.1Sisexport PATH
351.1SisTERM=vt220
361.1Sisexport TERM
371.4SperryHOME=/
381.4Sperryexport HOME
391.1Sis
401.1Sisumask 022
411.1Sis
421.1Sisif [ "X${DONEPROFILE}" = "X" ]; then
431.1Sis	DONEPROFILE=YES
441.1Sis
451.1Sis	# set up some sane defaults
461.2Smhitch	echo 'erase ^?, werase ^W, kill ^U, intr ^C'
471.2Smhitch	stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
481.1Sis
491.1Sis	# run update, so that installed software is written as it goes.
501.1Sis	update
511.1Sis
521.1Sis	# Select a keyboard map
531.1Sis	_maps=`ls /usr/share/keymaps/amiga | sed 's/\.map//g'`
541.1Sis	while [ ! -z "$_maps" ]; do
551.1Sis		echo "The available keyboard maps are:"
561.1Sis		_num=0
571.1Sis		for i in $_maps; do
581.1Sis			echo "	$_num  $i"
591.1Sis			_num=`expr $_num + 1`
601.1Sis		done
611.1Sis		echo
621.1Sis		echo -n "Select the number of the map you want to activate: "
631.1Sis		read _ans
641.1Sis
651.1Sis		# Delete all non-nummeric characters from the users answer
661.1Sis		if [ ! -z "$_ans" ]; then
671.1Sis			_ans=`echo $_ans | sed 's/[^0-9]//g`
681.1Sis		fi
691.1Sis
701.1Sis		# Check if the answer is valid (in range). Note that an answer
711.1Sis		# < 0 cannot happen because the sed(1) above also removes the
721.1Sis		# sign.
731.1Sis		if [ -z "$_ans" -o "$_ans" -ge $_num ]; then
741.1Sis		    echo "You entered an invalid response, please try again."
751.1Sis		    continue
761.1Sis		fi
771.1Sis
781.1Sis		# Got a valid answer, activate the map...
791.1Sis		set -- $_maps
801.1Sis		shift $_ans
811.3Sis		export __keymap__=/usr/share/keymaps/amiga/$1.map
821.3Sis		/usr/sbin/loadkmap ${__keymap__}
831.1Sis		break
841.1Sis	done
851.1Sis
861.1Sis	# Installing or upgrading?
871.1Sis	_forceloop=""
881.1Sis	while [ "X${_forceloop}" = X"" ]; do
891.1Sis		echo -n '(I)nstall or (U)pgrade? '
901.1Sis		read _forceloop
911.1Sis		case "$_forceloop" in
921.1Sis			i*|I*)
931.1Sis				/install
941.1Sis				;;
951.1Sis
961.1Sis			u*|U*)
971.1Sis				/upgrade
981.1Sis				;;
991.1Sis
1001.1Sis			*)
1011.1Sis				_forceloop=""
1021.1Sis				;;
1031.1Sis		esac
1041.1Sis	done
1051.1Sisfi
106