]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/waitdrives
93ae1ed7015b21b8eeb44a9b916120e218d2a0cc
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / waitdrives
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/waitdrives
4 #
5 # Description : Wait for drives before fscheck/mount
6 #
7 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
8 #
9 # Version : 00.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17
18 check_drives () {
19 drives_ready="1";
20 for drive in $drives; do
21 if [ `blkid | grep $drive | wc -l` == 0 ]; then
22 drives_ready="0";
23 fi
24 done
25 }
26
27 case "${1}" in
28 start)
29 if [ -e /sbin/mdadm ]; then
30 boot_mesg "Assemble mdadm managed raid-drives ..."
31 mdadm --assemble --scan
32 fi
33
34 drives=`grep "^UUID=" /etc/fstab | cut -f1 | cut -d" " -f1 | cut -d"=" -f2`;
35
36 check_drives;
37 if [ "$drives_ready" == "0" ]; then
38 boot_mesg -n "Wait for devices used in fstab "
39 for (( i=1; i<30; i++)) do
40 check_drives;
41 if [ "$drives_ready" == "1" ]; then
42 break;
43 fi
44 boot_mesg -n "."
45 sleep 1
46 done
47 fi
48 exit 0;
49 ;;
50 *)
51 echo "Usage: ${0} {start}"
52 exit 1
53 ;;
54 esac
55
56 # End $rc_base/init.d/waitdrives