Author: sparky
Date: Sun Mar 12 01:22:42 2006
New Revision: 7146

Added:
   ppcrcd/trunk/conf.dir/etc/udev/
   ppcrcd/trunk/conf.dir/etc/udev/rules.d/
   ppcrcd/trunk/conf.dir/etc/udev/rules.d/hotplug_disk.rules
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/addpart.sh   (contents, props changed)
Modified:
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
Log:
- udev is smarted than me, use it for partitions detection


Added: ppcrcd/trunk/conf.dir/etc/udev/rules.d/hotplug_disk.rules
==============================================================================
--- (empty file)
+++ ppcrcd/trunk/conf.dir/etc/udev/rules.d/hotplug_disk.rules   Sun Mar 12 
01:22:42 2006
@@ -0,0 +1 @@
+ACTION="add", SUBSYSTEM="block", RUN+="/usr/lib/ppcrcd/addpart.sh"

Added: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/addpart.sh
==============================================================================
--- (empty file)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/addpart.sh     Sun Mar 12 01:22:42 2006
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. /usr/lib/ppcrcd/functions
+
+[ -n "$ID_FS_TYPE" ] || exit 0
+if [ "$ID_FS_TYPE" = "swap" ]; then
+       if [[ -e /tmp/swapon ]]; then
+               echo "$DEVNAME swap swap defaults 0 0" >> /etc/fstab
+               verbose 4 "type: swap (activating)"
+       else
+               echo "#$DEVNAME swap swap defaults 0 0" >> /etc/fstab
+               verbose 4 "type: swap (not activating)"
+       fi
+       exit
+fi
+rcdroot=$(grep /media/ppcrcd /etc/fstab | awk '{print $1}')
+[ "${DEVNAME}" = "$rcdroot" ] && exit
+
+LABEL="$ID_FS_LABEL_SAFE"
+if [ -z "$LABEL" ]; then
+       [ -e /tmp/parts.mac ] || mac-fdisk -l 2>/dev/null \
+               | egrep "^/dev/[a-z]+[0-9]+" > /tmp/parts.mac
+       if egrep -q "^$DEVNAME[         ]" /tmp/parts.mac; then
+               LABEL="$(egrep "^$DEVNAME[   ]" /tmp/parts.mac | awk '{print 
$3}')"
+       else
+               LABEL="$ID_FS_TYPE"
+       fi
+fi
+
+mntdir="/mnt/${DEVNAME##*/}_${LABEL}"
+mkdir -p "$mntdir"
+
+FS_OPTIONS="defaults,noauto,noatime"
+[[ $ID_FS_TYPE == *fat* ]] && FS_OPTIONS="$FS_OPTIONS,exec,showexec"
+
+echo "${DEVNAME} $mntdir ${ID_FS_TYPE} ${FS_OPTIONS} 0 0" >> /etc/fstab
+
+verbose 5 "$mntdir created"

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect      (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect      Sun Mar 12 01:22:42 2006
@@ -46,8 +46,6 @@
        sleep $partwait
 fi
 
-echo -e "\n# autogenerated" >> /etc/fstab
-
 # Searching for cdroms #######################################################
 verbose 2 -B " +-Searching CDROMs"
 cddevs=$(grep /media/ppcrcd /etc/fstab | awk '{print $1}')
@@ -67,131 +65,8 @@
        mkdir -p /media/$(basename $cdrom)
 done
 
-echo >> /etc/fstab
-
 # Searching for partitions ###################################################
-verbose 2 -B " +-Checking partitions"
-
-mac-fdisk -l 2>/dev/null | egrep "^/dev/[a-z]+[0-9]+" > /tmp/parts.mac
-fdisk -l 2>/dev/null | egrep "^/dev/[a-z]+[0-9]+" > /tmp/parts.pc
-
-PARTS=$(echo /dev/hd??* /dev/sd??*)
 cmdopt nomd || \
        PARTS=$(/usr/lib/ppcrcd/find_md $(< /verbose) | sort)
 
-rcdroot=$(grep /media/ppcrcd /etc/fstab | awk '{print $1}')
-for dev in $PARTS; do
-       [ -r $dev ] || continue
-       [ "$rcdroot" == "$dev" ] && continue
-       verbose 4 "    +-Checking $dev"
-       mnt="/mnt/$(basename $dev)"
-       if egrep -q "^$dev[     ]" /tmp/parts.pc; then                  # pc 
partitions
-               verbose 4 -n "       +-PC partition, "
-               type="$(egrep "^$dev[   ]" /tmp/parts.pc | cut -c 56-)"
-               case "$(tl $type)" in
-                       *ext*d*)
-                               mnt=
-                               ;;
-                       *linux*swap)
-                               mnt=
-                               if [[ -e /tmp/swapon ]]; then
-                                       echo "$dev swap swap defaults 0 0" >> 
/etc/fstab
-                                       verbose 4 "type: swap (activating)"
-                               else
-                                       echo "#$dev swap swap defaults 0 0" >> 
/etc/fstab
-                                       verbose 4 "type: swap (not activating)"
-                               fi
-                               ;;
-                       *linux*raid*|*linux*lvm*|*linux*plaintext*)
-                               mnt=
-                               verbose 4 -Y "type: $type (skipping)"
-                               ;;
-                       *linux*)
-                               mnt="${mnt}_linux"
-                               echo "$dev $mnt auto defaults,noauto,noatime 0 
0" >> /etc/fstab
-                               verbose 4 "type: linux"
-                               ;;
-                       *dos*)
-                               mnt="${mnt}_dos"
-                               echo "$dev $mnt msdos,fat,vfat 
user,noauto,umask=002,uid=0,gid=28,exec,showexec 0 0" >> /etc/fstab
-                               verbose 4 "type: dos"
-                               ;;
-                       *fat*)
-                               mnt="${mnt}_fat"
-                               echo "$dev $mnt vfat,fat,msdos 
user,noauto,umask=002,uid=0,gid=28,exec,showexec 0 0" >> /etc/fstab
-                               verbose 4 "type: fat"
-                               ;;
-                       *nfts*)
-                               mnt="${mnt}_ntfs"
-                               echo "$dev $mnt ntfs 
user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
-                               verbose 4 "type: ntfs"
-                               ;;
-                       *hpfs*)
-                               mnt="${mnt}_hpfs"
-                               echo "$dev $mnt hpfs 
user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
-                               verbose 4 "type: hpfs"
-                               ;;
-                       *bsd*)
-                               mnt="${mnt}_bsd"
-                               echo "$dev $mnt ufs 
user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
-                               verbose 4 "type: bsd"
-                               ;;
-                       *minix*)
-                               mnt="${mnt}_minix"
-                               echo "$dev $mnt minix 
user,noauto,umask=002,uid=0,gid=28 0 0" >> /etc/fstab
-                               verbose 4 "type: minix"
-                               ;;
-                       *)
-                               mnt=
-                               verbose 4 -Y "type: unknown"
-                               ;;
-               esac
-       elif egrep -q "^$dev[   ]" /tmp/parts.mac; then                 # mac 
partitions
-               verbose 4 -n "       +-Mac partition, "
-               line="$(egrep "^$dev[   ]" /tmp/parts.mac)"
-               type="$(echo $line | sed 's/^.*)//')"
-               mnt="${mnt}_$(echo $line | awk '{print $3}')"
-               case "$(tl $type)" in
-                       *linux*swap*)
-                               mnt=
-                               if [[ -e /tmp/swapon ]]; then
-                                       echo "$dev swap swap defaults 0 0" >> 
/etc/fstab
-                                       verbose 4 "type: swap (activating)"
-                               else
-                                       echo "#$dev swap swap defaults 0 0" >> 
/etc/fstab
-                                       verbose 4 "type: swap (not activating)"
-                               fi
-                               ;;
-                       *linux*)
-                               echo "$dev $mnt auto defaults,noauto,noatime 0 
0" >> /etc/fstab
-                               verbose 4 "type: linux"
-                               ;;
-                       *bootblock*)
-                               echo "$dev $mnt hfs,hfsplus 
defaults,noauto,noatime 0 0" >> /etc/fstab
-                               verbose 4 "type: bootblock"
-                               ;;
-                       *hfs*)
-                               echo "$dev $mnt hfsplus,hfs 
defaults,noauto,noatime 0 0" >> /etc/fstab
-                               verbose 4 "type: hfs"
-                               ;;
-                       *dos*) #PRODOS - fat ?
-                               echo "$dev $mnt fat,vfat,msdos 
defaults,noauto,noatime 0 0" >> /etc/fstab
-                               verbose 4 "type: dos"
-                               ;;
-                       #MFS - not supported
-                       *)
-                               mnt=
-                               verbose 4 "type: unknown"
-                               ;;
-               esac
-       else
-               mnt=
-               verbose 2 -R "          +-Partition '$dev' has unrecognized 
partition type. BSD slice ?"
-       fi
-       if [ -n "$mnt" ]; then
-               mkdir -p $mnt
-               verbose 3 "          +-Partition '$dev' can be mounted on 
'$mnt'"
-       fi
-done
-
 # vi: ts=4:sw=4
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to