]>
Commit | Line | Data |
---|---|---|
712caed6 JR |
1 | #!/bin/sh |
2 | ||
3 | PREREQ="mdadm mdrun" | |
4 | ||
5 | prereqs() | |
6 | { | |
7 | echo "$PREREQ" | |
8 | } | |
9 | ||
10 | case $1 in | |
11 | # get pre-requisites | |
12 | prereqs) | |
13 | prereqs | |
14 | exit 0 | |
15 | ;; | |
16 | esac | |
17 | ||
18 | activate_vg() | |
19 | { | |
20 | local vg="$1" | |
21 | ||
22 | # Make sure that we have a non-empty argument | |
23 | if [ -z "${vg}" ]; then | |
24 | return 1 | |
25 | fi | |
26 | ||
27 | # Take care of lilo boot arg, risky activating of all vg | |
28 | case $vg in | |
29 | fe[0-9]*) | |
30 | lvm vgchange -aly --ignorelockingfailure | |
31 | exit 0 | |
32 | ;; | |
33 | # FIXME: check major | |
34 | /dev/root) | |
35 | lvm vgchange -aly --ignorelockingfailure | |
36 | exit 0 | |
37 | ;; | |
38 | esac | |
39 | ||
40 | # Make sure that we have a d-m path | |
41 | vg=${vg#/dev/mapper/} | |
42 | if [ "$vg" = "$1" ]; then | |
43 | return 1 | |
44 | fi | |
45 | ||
46 | # Make sure that the device includes at least one dash | |
47 | if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then | |
48 | return 1 | |
49 | fi | |
50 | ||
51 | # Split volume group from logical volume. | |
52 | vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#') | |
53 | # Reduce padded --'s to -'s | |
54 | vg=$(echo ${vg} | sed -e 's#--#-#g') | |
55 | ||
56 | lvm vgchange -aly --ignorelockingfailure ${vg} | |
57 | } | |
58 | ||
59 | if [ ! -e /sbin/lvm ]; then | |
60 | exit 0 | |
61 | fi | |
62 | ||
63 | /sbin/modprobe -q dm-mod | |
64 | /sbin/modprobe -q dm-snapshot | |
65 | /sbin/modprobe -q dm-mirror | |
66 | ||
67 | activate_vg "$ROOT" | |
68 | activate_vg "$resume" | |
69 | ||
70 | exit 0 |