summaryrefslogtreecommitdiff
path: root/recipes-core/udev/udev-extraconf/mount.patch
blob: 1b475f39ac612b1888b6e001647dbaac4cb85e05 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff -Naru orig/mount.blacklist new/mount.blacklist
--- orig/mount.blacklist	2019-10-24 17:08:59.796796272 -0500
+++ new/mount.blacklist	2019-10-24 17:16:31.768782892 -0500
@@ -3,3 +3,16 @@
 /dev/mtdblock
 /dev/md
 /dev/dm-*
+# These should all be mounted in fstab or not at all.
+[PARTLABEL=uboot]
+[PARTLABEL=root]
+[PARTLABEL=root1]
+[PARTLABEL=root2]
+[PARTLABEL=uboot]
+[PARTLABEL=oem]
+[PARTLABEL=oem1]
+[PARTLABEL=oem2]
+[PARTLABEL=config]
+[PARTLABEL=config1]
+[PARTLABEL=config2]
+[PARTLABEL=user_data]
diff -Naru orig/mount.sh new/mount.sh
--- orig/mount.sh	2019-10-24 17:09:11.344795931 -0500
+++ new/mount.sh	2019-10-24 18:11:38.612684994 -0500
@@ -25,9 +25,32 @@
 fi
 
 PMOUNT="/usr/bin/pmount"
-
-for line in `grep -h -v ^# /etc/udev/mount.blacklist /etc/udev/mount.blacklist.d/*`
+for line in `grep -h -v '^#$' /etc/udev/mount.blacklist /etc/udev/mount.blacklist.d/* 2>/dev/null`
 do
+	if [[ $line =~ ^\[([^=]*)=([^\]]*)\] ]] ; then
+	    fsspectype=${BASH_REMATCH[1]}
+	    tmp="$(lsblk -o $fsspectype $DEVNAME | sed -e '1d')"
+	    case $fsspectype in
+		PARTLABEL)
+		    if [[ ${BASH_REMATCH[2]} == $tmp ]] ; then
+			logger "udev/mount.sh $DEVNAME is blacklisted, ignoring"
+			logger "$line"
+			exit 0
+		    fi
+		    ;;
+
+		PARTUUID)
+		    if [[ ${BASH_REMATCH[2]^^} == $tmp ]] ; then
+			logger "udev/mount.sh $DEVNAME is blacklisted, ignoring"
+			logger "$line"
+			exit 0
+		    fi
+		    ;;
+                *)
+                    logger "[$fsspectype] is unsupported in blacklist -- ignoring blacklist item"
+                    ;;
+	    esac
+	fi
 	if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
 	then
 		logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
@@ -49,6 +72,10 @@
 
     [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
 
+    if [ "$name" = mmcblk0p1 ] ; then
+        ln -sf /run/media/$name /run/media/card
+    fi
+    
     MOUNT="$MOUNT -o silent"
 
     # If filesystemtype is vfat, change the ownership group to 'disk', and
@@ -78,7 +105,11 @@
 	if [ -x "$PMOUNT" ]; then
 		$PMOUNT $DEVNAME 2> /dev/null
 	elif [ -x $MOUNT ]; then
+	    if [[ $ID_FS_TYPE =~ fat ]] ; then
+		$MOUNT -o umask=002,gid=disk $DEVNAME 2> /dev/null
+	    else
 		$MOUNT $DEVNAME 2> /dev/null
+	    fi
 	fi
 
 	# If the device isn't mounted at this point, it isn't