11.9Stsutsui# $NetBSD: dot.profile,v 1.9 2022/08/20 20:50:41 tsutsui Exp $
21.1Sleo#
31.1Sleo# Copyright (c) 1995 Jason R. Thorpe
41.1Sleo# Copyright (c) 1994 Christopher G. Demetriou
51.1Sleo# All rights reserved.
61.1Sleo# 
71.1Sleo# Redistribution and use in source and binary forms, with or without
81.1Sleo# modification, are permitted provided that the following conditions
91.1Sleo# are met:
101.1Sleo# 1. Redistributions of source code must retain the above copyright
111.1Sleo#    notice, this list of conditions and the following disclaimer.
121.1Sleo# 2. Redistributions in binary form must reproduce the above copyright
131.1Sleo#    notice, this list of conditions and the following disclaimer in the
141.1Sleo#    documentation and/or other materials provided with the distribution.
151.1Sleo# 3. All advertising materials mentioning features or use of this software
161.1Sleo#    must display the following acknowledgement:
171.1Sleo#          This product includes software developed for the
181.2Ssalo#          NetBSD Project.  See http://www.NetBSD.org/ for
191.1Sleo#          information about NetBSD.
201.1Sleo# 4. The name of the author may not be used to endorse or promote products
211.1Sleo#    derived from this software without specific prior written permission.
221.1Sleo# 
231.1Sleo# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Sleo# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Sleo# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Sleo# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Sleo# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Sleo# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
291.1Sleo# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Sleo# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Sleo# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Sleo# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.1Sleo# 
341.1Sleo# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
351.1Sleo
361.1SleoPATH=/sbin:/bin:/usr/bin:/usr/sbin:/
371.1Sleoexport PATH
381.1SleoTERM=vt220
391.1Sleoexport TERM
401.1SleoHOME=/
411.1Sleoexport HOME
421.1SleoOBLOCKSIZE=1k
431.1Sleoexport BLOCKSIZE
441.1SleoEDITOR=ed
451.1Sleoexport EDITOR
461.1Sleo
471.1Sleoumask 022
481.1Sleo
491.5Stsutsuimount_gemdos() mount_msdos -G "$@"
501.5Stsutsui
511.1Sleomakerootwritable() {
521.7Stsutsui	rootdev=/kern/rootdev
531.4Stsutsui	if ! mount -u $rootdev / ; then
541.4Stsutsui	    echo "Unable to mount $rootdev read-write"
551.4Stsutsui	    exit 1
561.1Sleo	fi
571.4Stsutsui	echo "Mounted $rootdev read-write"
581.1Sleo}
591.1Sleo
601.1Sleoif [ "X${DONEPROFILE}" = "X" ]; then
611.1Sleo	DONEPROFILE=YES
621.1Sleo	export DONEPROFILE
631.1Sleo
641.1Sleo	# set up some sane defaults
651.1Sleo	echo 'erase ^H, werase ^W, kill ^U, intr ^C'
661.1Sleo	stty newcrt werase ^W intr ^C kill ^U erase ^H 9600
671.1Sleo
681.7Stsutsui	# mount the kernfs so that we can check rootdev etc.
691.7Stsutsui	mount -t kernfs /kern /kern
701.7Stsutsui
711.1Sleo	# mount root read write
721.1Sleo	makerootwritable
731.1Sleo
741.1Sleo	# If supported: Select a keyboard map
751.1Sleo	/usr/sbin/loadkmap > /dev/null 2>&1
761.1Sleo	if [ $? -eq 0 ]; then
771.1Sleo		_maps=`ls /usr/share/keymaps/atari | sed 's/\.map//g'`
781.1Sleo	fi
791.1Sleo	while [ ! -z "$_maps" ]; do
801.1Sleo		echo "The available keyboard maps are:"
811.1Sleo		_num=0
821.1Sleo		for i in $_maps; do
831.1Sleo			echo "	$_num  $i"
841.6Stsutsui			_num=$(( $_num + 1 ))
851.1Sleo		done
861.1Sleo		echo
871.1Sleo		echo -n "Select the number of the map you want to activate: "
881.1Sleo		read _ans
891.1Sleo
901.1Sleo		# Delete all non-nummeric characters from the users answer
911.1Sleo		if [ ! -z "$_ans" ]; then
921.3Sabs			_ans=`echo $_ans | sed 's/[^0-9]//g'`
931.1Sleo		fi
941.1Sleo
951.1Sleo		# Check if the answer is valid (in range). Note that an answer
961.1Sleo		# < 0 cannot happen because the sed(1) above also removes the
971.1Sleo		# sign.
981.9Stsutsui		if [ -z "$_ans" ] || [ "$_ans" -ge $_num ]; then
991.1Sleo		    echo "You entered an invalid response, please try again."
1001.1Sleo		    continue
1011.1Sleo		fi
1021.1Sleo
1031.1Sleo		# Got a valid answer, activate the map...
1041.1Sleo		set -- $_maps
1051.1Sleo		shift $_ans
1061.1Sleo		/usr/sbin/loadkmap -f /usr/share/keymaps/atari/$1.map
1071.1Sleo		break
1081.1Sleo	done
1091.1Sleo
1101.8Smartin	sysinst || stty sane
1111.1Sleofi
112