2 # Copyright 2004 Feuz Stefan.
3 # Copyright 2007 Adam Tkac.
4 # This file is part of mtools.
6 # Mtools is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Mtools is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Mtools. If not, see <http://www.gnu.org/licenses/>.
19 # amuFormat.sh Formats various types and sizes of PC-Cards, according to the
22 # parameters: $1: Card Type: The Card Type is written as disk/volume-label
24 # The string should have a length of max. 11 characters.
26 # $2: Drive character (b:, c:)
28 # 10-12-2003 lct created
32 #echo "debug: $0,$1,$2,$3,$4"
37 if [ $# -ne 2 ] ; then
38 echo "Usage: amuFormat.sh <Card Type> <drive>" >&2
39 echo "<Card Type> has to be defined in amuFormat.sh itself" >&2
40 echo "<drive> has to be defined in mtools.conf" >&2
44 echo "amuFormat $vers started..."
50 ## using the f: or g: drive for fat12 formatting...
51 ## see mtools.conf file...
55 *) echo "Drive $2 not supported."; exit 1 ;;
57 cylinders=245 heads=2 cluster_size=8
60 #from amu_toolkit_0_6:
61 #mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 -N0000 c:
62 cylinders=489 heads=4 cluster_size=4
65 echo "***** WARNING: untested on AvHMU, exiting *****"
67 cylinders=245 heads=2 cluster_size=8
70 # from amu_toolkit_0_6:
71 #mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD -M512 -N 0000 c:
72 echo "***** WARNING: untested on AvHMU *****"
73 cylinders=2327 heads=16 cluster_size=64
76 # from amu_toolkit_0_6:
77 #mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD -M512 -N 0000 c:
78 cylinders=489 heads=8 cluster_size=4
81 # insert new cards here...
84 echo "Card not supported."
89 echo "Formatting card in slot $2 as $1"
91 ## initialise partition table
92 mpartition -I "$drive"
94 # write a partition table
95 mpartition -c -t$cylinders -h$heads -s32 -b32 "$drive"
97 ## write boot-record, two FATs and a root-directory
98 mformat -c$cluster_size -v "$1" "$drive"