summaryrefslogtreecommitdiff
path: root/examples/mdev.conf.change_blockdev.sh
diff options
context:
space:
mode:
authorDenys Vlasenko2013-03-30 16:23:12 +0100
committerDenys Vlasenko2013-03-30 16:23:12 +0100
commite306c1136787b0430592289347efab6098dae64e (patch)
treec28145c89f37081fb05217ef61c3387d0f4bd1e0 /examples/mdev.conf.change_blockdev.sh
parent2c0508b4facf24d55518fe13bcbef4b23c13c9cb (diff)
downloadbusybox-e306c1136787b0430592289347efab6098dae64e.zip
busybox-e306c1136787b0430592289347efab6098dae64e.tar.gz
examples: add mdev example for Android phone
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'examples/mdev.conf.change_blockdev.sh')
-rwxr-xr-xexamples/mdev.conf.change_blockdev.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/mdev.conf.change_blockdev.sh b/examples/mdev.conf.change_blockdev.sh
new file mode 100755
index 0000000..a479a96
--- /dev/null
+++ b/examples/mdev.conf.change_blockdev.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Seconds to try to reread partition table
+cnt=60
+
+exec </dev/null
+exec >"/tmp/${0##*/}.$$.out"
+exec 2>&1
+
+(
+echo "Running: $0"
+echo "Env:"
+env | sort
+
+while sleep 1; test $cnt != 0; do
+ echo "Trying to rereat partition table on $DEVNAME ($cnt)"
+ : $((cnt--))
+ test -e "$DEVNAME" || { echo "$DEVNAME doesn't exist, aborting"; exit 1; }
+ #echo "$DEVNAME exists"
+ blockdev --rereadpt "$DEVNAME" && break
+ echo "blockdev --rereadpt failed, exit code: $?"
+done
+echo "blockdev --rereadpt succeeded"
+) &