2 # don't let udev and this script step on eachother's toes
4 trap 'poweroff -f' EXIT
6 for x
in 64-lvm.rules
70-mdadm.rules
99-mount-rules; do
7 > "/etc/udev/rules.d/$x"
9 rm -f -- /etc
/lvm
/lvm.conf
10 udevadm control
--reload
11 # save a partition at the beginning for future flagging purposes
19 mdadm
--create /dev
/md0
--run --auto=yes --level=5 --raid-devices=3 /dev
/sdb
/dev
/sdc
/dev
/sdd
20 # wait for the array to finish initailizing, otherwise this sometimes fails
24 cryptsetup
-q luksFormat
/dev
/md0
/keyfile
25 echo "The passphrase is test"
27 cryptsetup luksOpen
/dev
/md0 dracut_crypt_test
</keyfile
28 lvm pvcreate
-ff -y /dev
/mapper
/dracut_crypt_test
29 lvm vgcreate dracut
/dev
/mapper
/dracut_crypt_test
30 lvm lvcreate
-l 100%FREE
-n root dracut
32 mke2fs
-L root
/dev
/dracut
/root
34 mount
/dev
/dracut
/root
/sysroot
35 cp -a -t /sysroot
/source
/*
38 lvm lvchange
-a n
/dev
/dracut
/root
40 cryptsetup luksClose
/dev
/mapper
/dracut_crypt_test
42 mdadm
-W /dev
/md0 ||
:
43 mdadm
--detail --export /dev
/md0 |
grep -F MD_UUID
> /tmp
/mduuid
45 eval $
(udevadm info
--query=env
--name=/dev
/md0|
while read line ||
[ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
46 { echo "dracut-root-block-created"; echo MD_UUID
=$MD_UUID; echo "ID_FS_UUID=$ID_FS_UUID";} > /dev
/sda1