vanhofen
4 years ago
1 changed files with 19 additions and 9 deletions
@ -1,16 +1,26 @@ |
|||
#!/bin/sh |
|||
if grep -q mmcblk1 /proc/cmdline |
|||
then |
|||
search=/sys/block/mmcblk1/mmcblk1p* |
|||
else |
|||
search=/sys/block/mmcblk0/mmcblk0p* |
|||
fi |
|||
for i in $search; |
|||
function search { |
|||
for i in $1; |
|||
do |
|||
if [ "$i" != "$search" ]; then |
|||
if [ "$i" != "$1" ]; then |
|||
partname=`cat /$i/uevent | grep PARTNAME | cut -d '=' -f 2` |
|||
devname=`cat /$i/uevent | grep DEVNAME | cut -d '=' -f 2` |
|||
mkdir -p /dev/block/by-name/ |
|||
ln -sf /dev/$devname /dev/block/by-name/$partname |
|||
if [ ! -e /dev/block/by-name/$partname ]; then |
|||
ln -sf /dev/$devname /dev/block/by-name/$partname |
|||
else |
|||
ln -sf /dev/$devname /dev/block/by-name/$partname-$devname |
|||
fi |
|||
fi |
|||
done |
|||
} |
|||
|
|||
if [ -d "/sys/block/mmcblk0" ]; then |
|||
search "/sys/block/mmcblk0/mmcblk0p*" |
|||
fi |
|||
if [ -d "/sys/block/mmcblk1" ]; then |
|||
search "/sys/block/mmcblk1/mmcblk1p*" |
|||
fi |
|||
if [ -d "/sys/block/sda" ]; then |
|||
search "/sys/block/sda/sda*" |
|||
fi |
|||
|
Loading…
Reference in new issue