summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authoralm <alm@FreeBSD.org>1993-09-21 10:24:42 +0000
committeralm <alm@FreeBSD.org>1993-09-21 10:24:42 +0000
commit4687ff86f64aa5260e2581d2f5be3c0e6fdd9254 (patch)
treedd61d78c8a550721042aec3b755885452881c0f5 /etc
parent73223741a7aa9220ec138a54e5f4f40fc5074c87 (diff)
downloadFreeBSD-src-4687ff86f64aa5260e2581d2f5be3c0e6fdd9254.zip
FreeBSD-src-4687ff86f64aa5260e2581d2f5be3c0e6fdd9254.tar.gz
Extended load_fd() to support reading from the first Primary DOS
partition of the boot disk. So we have yet another medium via which to load the FreeBSD distribution files. load_fd() has options for listing and (if reading from the C: drive) changing directories. load_fd's notation assumes that the first Primary partition on disk is the DOS drive C: (since this and only this one is mounted by install). Otherwise, the notation may be a bit confusing. We'll know the assumption is bad if people complain about not finding files on their "C:" drive... Added a device file existence check to kc.profile.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/etc.i386/inst1.install53
-rw-r--r--etc/etc.i386/inst2.profile160
-rw-r--r--etc/etc.i386/kc.profile36
3 files changed, 166 insertions, 83 deletions
diff --git a/etc/etc.i386/inst1.install b/etc/etc.i386/inst1.install
index 007098f..15a86e2 100755
--- a/etc/etc.i386/inst1.install
+++ b/etc/etc.i386/inst1.install
@@ -674,7 +674,6 @@ while :; do
break
fi
done
-echo
swap_offset=`expr $root_offset + $root`
part_used=`expr $part_used + $swap`
echo "" >/etc/disktab
@@ -720,12 +719,11 @@ while [ $part_used -lt $partition ]; do
echo -n "On which directory should this filesystem be mounted? [usr] "
read resp junk
part_name=${resp:-usr}
- part_name=`expr "$part_name" : '/*\(.*\)'`
+ part_name=`expr X"$part_name" : 'X/*\(.*\)'`
done
break
fi
done
- echo
if [ ! "$ename" ]; then
ename=$part_name
offset=`expr $part_offset + $root + $swap`
@@ -749,21 +747,33 @@ while [ $part_used -lt $partition ]; do
part_used=partition
fi
done
-if [ "$have_dos_part" -a ! "$hname" ]; then
- part_name=""
- echo "There appears to be a MS-DOS filesystem on disk."
- while [ "$part_name" = "" ]; do
- echo -n "On which directory should this filesystem be mounted? [dos] "
- read resp junk
- part_name=${resp:-dos}
- part_name=`expr "$part_name" : '/*\(.*\)'`
- done
- hname=$part_name
- eval offset=\$start${have_dos_part}
- eval part_size=\$size${have_dos_part}
- echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
- echo ":th=MSDOS:\\" >>/etc/disktab
- part_used=partition
+if [ "$have_dos_part" != "$opsys_part" -a "$RUN_FDISK" != "overwrite" -a \
+ ! "$hname" ]; then
+ echo
+ echo "There appears to be a MS-DOS filesystem on the hard disk."
+ echo -n "Make this be accessible from ${OPSYSTEM}? [y] "
+ read resp junk
+ case "${resp:-y}" in
+ y*|Y*)
+ part_name=""
+ while [ "$part_name" = "" ]; do
+ echo
+ echo -n "On which directory should this filesystem be mounted? [dos] "
+ read resp junk
+ part_name=${resp:-dos}
+ part_name=`expr X"$part_name" : 'X/*\(.*\)'`
+ done
+ hname=$part_name
+ eval offset=\$start${have_dos_part}
+ eval part_size=\$size${have_dos_part}
+ echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab
+ echo ":th=MSDOS:\\" >>/etc/disktab
+ part_used=partition
+ ;;
+ *)
+ have_dos_part=""
+ ;;
+ esac
else
have_dos_part=""
fi
@@ -943,7 +953,7 @@ echo "export TERM"
echo "mount -at ufs"
echo "echo"
echo "echo \"Insert cpio installation floppy in drive and\""
-echo "echo -n \"enter that drive's number (e.g. 0 or 1): [0] \""
+echo "echo -n \"enter that drive's number (0 or 1): [0] \""
echo "read resp junk"
echo "driveno=\${resp:-0}"
echo "mount -o ro /dev/fd\${driveno}a /mnt"
@@ -957,9 +967,8 @@ echo "read resp junk"
echo "case \"\$resp\" in"
echo "y*|Y*)"
echo " echo"
-echo " echo \"Remove cpio installation floppy from drive.\""
-echo " echo \"Insert third installation (dos) floppy and\""
-echo " echo -n \"enter that drive's number (e.g. 0 or 1): [0] \""
+echo " echo \"Remove cpio floppy from drive, insert dos floppy, and\""
+echo " echo -n \"enter that drive's number (0 or 1): [0] \""
echo " read resp junk"
echo " driveno=\${resp:-0}"
echo " mount -t pcfs -o ro /dev/fd\${driveno}a /mnt"
diff --git a/etc/etc.i386/inst2.profile b/etc/etc.i386/inst2.profile
index 9f57008..35c4372 100644
--- a/etc/etc.i386/inst2.profile
+++ b/etc/etc.i386/inst2.profile
@@ -97,18 +97,15 @@ umask 0
set_tmp_dir()
{
def_tmp_dir=`pwd`
- if [ "$def_tmp_dir" = "/" ]; then
- def_tmp_dir=/usr/distrib
- fi
- echo -n "what dir should be used for temporary files? [$def_tmp_dir] "
+ [ "$def_tmp_dir" = "/" ] && def_tmp_dir=/usr/distrib
+ echo -n "Copy files to which directory? [${def_tmp_dir}] "
read tmp_dir
- if [ "$tmp_dir" = "" ]; then
- tmp_dir=$def_tmp_dir
- fi
+ [ ! "$tmp_dir" ] && tmp_dir=$def_tmp_dir
if [ ! -d "$tmp_dir" ]; then
/bin/rm -rf $tmp_dir
mkdir -p $tmp_dir
fi
+ echo
}
tmp_dir()
{
@@ -122,11 +119,11 @@ load_fd()
tmp_dir
drive=
altdrive=
+ subdir=
while [ -z "$drive" ]; do
- echo -n "Read from which floppy drive? (? for help) [a] "
+ echo -n "Read from which drive (a, b, c or ? for help)? [c] "
read answer junk
- [ ! "$answer" ] && answer=a
- case "$answer" in
+ case "${answer:-c}" in
a*b|A*B)
drive=A; altdrive=B
;;
@@ -139,6 +136,32 @@ load_fd()
b*|B*)
drive=B; altdrive=B
;;
+ c*|C*)
+ while read data; do
+ msdos_device=`expr X"$data" : 'X[ ]*\([^ ]*\)[^M]*pcfs'`
+ msdos_dir=`expr X"$data" : 'X[ ]*[^ ]*[ ]*\([^ ]*\)'`
+ [ "${msdos_device}" ] && break
+ done </etc/fstab
+ if [ ! "$msdos_device" ]; then
+ echo
+ echo "Cannot find MS-DOS in filesystem table"
+ continue
+ fi
+ drive=C; altdrive=C
+ while :; do
+ echo
+ echo -n "Read from which MS-DOS drive C: directory? [/] "
+ read resp junk
+ newdir=$(echo "${resp:-/}" | \
+ awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
+ if [ -d ${msdos_dir}/${newdir} ]; then
+ subdir=$newdir
+ break
+ else
+ echo "C:/${newdir}: No such directory"
+ fi
+ done
+ ;;
q*|Q*)
drive=q
;;
@@ -148,6 +171,7 @@ load_fd()
echo "------ ---"
echo " a Read from floppy drive A:"
echo " b Read from floppy drive B:"
+ echo " c Read from MS-DOS hard drive C:"
echo " ab Alternate between A: and B:, starting with A:"
echo " ba Alternate between A: and B:, starting with B:"
echo " q Quit"
@@ -157,75 +181,127 @@ load_fd()
done
verbose=-v
interactive=-i
- dir=/tmp/floppy
- umount $dir >/dev/null 2>&1
- rm -f $dir
- mkdir -p $dir
+ if [ "$drive" = "C" ]; then
+ dir=${msdos_dir}
+ elif [ "$drive" != "q" ]; then
+ dir=/tmp/floppy
+ [ -d $dir ] && umount $dir >/dev/null 2>&1
+ [ -f $dir ] && rm -f $dir
+ mkdir -p $dir
+ fi
while [ "$drive" != "q" ]
do
device=/dev/fd0a
[ "$drive" = "B" ] && device=/dev/fd1a
- echo; echo "Insert floppy in drive $drive: and press RETURN,"
- echo -n "or enter option (? for help): "
+ [ "$drive" = "C" ] && device=${msdos_device}
+ echo;
+ if [ "$drive" != "C" ]; then
+ echo "Insert floppy in drive $drive:, then press RETURN to copy files,"
+ echo -n "or enter option (? for help): "
+ else
+ echo -n "Press RETURN to copy files, or enter option (? for help): "
+ fi
read answer junk
- [ ! "$answer" ] && answer=c
- case "$answer" in
- c*|C*)
- if mount -t pcfs $verbose $device $dir; then
+ case "${answer:-g}" in
+ c*|C*)
+ if [ "$drive" != "C" ]; then
+ echo "Cannot change directory: not reading from MS-DOS drive C:"
+ else
+ echo
+ echo -n "Read from which MS-DOS drive C: directory? [/${subdir}] "
+ read resp junk
+ [ ! "$resp" ] && resp="/$subdir"
+ absolute=`expr X"$resp" : 'X[Cc]*:*\([/\]\)'`
+ subsub=$(echo "${resp}" | \
+ awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
+ if [ "$absolute" -o ! "$subdir" ]; then
+ newsub=$subsub
+ else
+ newsub=$subdir/$subsub
+ fi
+ if [ -d ${dir}/${newsub} ]; then
+ subdir=$newsub
+ else
+ echo "C:/${newsub}: No such directory"
+ fi
+ fi
+ ;;
+ g*|G*)
+ sync
+ if [ "$drive" = "C" ]; then
+ [ "$verbose" ] &&
+ { echo; echo "Please wait. Copying files from MS-DOS C:/${subdir}"; }
+ cp ${msdos_dir}/${subdir}/* .
+ sync
+ elif mount -t pcfs $verbose $device $dir; then
[ "$verbose" ] &&
- echo "Please wait. Copying to disk..."
+ { echo; echo "Please wait. Copying files to disk..."; }
cp $interactive $dir/* .
sync
umount $dir
tmp=$drive; drive=$altdrive; altdrive=$tmp
fi
;;
- o*|O*)
- tmp=$drive; drive=$altdrive; altdrive=$tmp
- ;;
- v*|V*)
- tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
- tmp=on; [ -z "$verbose" ] && tmp=off
- echo "verbose mode is $tmp"
- ;;
i*|I*)
tmp=$interactive; interactive=; [ -z "$tmp" ] && interactive=-i
tmp=on; [ -z "$interactive" ] && tmp=off
echo "interactive mode is $tmp"
;;
+ l*|L*)
+ sync
+ [ "$verbose" ] && echo "Directory of ${drive}:/${subdir}"
+ if [ "$drive" = "C" ]; then
+ ls -l $dir/${subdir}
+ else
+ umount $dir >/dev/null 2>&1
+ if mount -t pcfs $device $dir; then
+ ls -l $dir/${subdir}
+ umount $dir
+ fi
+ fi
+ ;;
+ o*|O*)
+ tmp=$drive; drive=$altdrive; altdrive=$tmp
+ ;;
+ q*|Q*)
+ drive=q
+ ;;
s*|S*)
echo; echo -n "tmp_dir is set to $tmp_dir"
[ "$tmp_dir" != "`pwd`" ] && echo -n " (physically `pwd`)"
- echo; echo "free space in tmp_dir:"
+ echo; echo "Free space in tmp_dir:"
df -k .
- echo -n "you are loading from drive $drive:"
+ echo -n "Reading from drive $drive:"
[ "$drive" != "$altdrive" ] && echo -n " and drive $altdrive:"
echo
tmp=on; [ -z "$verbose" ] && tmp=off
- echo "verbose mode is $tmp"
+ echo "Verbose mode is $tmp"
tmp=on; [ -z "$interactive" ] && tmp=off
- echo "interactive mode is $tmp"
+ echo "Interactive mode is $tmp"
;;
- q*|Q*)
- drive=q
+ v*|V*)
+ tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
+ tmp=on; [ -z "$verbose" ] && tmp=off
+ echo "verbose mode is $tmp"
;;
\?)
echo
echo "Enter: To:"
echo "----- ---"
- echo "(just RETURN) Copy the contents of the floppy to $tmp_dir"
- [ "$drive" != "$altdrive" ] &&
- echo " o Read from alternate drive"
- echo " v Toggle verbose mode"
+ echo "(just RETURN) Copy files from ${drive}:/${subdir} to $tmp_dir"
+ echo " c Change directory of MS-DOS drive C:"
echo " i Toggle interactive mode (cp -i)"
- echo " s Display status"
+ echo " l List directory of current drive"
+ echo " o Read from alternate floppy drive"
echo " q Quit"
+ echo " s Show status"
+ echo " v Toggle verbose mode"
echo
;;
esac
done
- echo goodbye.
- unset verbose answer drive altdrive device dir tmp interactive
+ echo "Working directory: `pwd`"
+ unset verbose answer drive altdrive device dir subdir tmp interactive
}
load_qic_tape()
{
diff --git a/etc/etc.i386/kc.profile b/etc/etc.i386/kc.profile
index 48fa53e..298ec56 100644
--- a/etc/etc.i386/kc.profile
+++ b/etc/etc.i386/kc.profile
@@ -5,13 +5,15 @@
PATH=/bin:/sbin
export PATH
-#test=echo
-
reboot_it() {
echo ""
echo "halting the machine..."
- ${test} halt
+ halt
+ sync
+ sync
+ echo "Halt failed! Try power-cycling the machine..."
+ exit 1
}
bail_out() {
@@ -31,54 +33,50 @@ echo -n "kc> "
read todo
-if [ "$todo"X = copyX ]; then
+if [ X"$todo" = Xcopy ]; then
echo ""
echo "what disk partition should the kernel be installed on?"
echo "(e.g. "wd0a", "sd0a", etc.)"
echo ""
echo -n "copy kernel to> "
-
- read diskpart
-
+ while :; do
+ read diskpart junk
+ [ -c /dev/r$diskpart ] && break
+ echo "$diskpart: invalid partition"
+ echo
+ echo -n "copy kernel to> "
+ done
echo ""
echo "checking the filesystem on $diskpart..."
-
- ${test} fsck -y /dev/r$diskpart
+ fsck -y /dev/r$diskpart
if [ $? -ne 0 ]; then
echo ""
echo "fsck failed... sorry, can't copy kernel..."
bail_out
fi
-
echo ""
echo "mounting $diskpart on /mnt..."
-
- ${test} mount /dev/$diskpart /mnt
+ mount /dev/$diskpart /mnt
if [ $? -ne 0 ]; then
echo ""
echo "mount failed... sorry, can't copy kernel..."
bail_out
fi
-
echo ""
echo "copying kernel..."
-
- ${test} cp /386bsd /mnt/386bsd
+ cp /386bsd /mnt/386bsd
if [ $? -ne 0 ]; then
echo ""
echo "copy failed... (?!?!?!)"
bail_out
fi
-
echo ""
echo "unmounting $diskpart..."
-
- ${test} umount /mnt > /dev/null 2>&1
+ umount /mnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo ""
echo "unmount failed... shouldn't be a problem..."
fi
-
bail_out
fi
OpenPOWER on IntegriCloud