mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
splitted out dm devices from dmraid_partitions
This commit is contained in:
parent
12dcde9163
commit
abc52371a6
1 changed files with 42 additions and 14 deletions
|
@ -120,6 +120,7 @@ activate_dmraid()
|
||||||
# activate lvm2 devices
|
# activate lvm2 devices
|
||||||
activate_lvm2()
|
activate_lvm2()
|
||||||
{
|
{
|
||||||
|
ACTIVATE_LVM2_DONE="no"
|
||||||
if [ -e /sbin/lvm ]; then
|
if [ -e /sbin/lvm ]; then
|
||||||
DIALOG --infobox "Scanning logical volumes..." 0 0
|
DIALOG --infobox "Scanning logical volumes..." 0 0
|
||||||
/sbin/lvm vgscan --ignorelockingfailure >/dev/null 2>&1
|
/sbin/lvm vgscan --ignorelockingfailure >/dev/null 2>&1
|
||||||
|
@ -132,9 +133,10 @@ activate_lvm2()
|
||||||
# activate md devices
|
# activate md devices
|
||||||
activate_raid()
|
activate_raid()
|
||||||
{
|
{
|
||||||
|
ACTIVATE_RAID_DONE="no"
|
||||||
if [ -e /sbin/mdadm ]; then
|
if [ -e /sbin/mdadm ]; then
|
||||||
DIALOG --infobox "Activating RAID arrays..." 0 0
|
DIALOG --infobox "Activating RAID arrays..." 0 0
|
||||||
/sbin/mdadm --assemble --scan >/dev/null 2>&1
|
/sbin/mdadm --assemble --scan >/dev/null 2>&1 && ACTIVATE_RAID_DONE="yes"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +144,7 @@ activate_raid()
|
||||||
# activate luks devices
|
# activate luks devices
|
||||||
activate_luks()
|
activate_luks()
|
||||||
{
|
{
|
||||||
|
ACTIVATE_LUKS_DONE="no"
|
||||||
if [ -e /sbin/cryptsetup ]; then
|
if [ -e /sbin/cryptsetup ]; then
|
||||||
DIALOG --infobox "Scanning for luks encrypted devices..." 0 0
|
DIALOG --infobox "Scanning for luks encrypted devices..." 0 0
|
||||||
for PART in $(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
for PART in $(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
||||||
|
@ -150,7 +153,7 @@ activate_luks()
|
||||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||||
[ "$(cryptsetup status $devpath | grep $PART)" ] && OPEN_LUKS="no"
|
[ "$(cryptsetup status $devpath | grep $PART)" ] && OPEN_LUKS="no"
|
||||||
done
|
done
|
||||||
! [ "$OPEN_LUKS" = "no" ] && _enter_luks_name && _enter_luks_passphrase && _opening_luks
|
! [ "$OPEN_LUKS" = "no" ] && _enter_luks_name && _enter_luks_passphrase && _opening_luks && ACTIVATE_LUKS_DONE="yes"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -158,15 +161,14 @@ activate_luks()
|
||||||
# activate_special_devices()
|
# activate_special_devices()
|
||||||
# activate special devices:
|
# activate special devices:
|
||||||
# activate dmraid, lvm2 and raid devices, if not already activated during bootup!
|
# activate dmraid, lvm2 and raid devices, if not already activated during bootup!
|
||||||
# run it 3 times, it can be hidden by each other!
|
# run it more times if needed, it can be hidden by each other!
|
||||||
activate_special_devices()
|
activate_special_devices()
|
||||||
{
|
{
|
||||||
activate_dmraid
|
activate_dmraid
|
||||||
for i in seq 1 3; do
|
while [ "$ACTIVATE_LVM2_DONE" = "yes" -o "$ACTIVATE_RAID_DONE" = "yes" -o "$ACTIVATE_LUKS_DONE" = "yes" ] ; do
|
||||||
activate_raid
|
activate_raid
|
||||||
activate_lvm2
|
activate_lvm2
|
||||||
activate_luks
|
activate_luks
|
||||||
[ "$i" = "3" ] && break
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,12 +416,11 @@ dmraid_devices() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# only show dmraid partitions,
|
# check_dm_devices
|
||||||
# - remove part of encrypted devices
|
# - remove part of encrypted devices
|
||||||
# - remove part of lvm
|
# - remove part of lvm
|
||||||
# - remove part ot raid
|
# - remove part ot raid
|
||||||
dmraid_partitions() {
|
check_dm_devices() {
|
||||||
# device mapper devices, only show dmraid partitions, remove part of encrypted devices, remove part of lvm, remove part ot raid!
|
|
||||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||||
k="$(blkid -c=/dev/null /dev/mapper/$devpath 2>/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g')"
|
k="$(blkid -c=/dev/null /dev/mapper/$devpath 2>/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g')"
|
||||||
partofcrypt="$partofcrypt $k"
|
partofcrypt="$partofcrypt $k"
|
||||||
|
@ -432,12 +433,38 @@ dmraid_partitions() {
|
||||||
k="$(blkid -c=/dev/null /dev/mapper/$devpath 2>/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g')"
|
k="$(blkid -c=/dev/null /dev/mapper/$devpath 2>/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g')"
|
||||||
partofraid="$partofraid $k"
|
partofraid="$partofraid $k"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# dm_devices
|
||||||
|
# - show device mapper devices
|
||||||
|
dm_devices() {
|
||||||
|
check_dm_devices
|
||||||
|
if [ -d /dev/mapper ] ; then
|
||||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||||
|
if ! [ "$(dmraid -s -c | grep ^$devpath)" -o "$(ls $partofcrypt 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partoflvm 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partofraid 2>/dev/null | grep /dev/mapper/$devpath$)" ]; then
|
||||||
|
echo "/dev/mapper/$devpath"
|
||||||
|
[ "$1" ] && echo $1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# dmraid_partitions
|
||||||
|
# - show dmraid partitions
|
||||||
|
dmraid_partitions() {
|
||||||
|
check_dm_devices
|
||||||
|
if [ -d /dev/mapper ] ; then
|
||||||
|
for fakeraid in $(dmraid -s -c); do
|
||||||
|
if [ "$(echo $fakeraid | grep '_')" ]; then
|
||||||
|
for devpath in $(ls /dev/mapper/$fakeraid*); do
|
||||||
if ! [ "$(dmraid -s -c | grep $devpath$)" -o "$(ls $partofcrypt 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partoflvm 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partofraid 2>/dev/null | grep /dev/mapper/$devpath$)" ]; then
|
if ! [ "$(dmraid -s -c | grep $devpath$)" -o "$(ls $partofcrypt 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partoflvm 2>/dev/null | grep /dev/mapper/$devpath$)" -o "$(ls $partofraid 2>/dev/null | grep /dev/mapper/$devpath$)" ]; then
|
||||||
echo "/dev/mapper/$devpath"
|
echo "/dev/mapper/$devpath"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# do sanity checks on partitions, argument comes $devpath loop
|
# do sanity checks on partitions, argument comes $devpath loop
|
||||||
|
@ -478,6 +505,7 @@ findpartitions() {
|
||||||
default_partition_check $1
|
default_partition_check $1
|
||||||
done
|
done
|
||||||
additional_blockdevices_partitions $1
|
additional_blockdevices_partitions $1
|
||||||
|
dm_devices $1
|
||||||
dmraid_partitions $1
|
dmraid_partitions $1
|
||||||
raid_devices $1
|
raid_devices $1
|
||||||
partitionable_raid_devices_partitions $1
|
partitionable_raid_devices_partitions $1
|
||||||
|
|
Loading…
Reference in a new issue