summaryrefslogtreecommitdiffstats
path: root/core/alpine-baselayout/mdev-usbdisk.patch
blob: cfa0331fabb72b3db7dcac54df29af56e44f692a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
commit 9542c009af40331e8770256148aa13075f4d8294
Author: Natanael Copa <ncopa@alpinelinux.org>
Date:   Thu Jun 4 14:11:43 2009 +0000

    mdev: look for FAT in device to create usbdisk link
    
    it seems like mkfs.vfat creates MBR signature

diff --git a/mdev.conf b/mdev.conf
index 3e2339b..6ee65a2 100644
--- a/mdev.conf
+++ b/mdev.conf
@@ -27,7 +27,7 @@ ptmx	root:tty 0666
 # ram.*
 ram([0-9]*)	root:disk 0660 >rd/%1
 loop([0-9]+)	root:disk 0660 >loop/
-sd[a-z]1	root:disk 0660 */lib/mdev/usbdisk_link
+sd[a-z].*	root:disk 0660 */lib/mdev/usbdisk_link
 hd[a-z][0-9]*	root:disk 0660 */lib/mdev/ide_links
 md[0-9]		root:disk 0660
 
diff --git a/usbdisk_link b/usbdisk_link
index 6acaad3..750242b 100644
--- a/usbdisk_link
+++ b/usbdisk_link
@@ -14,8 +14,8 @@ if [ -e /sys/block/$MDEV ]; then
 	# if /sys device path contains '/usb[0-9]' then we assume its usb
 	# also, if its an usb without partitions we require FAT
 	if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
-		# do not create link if there is an MBR signature
-		dd if=/dev/$MDEV bs=1 count=2 skip=510 2>/dev/null | hexdump | grep aa55 >/dev/null && exit 0
+		# do not create link if there is not FAT
+		dd if=/dev/$MDEV bs=512 count=1 2>/dev/null | strings | grep FAT >/dev/null || exit 0
 
 		ln -sf $MDEV usbdisk
 		# keep this for compat. people have it in fstab