[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mtools] amuFormat.sh in bash instead csh
From: |
Adam Tkac |
Subject: |
Re: [Mtools] amuFormat.sh in bash instead csh |
Date: |
Mon, 14 May 2007 15:33:07 +0200 |
User-agent: |
Thunderbird 2.0.0.0 (X11/20070419) |
In the end script has been completely rewritten (by Stepan Kasal,
<address@hidden>). Could be POSIX-compatible now.
Regards, -A-
#!/bin/sh
#
# amuFormat.sh Formats various types and sizes of PC-Cards, according to the
# AMU-specification
#
# parameters: $1: Card Type: The Card Type is written as disk/volume-label
# to the boot-record
# The string should have a length of max. 11 characters.
#
# $2: Drive character (b:, c:)
#
# 10-12-2003 lct created
#
vers=1.4
#echo "debug: $0,$1,$2,$3,$4"
#
# main()
#
if [ $# != 2 ] ; then
cat <<-EOF
Usage: amuFormat.sh <Card Type> <drive>
<Card Type> has to be defined in amuFormat.sh itself
<drive> has to be defined in mtools.conf
EOF
exit 0
fi
echo "amuFormat $vers started..."
drive=$2
case $1 in
8MBCARD-FW)
## using the f: or g: drive for fat12 formatting...
## see mtools.conf file...
case $2 in
[bB]:) drive="f:" ;;
[cC]:) drive="g:" ;;
*) echo "Drive $2 not supported."; exit 1 ;;
esac
cylinders=245 heads=2 cluster_size=8
;;
32MBCARD-FW)
#from amu_toolkit_0_6:
#mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 -N0000 c:
cylinders=489 heads=4 cluster_size=4
;;
64MBCARD-FW)
echo "***** WARNING: untested on AvHMU, exiting *****"
exit 1
cylinders=245 heads=2 cluster_size=8
;;
1GBCARD-FW)
# from amu_toolkit_0_6:
#mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD -M512 -N 0000 c:
echo "***** WARNING: untested on AvHMU *****"
cylinders=2327 heads=16 cluster_size=64
;;
64MBCARDSAN)
# from amu_toolkit_0_6:
#mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD -M512 -N 0000 c:
cylinders=489 heads=8 cluster_size=4
;;
#
# insert new cards here...
#
*)
echo "Card not supported."
exit 1
;;
esac
echo "Formatting card in slot $2 as $1"
## initialise partition table
mpartition -I $drive
# write a partition table
mpartition -c -t$cylinders -h$heads -s32 -b32 $drive
## write boot-record, two FATs and a root-directory
mformat -c$cluster_size -v "$1" $drive
minfo $2
mdir $2
echo "done."