Exclude install media from disk picker (#73)
* Exclude install media from disk picker * Document boot-disk exclusion in configurator
This commit is contained in:
1 parent
94494c8837
commit
eadb1c05d4
1 file changed
+25
-1
@@ -211,12 +211,36 @@ get_disk_info() {
|
|||||||
echo "$display"
|
echo "$display"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_root_disk() {
|
||||||
|
local device="$1"
|
||||||
|
local parent
|
||||||
|
|
||||||
|
[[ -n $device ]] || return 1
|
||||||
|
|
||||||
|
# /run/archiso/bootmnt usually resolves to the boot partition, but the
|
||||||
|
# installer picker works with whole disks. Walk back to the parent disk so
|
||||||
|
# the install media itself never shows up as a wipe target.
|
||||||
|
device=$(readlink -f "$device" 2>/dev/null || printf "%s\n" "$device")
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
parent=$(lsblk -no PKNAME "$device" 2>/dev/null | tail -n1)
|
||||||
|
[[ -n $parent ]] || break
|
||||||
|
device="/dev/$parent"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $(lsblk -dno TYPE "$device" 2>/dev/null) == "disk" ]]; then
|
||||||
|
printf "%s\n" "$device"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
disk_form() {
|
disk_form() {
|
||||||
step "Let's select where to install Omarchy..."
|
step "Let's select where to install Omarchy..."
|
||||||
|
|
||||||
# Don't offer the install media as an option (Arch ISO mounts it here)
|
# Don't offer the install media as an option (Arch ISO mounts it here)
|
||||||
|
local boot_source
|
||||||
local exclude_disk
|
local exclude_disk
|
||||||
exclude_disk=$(findmnt -no SOURCE /run/archiso/bootmnt 2>/dev/null || true)
|
boot_source=$(findmnt -no SOURCE /run/archiso/bootmnt 2>/dev/null || true)
|
||||||
|
exclude_disk=$(get_root_disk "$boot_source")
|
||||||
|
|
||||||
# List all installable disks, excluding the boot device if present
|
# List all installable disks, excluding the boot device if present
|
||||||
local available_disks
|
local available_disks
|
||||||
|
|||||||
Reference in new issue
Block a user