dot.profile revision 1.6
11.6Stsutsui# $NetBSD: dot.profile,v 1.6 2017/11/15 16:19:19 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.4Stsutsui	# note, only handles up to partition 'j'
531.4Stsutsui	rootdev=/dev/$(sysctl -n kern.root_device)$(sysctl -n kern.root_partition | sed y/0123456789/abcdefghij/)
541.4Stsutsui	if ! mount -u $rootdev / ; then
551.4Stsutsui	    echo "Unable to mount $rootdev read-write"
561.4Stsutsui	    exit 1
571.1Sleo	fi
581.4Stsutsui	echo "Mounted $rootdev read-write"
591.1Sleo}
601.1Sleo
611.1Sleoif [ "X${DONEPROFILE}" = "X" ]; then
621.1Sleo	DONEPROFILE=YES
631.1Sleo	export DONEPROFILE
641.1Sleo
651.1Sleo	# set up some sane defaults
661.1Sleo	echo 'erase ^H, werase ^W, kill ^U, intr ^C'
671.1Sleo	stty newcrt werase ^W intr ^C kill ^U erase ^H 9600
681.1Sleo
691.1Sleo	# mount root read write
701.1Sleo	makerootwritable
711.1Sleo
721.1Sleo	# If supported: Select a keyboard map
731.1Sleo	/usr/sbin/loadkmap > /dev/null 2>&1
741.1Sleo	if [ $? -eq 0 ]; then
751.1Sleo		_maps=`ls /usr/share/keymaps/atari | sed 's/\.map//g'`
761.1Sleo	fi
771.1Sleo	while [ ! -z "$_maps" ]; do
781.1Sleo		echo "The available keyboard maps are:"
791.1Sleo		_num=0
801.1Sleo		for i in $_maps; do
811.1Sleo			echo "	$_num  $i"
821.6Stsutsui			_num=$(( $_num + 1 ))
831.1Sleo		done
841.1Sleo		echo
851.1Sleo		echo -n "Select the number of the map you want to activate: "
861.1Sleo		read _ans
871.1Sleo
881.1Sleo		# Delete all non-nummeric characters from the users answer
891.1Sleo		if [ ! -z "$_ans" ]; then
901.3Sabs			_ans=`echo $_ans | sed 's/[^0-9]//g'`
911.1Sleo		fi
921.1Sleo
931.1Sleo		# Check if the answer is valid (in range). Note that an answer
941.1Sleo		# < 0 cannot happen because the sed(1) above also removes the
951.1Sleo		# sign.
961.1Sleo		if [ -z "$_ans" -o "$_ans" -ge $_num ]; then
971.1Sleo		    echo "You entered an invalid response, please try again."
981.1Sleo		    continue
991.1Sleo		fi
1001.1Sleo
1011.1Sleo		# Got a valid answer, activate the map...
1021.1Sleo		set -- $_maps
1031.1Sleo		shift $_ans
1041.1Sleo		/usr/sbin/loadkmap -f /usr/share/keymaps/atari/$1.map
1051.1Sleo		break
1061.1Sleo	done
1071.1Sleo
1081.3Sabs	sysinst
1091.1Sleofi
110