summaryrefslogtreecommitdiff
path: root/debian/mkconf
blob: ab73898f00d8f4a3d20db27b8957a7da3be8060e (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
#!/bin/sh -eu
#
# mkconf -- outputs valid mdadm.conf contents for the local system
#
# Copyright © 2006 martin f. krafft <madduck@madduck.net>
# distributed under the terms of the Artistic Licence.
#

MDADM=/sbin/mdadm
DEBIANCONFIG=/etc/default/mdadm

test -f $DEBIANCONFIG && . $DEBIANCONFIG

if [ -r /proc/partitions ]; then
  echo DEVICE partitions
else
  echo E: cannot read /proc/partitions and thus cannot do my magic. >&2
  exit 1
fi

echo CREATE owner=root group=disk mode=0660 auto=yes metadata=1

if [ ! -r /proc/mdstat ]; then
  echo W: RAID subsystem is not loaded, thus I cannot scan for arrays. >&2
else
  # || : is workaround for #367901
  $MDADM --examine --scan --config=partitions || :
fi

exit 0