blob: 5bf70cfc0c21e962ce5130a0b4ad7e76868f58fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#!/bin/sh
# Copyright © 2001-2005 Mario Jou/3en <joussen@debian.org>
# Copyright © 2005-2008 Martin F. Krafft <madduck@debian.org>
# Distributable under the terms of the GNU GPL version 2.
#
. /usr/share/debconf/confmodule
# See #369953 for ordering
set -eu
case "${1:-}" in
configure|reconfigure)
if [ ! -f /proc/mdstat ] && [ -x $(command -v modprobe 2>/dev/null) ]; then
modprobe md >/dev/null 2>&1 || :
fi
if [ ! -f /proc/mdstat ]; then
echo 'W: mdadm: failed to load MD subsystem.' >&2
fi
MAKEDEV=/dev/MAKEDEV
if [ ! -e /dev/md15 ] \
&& [ ! -e /dev/.static/dev/md15 ] \
&& [ ! -e /dev/.devfsd ] \
&& [ -x $MAKEDEV ]; then
echo -n 'Generating array device nodes... ' >&2
cd /dev
if $MAKEDEV md >&2 >/dev/null; then
echo 'done.' >&2
else
echo 'failed.' >&2
fi
fi
DEBIANCONFIG=/etc/default/mdadm
CONFIG=/etc/mdadm/mdadm.conf
ALTCONFIG=/etc/mdadm.conf
MDADM=/sbin/mdadm
if [ -z "${2:-}" ] && [ -s /etc/mdctl/mdctl.conf ] \
&& [ ! -f /etc/mdadm/mdadm.conf ]; then
cp -a /etc/mdctl/mdctl.conf /etc/mdadm/mdadm.conf
fi
# load current settings, most of which will be overwritten.
[ -f $DEBIANCONFIG ] && . $DEBIANCONFIG
db_get mdadm/mail_to
MAILADDR="${RET:-root}"
[ ! -f $CONFIG ] && [ -f $ALTCONFIG ] && CONFIG=$ALTCONFIG
if [ ! -f $CONFIG ]; then
echo -n 'Generating mdadm.conf... ' >&2
# pass the MAILADDR variable into the script
MDADM_MAILADDR__="$MAILADDR"; export MDADM_MAILADDR__
if /usr/share/mdadm/mkconf generate $CONFIG 2>/dev/null; then
echo done. >&2
else
echo "done (failed to scan arrays; /proc probably not mounted)." >&2
fi
fi
if [ -w $CONFIG ] && [ -z "${MDADM_MAILADDR__:-}" ]; then
# if the configuration is writeable but has not been written just
# before, then edit it to reflect the MAILADDR preference
if grep -q '^MAILADDR' $CONFIG; then
sed -i -e "s/^MAILADDR.*/MAILADDR $MAILADDR/" $CONFIG
else
echo "MAILADDR $MAILADDR" >> $CONFIG
fi
fi
unset MDADM_MAILADDR__
db_get mdadm/initrdstart
INITRDSTART="${RET:-all}"
db_get mdadm/autostart
AUTOSTART="${RET:-true}"
db_get mdadm/autocheck
AUTOCHECK="${RET:-true}"
db_get mdadm/start_daemon
START_DAEMON="${RET:-true}"
#db_get mdadm/daemon_options
[ -n "${DAEMON_OPTIONS:-}" ] || DAEMON_OPTIONS='--syslog'
cat <<_eof > $DEBIANCONFIG
# mdadm Debian configuration
#
# You can run 'dpkg-reconfigure mdadm' to modify the values in this file, if
# you want. You can also change the values here and changes will be preserved.
# Do note that only the values are preserved; the rest of the file is
# rewritten.
#
# INITRDSTART:
# list of arrays (or 'all') to start automatically when the initial ramdisk
# loads. This list *must* include the array holding your root filesystem. Use
# 'none' to prevent any array from being started from the initial ramdisk.
INITRDSTART='$INITRDSTART'
# AUTOSTART:
# should mdadm start arrays listed in /etc/mdadm/mdadm.conf automatically
# during boot?
AUTOSTART=$AUTOSTART
# AUTOCHECK:
# should mdadm run periodic redundancy checks over your arrays? See
# /etc/cron.d/mdadm.
AUTOCHECK=$AUTOCHECK
# START_DAEMON:
# should mdadm start the MD monitoring daemon during boot?
START_DAEMON=$START_DAEMON
# DAEMON_OPTIONS:
# additional options to pass to the daemon.
DAEMON_OPTIONS="$DAEMON_OPTIONS"
# VERBOSE:
# if this variable is set to true, mdadm will be a little more verbose e.g.
# when creating the initramfs.
VERBOSE=${VERBOSE:-false}
# MAIL_TO:
# this variable is now managed in /etc/mdadm/mdadm.conf (MAILADDR).
# Please see mdadm.conf(5).
_eof
db_stop
command -v update-initramfs >/dev/null 2>&1 && update-initramfs -u
;;
esac
# See #369953
set +u
#DEBHELPER#
|