#!/bin/sh CF=/target/etc/mdadm/mdadm.conf if [ ! -s "$CF" ] && [ -e /proc/mdstat ] && \ grep ^md /proc/mdstat >/dev/null; then mkdir -p /target/etc/mdadm echo "# Autogenerated by mdcfg. See mdadm.conf(5) for more details on this file." > /etc/mdadm.conf echo "DEVICE partitions" >> $CF if [ "$(udpkg --print-os)" = "kfreebsd" ]; then mount -t linprocfs proc /target/proc else mount -t proc proc /target/proc fi chroot /target mdadm --detail --scan >> $CF umount /target/proc fi