istoreos: update blockmount
fix usb conflict reduce block info call
This commit is contained in:
parent
1dd3f20b77
commit
80a48e90c0
@ -76,7 +76,13 @@ EOF
|
||||
|
||||
scan_all() {
|
||||
local line
|
||||
block info | while read; do
|
||||
local dev
|
||||
|
||||
if [ "$DETECT" = "0" -a -n "$DEVNAME" ]; then
|
||||
dev="/dev/$DEVNAME"
|
||||
fi
|
||||
|
||||
block info $dev | while read; do
|
||||
line="$REPLY"
|
||||
eval "${line##*: } handle_part ${line%%: *}"
|
||||
done
|
||||
@ -88,7 +94,7 @@ if [ "$1" = "detect" ]; then
|
||||
config global
|
||||
option anon_swap '0'
|
||||
option anon_mount '0'
|
||||
option port_mount '0'
|
||||
option port_mount '0'
|
||||
option auto_swap '1'
|
||||
option auto_mount '1'
|
||||
option delay_root '5'
|
||||
|
||||
@ -3,22 +3,14 @@
|
||||
DEVNAME=${1#/dev/}
|
||||
[ -z "$DEVNAME" ] && exit 1
|
||||
|
||||
getusb() {
|
||||
if [ "$2" = "1" ]; then
|
||||
echo "/$1/"
|
||||
return 0
|
||||
fi
|
||||
echo "/$1_$2/"
|
||||
}
|
||||
|
||||
getdisk() {
|
||||
local DISK=$1
|
||||
local path=`readlink /sys/block/$DISK`
|
||||
local usb=`echo "$path" | grep -oE '/usb[0-9]+/'`
|
||||
local usb=`echo "$path" | grep -oE '/usb\d+/[^:]+'`
|
||||
if [ -n "$usb" ]; then
|
||||
usb=${usb#/}
|
||||
usb=${usb%/}
|
||||
getusb `echo "$path" | grep -oE "/$usb/${usb#usb}-[0-9]+/" | sed -r "s#^/($usb)/${usb#usb}-([0-9]+)/\\\$#\\1 \\2#g"`
|
||||
usb=${usb##*/}
|
||||
usb=${usb%%-1}
|
||||
echo usb`echo "$usb" | sed 's/[-.]/_/g'`
|
||||
return 0
|
||||
fi
|
||||
case "$DISK" in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user