11.11Stsutsui# $NetBSD: dot.profile,v 1.11 2022/08/28 12:44:01 tsutsui 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.8Scgd#          This product includes software developed for the
181.9Ssalo#          NetBSD Project.  See http://www.NetBSD.org/ for
191.8Scgd#          information about NetBSD.
201.1Sis# 4. The name of the author may not be used to endorse or promote products
211.8Scgd#    derived from this software without specific prior written permission.
221.8Scgd# 
231.1Sis# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Sis# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Sis# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Sis# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Sis# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Sis# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
291.1Sis# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Sis# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Sis# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Sis# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.8Scgd# 
341.8Scgd# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
351.1Sis
361.1SisPATH=/sbin:/bin:/usr/bin:/usr/sbin:/
371.1Sisexport PATH
381.1SisTERM=vt220
391.1Sisexport TERM
401.4SperryHOME=/
411.4Sperryexport HOME
421.1Sis
431.1Sisumask 022
441.1Sis
451.1Sisif [ "X${DONEPROFILE}" = "X" ]; then
461.1Sis	DONEPROFILE=YES
471.5Scgd	export DONEPROFILE
481.1Sis
491.1Sis	# set up some sane defaults
501.2Smhitch	echo 'erase ^?, werase ^W, kill ^U, intr ^C'
511.2Smhitch	stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
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.10Smlelstv			_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.11Stsutsui		if [ -z "$_ans" ] || [ "$_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