summaryrefslogtreecommitdiffstats
path: root/rescue/Flash/scripts/test_badblocks
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-07-05 13:55:45 +0000
committerOlivier Blin <oblin@mandriva.com>2007-07-05 13:55:45 +0000
commit5bf0ea82a312b21ed600c615f75953efcd203363 (patch)
tree1298634443c610b2c101537f6960cac89ebf5bd0 /rescue/Flash/scripts/test_badblocks
parent3aa29a9d3a01072b942382aff369ee74c3b93a05 (diff)
downloaddrakx-backup-do-not-use-5bf0ea82a312b21ed600c615f75953efcd203363.tar
drakx-backup-do-not-use-5bf0ea82a312b21ed600c615f75953efcd203363.tar.gz
drakx-backup-do-not-use-5bf0ea82a312b21ed600c615f75953efcd203363.tar.bz2
drakx-backup-do-not-use-5bf0ea82a312b21ed600c615f75953efcd203363.tar.xz
drakx-backup-do-not-use-5bf0ea82a312b21ed600c615f75953efcd203363.zip
move rescue-Flash/scripts as rescue/Flash/scripts
Diffstat (limited to 'rescue/Flash/scripts/test_badblocks')
-rwxr-xr-xrescue/Flash/scripts/test_badblocks69
1 files changed, 69 insertions, 0 deletions
diff --git a/rescue/Flash/scripts/test_badblocks b/rescue/Flash/scripts/test_badblocks
new file mode 100755
index 000000000..3fb1f34d8
--- /dev/null
+++ b/rescue/Flash/scripts/test_badblocks
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# import functions library
+source rescue_common
+
+tmpdir="/tmp/flash-rescue-root"
+rootdir="$tmpdir/pen"
+
+function prepare() {
+
+ return 0
+}
+
+function doit() {
+
+ clear
+ echo
+ echo "WARNING!"
+ echo
+ echo "Searching for bad blocks in Mandriva Flash is a slow process."
+ echo
+ echo -n "Do you want to continue? [N/y] "
+ read confirm
+
+ echo
+ echo
+
+ device=$(cat /tmp/rescue-device)
+
+ if [ x"$confirm" = x"y" -o x"$confirm" = x"Y" ]; then
+
+ /sbin/badblocks -n -v -s ${device}1
+ if [ x"$version" = x"1.0" ]; then
+ /sbin/badblocks -n -v -s ${device}2
+ fi
+ fi
+
+ echo
+ echo 'Bad blocks scan completed!'
+ echo
+
+ return 0
+}
+
+function cleanup() {
+
+ umount $rootdir > /dev/null 2>&1
+ rmdir $rootdir $tmpdir 2> /dev/null
+}
+
+clear
+trap cleanup SIGINT
+
+version=""
+if ! insert_pendrive; then
+ exit 1
+fi
+
+if ! prepare; then
+ cleanup
+ exit 1
+fi
+
+if ! doit; then
+ cleanup
+ exit 1
+fi
+
+cleanup