dot.profile revision 1.3
11.3Sis#	$NetBSD: dot.profile,v 1.3 1997/11/21 21:16:42 is 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.1Sis
381.1Sisumask 022
391.1Sis
401.1Sisif [ "X${DONEPROFILE}" = "X" ]; then
411.1Sis	DONEPROFILE=YES
421.1Sis
431.1Sis	# set up some sane defaults
441.2Smhitch	echo 'erase ^?, werase ^W, kill ^U, intr ^C'
451.2Smhitch	stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
461.1Sis
471.1Sis	# run update, so that installed software is written as it goes.
481.1Sis	update
491.1Sis
501.1Sis	# Select a keyboard map
511.1Sis	_maps=`ls /usr/share/keymaps/amiga | sed 's/\.map//g'`
521.1Sis	while [ ! -z "$_maps" ]; do
531.1Sis		echo "The available keyboard maps are:"
541.1Sis		_num=0
551.1Sis		for i in $_maps; do
561.1Sis			echo "	$_num  $i"
571.1Sis			_num=`expr $_num + 1`
581.1Sis		done
591.1Sis		echo
601.1Sis		echo -n "Select the number of the map you want to activate: "
611.1Sis		read _ans
621.1Sis
631.1Sis		# Delete all non-nummeric characters from the users answer
641.1Sis		if [ ! -z "$_ans" ]; then
651.1Sis			_ans=`echo $_ans | sed 's/[^0-9]//g`
661.1Sis		fi
671.1Sis
681.1Sis		# Check if the answer is valid (in range). Note that an answer
691.1Sis		# < 0 cannot happen because the sed(1) above also removes the
701.1Sis		# sign.
711.1Sis		if [ -z "$_ans" -o "$_ans" -ge $_num ]; then
721.1Sis		    echo "You entered an invalid response, please try again."
731.1Sis		    continue
741.1Sis		fi
751.1Sis
761.1Sis		# Got a valid answer, activate the map...
771.1Sis		set -- $_maps
781.1Sis		shift $_ans
791.3Sis		export __keymap__=/usr/share/keymaps/amiga/$1.map
801.3Sis		/usr/sbin/loadkmap ${__keymap__}
811.1Sis		break
821.1Sis	done
831.1Sis
841.1Sis	# Installing or upgrading?
851.1Sis	_forceloop=""
861.1Sis	while [ "X${_forceloop}" = X"" ]; do
871.1Sis		echo -n '(I)nstall or (U)pgrade? '
881.1Sis		read _forceloop
891.1Sis		case "$_forceloop" in
901.1Sis			i*|I*)
911.1Sis				/install
921.1Sis				;;
931.1Sis
941.1Sis			u*|U*)
951.1Sis				/upgrade
961.1Sis				;;
971.1Sis
981.1Sis			*)
991.1Sis				_forceloop=""
1001.1Sis				;;
1011.1Sis		esac
1021.1Sis	done
1031.1Sisfi
104