summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-03-02 04:29:58 +0000
committerMike Frysinger <vapier@gentoo.org>2005-03-02 04:29:58 +0000
commitddcedc0b308b05b08e5fea4d6c0ce075a9a5f856 (patch)
treef28a4903724748f3ec81c74b973dc19086d9c35c /sys-fs/raidtools/files/raid-start.sh
parentold (diff)
downloadhistorical-ddcedc0b308b05b08e5fea4d6c0ce075a9a5f856.tar.gz
historical-ddcedc0b308b05b08e5fea4d6c0ce075a9a5f856.tar.bz2
historical-ddcedc0b308b05b08e5fea4d6c0ce075a9a5f856.zip
Move raid stuff to raid packages.
Package-Manager: portage-2.0.51.18
Diffstat (limited to 'sys-fs/raidtools/files/raid-start.sh')
-rwxr-xr-xsys-fs/raidtools/files/raid-start.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys-fs/raidtools/files/raid-start.sh b/sys-fs/raidtools/files/raid-start.sh
new file mode 100755
index 000000000000..c95708b387b2
--- /dev/null
+++ b/sys-fs/raidtools/files/raid-start.sh
@@ -0,0 +1,40 @@
+# /lib/rcscripts/addons/raid-start.sh: Setup raid volumes at boot
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/raidtools/files/raid-start.sh,v 1.1 2005/03/02 04:29:58 vapier Exp $
+
+[[ -f /proc/mdstat ]] || exit 0
+
+# We could make this dynamic, but eh
+#[[ -z ${MAJOR} ]] && export MAJOR=$(awk '$2 == "md" { print $1 }' /proc/devices)
+MAJOR=9
+
+# Try to make sure the devices exist before we use them
+create_devs() {
+ local d
+ for d in $@ ; do
+ d=${d/\/dev\/}
+ [[ -e /dev/${d} ]] && continue
+ mknod /dev/${d} b ${MAJOR} ${d##*md} >& /dev/null
+ done
+}
+
+# Start software raid with raidtools (old school)
+if [[ -x /sbin/raidstart && -f /etc/raidtab ]] ; then
+ create_devs $(awk '/^[[:space:]]*raiddev/ { print $2 }' /etc/raidtab)
+ ebegin "Starting up RAID devices (raidtools)"
+ output=$(raidstart -a 2>&1)
+ ret=$?
+ [[ ${ret} -ne 0 ]] && echo "${output}"
+ eend ${ret}
+fi
+
+# Start software raid with mdadm (new school)
+if [[ -x /sbin/mdadm && -f /etc/mdadm.conf ]] ; then
+ create_devs $(awk '/^[[:space:]]*ARRAY/ { print $2 }' /etc/mdadm.conf)
+ ebegin "Starting up RAID devices (mdadm)"
+ output=$(mdadm -As 2>&1)
+ ret=$?
+ [[ ${ret} -ne 0 ]] && echo "${output}"
+ eend ${ret}
+fi
+
+# vim:ts=4