Trying to avoid race conditions with automounters during and after -plug_test
This commit is contained in:
parent
1efa98ae40
commit
ac018842da
@ -317,6 +317,10 @@ list_long() {
|
|||||||
|
|
||||||
## Trying to find the desired device by watching plug-in effects
|
## Trying to find the desired device by watching plug-in effects
|
||||||
plug_in_watcher() {
|
plug_in_watcher() {
|
||||||
|
# How long to wait for a first device to appear, how long to wait for more
|
||||||
|
wait_span_0=10
|
||||||
|
wait_span_1=5
|
||||||
|
|
||||||
found_devices=
|
found_devices=
|
||||||
echo >&2
|
echo >&2
|
||||||
echo "Caused by option -plug_test: Attempt to find the desired device" >&2
|
echo "Caused by option -plug_test: Attempt to find the desired device" >&2
|
||||||
@ -339,26 +343,23 @@ plug_in_watcher() {
|
|||||||
echo "Step 2:" >&2
|
echo "Step 2:" >&2
|
||||||
echo "Please plug in the desired target device and then press the Enter key." >&2
|
echo "Please plug in the desired target device and then press the Enter key." >&2
|
||||||
read dummy
|
read dummy
|
||||||
echo -n "Waiting up to 10 seconds for a new device to be listed ..." >&2
|
echo -n "Waiting up to $wait_span_0 seconds for a new device to be listed ..." >&2
|
||||||
end_time="$(expr $(date +'%s') + 10)"
|
end_time="$(expr $(date +'%s') + "$wait_span_0")"
|
||||||
while test $(date +'%s') -le "$end_time"
|
while test $(date +'%s') -le "$end_time"
|
||||||
do
|
do
|
||||||
new_device_list=' '$(collect_devices)' '
|
new_device_list=' '$(collect_devices)' '
|
||||||
if test "$old_device_list" = "$new_device_list"
|
for i in $new_device_list
|
||||||
then
|
do
|
||||||
sleep 1
|
if echo "$old_device_list $found_devices " | grep -F -v ' '"$i"' ' >/dev/null
|
||||||
echo -n '.' >&2
|
then
|
||||||
else
|
echo " found: $i" >&2
|
||||||
for i in $new_device_list
|
found_devices="$found_devices $i"
|
||||||
do
|
end_time=$(expr $(date +'%s') + "$wait_span_1")
|
||||||
if echo "$old_device_list" | grep -F -v ' '"$i"' ' >/dev/null
|
echo -n "Now waiting $wait_span_1 seconds to let it settle ..." >&2
|
||||||
then
|
fi
|
||||||
found_devices="$found_devices $i"
|
done
|
||||||
fi
|
sleep 1
|
||||||
# Break the waiting loop
|
echo -n '.' >&2
|
||||||
end_time=0
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
echo >&2
|
echo >&2
|
||||||
if test -z "$found_devices"
|
if test -z "$found_devices"
|
||||||
@ -388,8 +389,6 @@ plug_in_watcher() {
|
|||||||
devs=$(echo -n $found_devices)
|
devs=$(echo -n $found_devices)
|
||||||
echo >&2
|
echo >&2
|
||||||
|
|
||||||
# Give new device a second to settle
|
|
||||||
sleep 1
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,9 @@ Please plug in the desired target device and then press the Enter key.
|
|||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
Waiting up to 10 seconds for a new device to be listed ...
|
Waiting up to 10 seconds for a new device to be listed ... found: sdd
|
||||||
|
.br
|
||||||
|
Now waiting 5 seconds to let it settle .........
|
||||||
.br
|
.br
|
||||||
Found and noted as desired device: sdd
|
Found and noted as desired device: sdd
|
||||||
.br
|
.br
|
||||||
|
@ -188,7 +188,9 @@ Step 2:
|
|||||||
Please plug in the desired target device and then press the Enter key.
|
Please plug in the desired target device and then press the Enter key.
|
||||||
|
|
||||||
|
|
||||||
Waiting up to 10 seconds for a new device to be listed ...
|
Waiting up to 10 seconds for a new device to be listed ... found:
|
||||||
|
sdd
|
||||||
|
Now waiting 5 seconds to let it settle .........
|
||||||
Found and noted as desired device: sdd
|
Found and noted as desired device: sdd
|
||||||
|
|
||||||
|
|
||||||
@ -532,16 +534,16 @@ Node: Simplenames2792
|
|||||||
Node: Listall3516
|
Node: Listall3516
|
||||||
Node: Givendevices5089
|
Node: Givendevices5089
|
||||||
Node: Plugtest6053
|
Node: Plugtest6053
|
||||||
Node: Dowrite7893
|
Node: Dowrite7954
|
||||||
Node: Unwise9008
|
Node: Unwise9069
|
||||||
Node: Reasons10520
|
Node: Reasons10581
|
||||||
Node: Options13101
|
Node: Options13162
|
||||||
Node: Examples15903
|
Node: Examples15964
|
||||||
Node: Files16076
|
Node: Files16137
|
||||||
Node: Seealso16234
|
Node: Seealso16295
|
||||||
Node: Bugreport16400
|
Node: Bugreport16461
|
||||||
Node: Legal16987
|
Node: Legal17048
|
||||||
Node: CommandIdx17691
|
Node: CommandIdx17752
|
||||||
Node: ConceptIdx18811
|
Node: ConceptIdx18872
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
@ -322,7 +322,9 @@ Please plug in the desired target device and then press the Enter key.
|
|||||||
@*
|
@*
|
||||||
|
|
||||||
@*
|
@*
|
||||||
Waiting up to 10 seconds for a new device to be listed ...
|
Waiting up to 10 seconds for a new device to be listed ... found: sdd
|
||||||
|
@*
|
||||||
|
Now waiting 5 seconds to let it settle .........
|
||||||
@*
|
@*
|
||||||
Found and noted as desired device: sdd
|
Found and noted as desired device: sdd
|
||||||
@*
|
@*
|
||||||
|
Loading…
Reference in New Issue
Block a user