Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#377 Multipartition IDE (Improved)

open
nobody
None
5
2005-05-24
2005-05-24
dunsalen
No

This is a working /etc/pcmcia/ide.opts script built to
handle multipartitioned memory cards as well as ones
unpartitioned and mounting without a partition number
such as /dev/hde rather than /dev/hde0

Included here for examination (it's not that big) and
attached for use in an editor

# ATA/IDE drive adapter configuration

# This is sourced first by /etc/pcmcia/ide with three
arguments and
# ACTION=start to get a partition list in the variable
PARTS as a
# space separated list of partition numbers
#
# Subsequent calls provide a four part ADDRESS bearing
the partition
# number as the last argument. Mounting is done by
/etc/pcmcia/ide
#
# The format of ADDRESS was once
scheme,socket,serial_no[,parts]
# but the current function file /etc/pcmcia/shared sets
the third
# parameter to something called NEW_SCHEME, which is
probably empty

# This was entirely rewritten by J.M. Hinkle to
properly accomodate
# multipartition PCMCIA cards

#
# HISTORY:
#
# 24-May-2005 Facility for drives without partitions
# and more adept sed use
# 20-May-2005 Initial version of ide.opts by Joseph
M. Hinkle
#
# $Id: ide.opts,v 1.3 2005/05/24 08:45:50 jmh Exp $
#

case $ACTION in
start)
case $ADDRESS in
*,*,*,*)
# Sourced by add_parts() for each partition to set
options
INFO="ATA/IDE: $PRODID_1"
# DO_FSTAB="y" # Adds an entry for this device in
/etc/fstab
# DO_FSCK="y" # Requests a filesystem check on mounting
# FSTYPE="msdos" # -t option to the mount command;
auto is better
# OPTS="" # -o options to the mount command
DO_MOUNT="y"
MOUNTPT=/mnt/ide/$SOCKET/${ADDRESS##*,}
if [ ! -d $MOUNTPT ]; then mkdir -p $MOUNTPT; fi
# Trick add_parts() into mounting /dev/hde and not
/dev/hde0
if [ $PART == "0" ]; then PART=""; fi
;;
*,*,*)
# Sourced first to obtain a space separated partition
list
# ADDRESS can be scheme,socket or scheme,socket,unknown
SED="sed 's|/dev/$DEVICE\([^ ]*\)[^/]*|\1 |g'"
PARTS=`fdisk -l /dev/$DEVICE | grep ^/dev | grep -iv Ext`
# This should be handled in shared.add_parts()
if [ ! $PARTS ]; then
# Give the loop something to work on
PARTS=0
else
PARTS=`echo $PARTS | eval $SED`
fi
;;
esac
;;
stop)
# umounting is taken care of in /etc/pcmcia/shared
# rm_parts() and rm_blockdev() from /etc/pcmcia/ide
# umounting logical partitions can take as much as a
minute
# but primary partitions are umounted immediately on
some cards
;;
check)
NO_CHECK=no
NO_FUSER=no
;;
esac

Discussion