Michael Tokarev: small changes for debian/checkarray

Michael Tokarev mjt at alioth.debian.org
Tue Jan 10 18:30:38 UTC 2012


Module: mdadm
Branch: build
Commit: 04145749363e0180e8014b37eb3dfe59450f9bd4
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=04145749363e0180e8014b37eb3dfe59450f9bd4

Author: Michael Tokarev <mjt at tls.msk.ru>
Date:   Tue Jan 10 19:59:44 2012 +0400

small changes for debian/checkarray

remove usage of $SYNC_ACTION_CTL in favour of $MDBASE/sync_action
since $MDBASE is (and will be) used in other places.  While at it,
replace var=$(cat foo) with read var < foo construct

---

 debian/changelog  |    1 +
 debian/checkarray |   16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7af3ad1..0b2e125 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ mdadm (3.2.3-1) UNRELEASED; urgency=low
     (Closes: #641972)
   * set nice value of the check/resync thread too, together with I/O
     scheduling class, based on patch by Sergey B Kirpichev (Closes: #652547)
+  * small changes for debian/checkarray
 
   [ Peter Eisentraut ]
   * Added support for "status" action to mdadm init script (Closes: #651737)
diff --git a/debian/checkarray b/debian/checkarray
index 96538e3..2043d8c 100644
--- a/debian/checkarray
+++ b/debian/checkarray
@@ -139,33 +139,33 @@ fi
 [ $all = 1 ] && arrays="$(ls -d1 /sys/block/md* | cut -d/ -f4)"
 
 for array in $arrays; do
-  SYNC_ACTION_CTL=/sys/block/$array/md/sync_action
+  MDBASE=/sys/block/$array/md
 
-  if [ ! -e $SYNC_ACTION_CTL ]; then
+  if [ ! -e $MDBASE/sync_action ]; then
     [ $quiet -lt 1 ] && echo "$PROGNAME: I: skipping non-redundant array $array." >&2
     continue
   fi
 
-  cur_status="$(cat $SYNC_ACTION_CTL)"
+  read cur_status < $MDBASE/sync_action
 
   if [ $action = status ]; then
     echo "$array: $cur_status"
     continue
   fi
 
-  if [ ! -w $SYNC_ACTION_CTL ]; then
-    [ $quiet -lt 2 ] && echo "$PROGNAME: E: $SYNC_ACTION_CTL not writeable." >&2
+  if [ ! -w $MDBASE/sync_action ]; then
+    [ $quiet -lt 2 ] && echo "$PROGNAME: E: $MDBASE/sync_action not writeable." >&2
     exit 4
   fi
 
-  if [ "$(cat /sys/block/$array/md/array_state)" = 'read-auto' ]; then
+  if [ "$(cat $MDBASE/array_state)" = 'read-auto' ]; then
     [ $quiet -lt 1 ] && echo "$PROGNAME: W: array $array in auto-read-only state, skipping..." >&2
     continue
   fi
 
   case "$action" in
     idle)
-      echo $action > $SYNC_ACTION_CTL
+      echo $action > $MDBASE/sync_action
       [ $quiet -lt 1 ] && echo "$PROGNAME: I: cancel request queued for array $array." >&2
       ;;
 
@@ -177,7 +177,7 @@ for array in $arrays; do
 
       # queue request for the array. The kernel will make sure that these requests
       # are properly queued so as to not kill one of the array.
-      echo $action > $SYNC_ACTION_CTL
+      echo $action > $MDBASE/sync_action
       [ $quiet -lt 1 ] && echo "$PROGNAME: I: check queued for array $array." >&2
 
       case "$ionice" in




More information about the pkg-mdadm-commits mailing list