examples: add mdev example for Android phone
[platform/upstream/busybox.git] / examples / mdev.conf.change_blockdev.sh
1 #!/bin/sh
2
3 # Seconds to try to reread partition table
4 cnt=60
5
6 exec </dev/null
7 exec >"/tmp/${0##*/}.$$.out"
8 exec 2>&1
9
10 (
11 echo "Running: $0"
12 echo "Env:"
13 env | sort
14
15 while sleep 1; test $cnt != 0; do
16         echo "Trying to rereat partition table on $DEVNAME ($cnt)"
17         : $((cnt--))
18         test -e "$DEVNAME" || { echo "$DEVNAME doesn't exist, aborting"; exit 1; }
19         #echo "$DEVNAME exists"
20         blockdev --rereadpt "$DEVNAME" && break
21         echo "blockdev --rereadpt failed, exit code: $?"
22 done
23 echo "blockdev --rereadpt succeeded"
24 ) &