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