26
[Yy]es|[Yy]|1|[Tt]rue|[Tt]) return 0;;
33
local PREFIX; PREFIX=$1; shift
34
echo "${PREFIX}: mdadm: $@" >&2
40
is_true ${VERBOSE:-false} && write I "$@" || :
24
49
. /usr/share/initramfs-tools/hook-functions
34
59
# copy the mdadm configuration
35
60
CONFIG=/etc/mdadm/mdadm.conf
36
61
ALTCONFIG=/etc/mdadm.conf
62
DESTMDADMCONF=$DESTDIR/etc/mdadm/mdadm.conf
37
63
[ ! -f $CONFIG ] && [ -f $ALTCONFIG ] && CONFIG=$ALTCONFIG || :
38
64
mkdir -p ${DESTDIR}/etc/mdadm
39
cp -p $CONFIG ${DESTDIR}/etc/mdadm
66
if [ ! -f $CONFIG ]; then
67
# there is no configuration file, so let's create one
68
if /usr/share/mdadm/mkconf generate $CONFIG; then
70
cp -p $CONFIG $DESTMDADMCONF
71
info "auto-generated the mdadm.conf configuration file."
73
# we failed to auto-generate, so let the emergency procedure take over
74
warn "failed to auto-generate the mdadm.conf file."
75
warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ."
78
cp -p $CONFIG ${DESTDIR}/etc/mdadm
79
if ! grep -q '^ARRAY' $CONFIG; then
80
tmpfile="${DESTMDADMCONF}.tmp"
81
warn "$CONFIG defines no arrays."
82
if /usr/share/mdadm/mkconf > $tmpfile; then
83
cp -p $tmpfile $DESTMDADMCONF
85
warn "failed to auto-generate temporary mdadm.conf file."
88
# make sure the configuration file knows about all running devices
89
/sbin/mdadm --detail --scan | while read array device params; do
90
uuid=${params#*UUID=}; uuid=${uuid%% *}
91
if ! grep -q "UUID=$uuid" $DESTMDADMCONF; then
92
warn "the array $device with UUID $uuid"
93
warn "is currently active, but it is not listed in mdadm.conf. if"
94
warn "it is needed for boot, then YOUR SYSTEM IS NOW UNBOOTABLE!"
95
warn "please inspect the output of /usr/share/mdadm/mkconf, compare"
96
warn "it to $CONFIG, and make the necessary changes."
41
102
# load raid modules in the initramfs
42
103
for module in linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do