in the end script has been completely rewriten

This commit is contained in:
Adam Tkac 2007-05-11 16:18:38 +00:00
parent 5e2a2f649d
commit 48d00b2bc6
3 changed files with 97 additions and 130 deletions

90
amuFormat.sh Executable file
View File

@ -0,0 +1,90 @@
#!/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."

View File

@ -1,127 +0,0 @@
--- mtools-3.9.10/scripts/amuFormat.sh.sh 2007-05-11 10:33:36.000000000 +0200
+++ mtools-3.9.10/scripts/amuFormat.sh 2007-05-11 10:46:55.000000000 +0200
@@ -1,4 +1,4 @@
-#!/bin/csh
+#!/bin/bash
#
# amuFormat.sh Formats various types and sizes of PC-Cards, according to the
# AMU-specification
@@ -11,9 +11,8 @@
#
# 10-12-2003 lct created
#
-set vers=1.4
-set fdrive="f:"
-
+vers=1.4
+fdrive="f:"
#echo "debug: $0,$1,$2,$3,$4"
@@ -22,28 +21,29 @@ set fdrive="f:"
#
echo "amuFormat $vers started..."
-if ( $#argv == 0 ) then
- echo "Usage: amuFormat.sh <Card Type> <drive>"
- echo "<Card Type> has to be defined in amuFormat.sh itself"
- echo "<drive> has to be defined in mtools.conf"
- echo ""
- exit 0
-endif
+if [ $# -eq 0 ] ; 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 "Formatting card in slot $2 as $1"
-if ( $1 == "8MBCARD-FW" ) then
+if [ "x$1" == "x8MBCARD-FW" ] ; then
## determine formatting drive
- if ( ($2 == "b:") || ($2 == "B:") ) then
- set fdrive = "f:"
- else if ( ($2 == "c:") || ($2 == "C:" ) ) then
- set fdrive = "g:"
+ if [ ( "x$2" == "xb:") || ( "x$2" == "xB:") ] ; then
+ fdrive="f:"
+ elif [ ( "x$2" == "xc:") || ( "x$2" == "xC:" ) ] ; then
+ fdrive="g:"
else
echo "Drive $2 not supported."
exit 1
- endif
+ fi
## initialise partition table
mpartition -I $fdrive
@@ -61,9 +61,9 @@ if ( $1 == "8MBCARD-FW" ) then
echo "done."
exit 0
-endif
+fi
-if ( $1 == "32MBCARD-FW" ) then
+if [ "x$1" == "x32MBCARD-FW" ] ; then
#from amu_toolkit_0_6: mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 -N0000 c:
@@ -82,9 +82,9 @@ if ( $1 == "32MBCARD-FW" ) then
echo "done."
exit 0
-endif
+fi
-if ( $1 == "64MBCARD-FW" ) then
+if [ "x$1" == "x64MBCARD-FW" ] ; then
echo "***** WARNING: untested on AvHMU, exiting *****"
exit 0
@@ -105,10 +105,10 @@ if ( $1 == "64MBCARD-FW" ) then
exit 0
-endif
+fi
-if ( $1 == "1GBCARD-FW" ) then
+if [ "x$1" == "x1GBCARD-FW" ] ; then
# from amu_toolkit_0_6: mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD -M512 -N 0000 c:
@@ -130,9 +130,9 @@ if ( $1 == "1GBCARD-FW" ) then
exit 0
-endif
+fi
-if ( $1 == "64MBCARDSAN" ) then
+if [ "x$1" == "x64MBCARDSAN" ] ; then
# from amu_toolkit_0_6: mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD -M512 -N 0000 c:
@@ -152,7 +152,7 @@ if ( $1 == "64MBCARDSAN" ) then
exit 0
-endif
+fi
#
# insert new cards here...
@@ -160,5 +160,3 @@ endif
echo "Card not supported."
exit 1
-
-

View File

@ -1,10 +1,11 @@
Summary: Programs for accessing MS-DOS disks without mounting the disks
Name: mtools
Version: 3.9.10
Release: 6%{?dist}
Release: 7%{?dist}
License: GPL
Group: Applications/System
Source: http://mtools.linux.lu/mtools-%{version}.tar.bz2
Source1: amuFormat.sh
Url: http://mtools.linux.lu/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: mtools-3.9.6-config.patch
@ -14,7 +15,6 @@ Patch3: mtools-3.9.7-bigdisk.patch
Patch4: mtools-3.9.9-noargs.patch
Patch5: mtools-3.9.9-badc.patch
Patch6: mtools-memset.patch
Patch7: mtools-3.9.10-sh.patch
Requires: info
BuildRequires: texinfo
@ -36,9 +36,10 @@ Mtools should be installed if you need to use MS-DOS disks
%patch4 -p1 -b .noargs
%patch5 -p1 -b .badc
%patch6 -p1 -b .memset
%patch7 -p1 -b .bash
%build
cp -f %{SOURCE1} scripts/
%configure
make %{?_smp_mflags}
@ -72,6 +73,9 @@ fi
%{_infodir}/*
%changelog
* Fri May 11 2007 Adam Tkac <atkac redhat com> 3.9.10-7.fc7
- in the end script has been completely rewriten by <skasal@redhat.com>
* Fri May 11 2007 Adam Tkac <atkac redhat com> 3.9.10-6.fc7
- some minor changes in sh patch (changed sh to bash)