summaryrefslogtreecommitdiff
path: root/debian/mdadm-raid
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-10-26 22:08:55 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-10-26 22:08:55 +0000
commitb9b942752da4848bb58b2e987b910eb7d9a440a6 (patch)
tree7864b99314b0956df5d7a3fc5c8b6eb809baa245 /debian/mdadm-raid
parent25690fff481fad6e3686ed1e6e8cdec09f748072 (diff)
small fixes to init script
Diffstat (limited to 'debian/mdadm-raid')
-rw-r--r--debian/mdadm-raid19
1 files changed, 10 insertions, 9 deletions
diff --git a/debian/mdadm-raid b/debian/mdadm-raid
index ca76fcdc..0a36c3cc 100644
--- a/debian/mdadm-raid
+++ b/debian/mdadm-raid
@@ -81,13 +81,14 @@ is_true()
esac
}
-STATEDIR=/dev
-for dir in /lib/init/rw /dev/shm; do
- test -d $dir/.mdadm && STATEDIR=$dir && break
+for dir in /lib/init/rw /dev/shm /dev; do
+ statedir=$dir/.mdadm
+ test -d $statedir && STATEDIR=$statedir && break
test -w $dir || continue
- STATEDIR=$dir
+ mkdir $statedir || continue
+ STATEDIR=$statedir
+ break
done
-mkdir $STATEDIR/.mdadm 2>/dev/null && STATEDIR=$STATEDIR/.mdadm || unset STATEDIR
case "${1:-}" in
start)
@@ -169,11 +170,11 @@ case "${1:-}" in
log_action_begin_msg "Generating udev events for MD arrays"
for uevent in /sys/block/md*/uevent; do
- array=${uevent#/sys/block/}; array=${dev%/uevent}
- test -e $STATEDIR/$array && continue
+ sentinel=${uevent#/sys/block/}; sentinel=${sentinel%/uevent}-uevent
+ test -e ${STATEDIR:-/doesnotexist}/$sentinel && continue
test -w $uevent || continue
echo add > $uevent
- : > $STATEDIR/$array
+ test -d "${STATEDIR:-}" && : > $STATEDIR/$sentinel
done
log_action_end_msg 0
@@ -232,7 +233,7 @@ case "${1:-}" in
esac
done || exit $?
- rm -rf $STATEDIR
+ rm -rf ${STATEDIR:-}
else
log_notice "disabled in $DEBIANCONFIG"