feat: canonicalize devices before use to /dev/disk/by-id/ if possible.
This is beneficial for ZFS pools and for humans to see whether the correct disk was selected.
This commit is contained in:
parent
20a69f41ec
commit
50ec673974
|
@ -2,8 +2,6 @@
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
#todo "test ZFS compression really on"
|
#todo "test ZFS compression really on"
|
||||||
#todo "disks by id also in resolve step"
|
|
||||||
#todo "the device you want to partitoin ---> to use?"
|
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Initialize script environment
|
# Initialize script environment
|
||||||
|
@ -649,7 +647,8 @@ function menu_radiolist() {
|
||||||
function menu_select_device() {
|
function menu_select_device() {
|
||||||
local title="$1"
|
local title="$1"
|
||||||
local desc="$2"
|
local desc="$2"
|
||||||
local prev_selected=$(canonicalize_device "$3")
|
local prev_selected
|
||||||
|
prev_selected=$(canonicalize_device "$3")
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
local all_devices=()
|
local all_devices=()
|
||||||
|
|
2
install
2
install
|
@ -96,7 +96,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check configuration location
|
# Check configuration location
|
||||||
[[ -z "${CONFIG%%$GENTOO_INSTALL_REPO_DIR*}" ]] \
|
[[ -z "${CONFIG%%"$GENTOO_INSTALL_REPO_DIR"*}" ]] \
|
||||||
|| die "Configuration file must be inside the installation directory. This is needed so it is accessible from within the chroot environment."
|
|| die "Configuration file must be inside the installation directory. This is needed so it is accessible from within the chroot environment."
|
||||||
|
|
||||||
if [[ -z "$ACTION" ]]; then
|
if [[ -z "$ACTION" ]]; then
|
||||||
|
|
|
@ -6,8 +6,6 @@ source "$GENTOO_INSTALL_REPO_DIR/scripts/protection.sh" || exit 1
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
function install_stage3() {
|
function install_stage3() {
|
||||||
[[ $# == 0 ]] || die "Too many arguments"
|
|
||||||
|
|
||||||
prepare_installation_environment
|
prepare_installation_environment
|
||||||
apply_disk_configuration
|
apply_disk_configuration
|
||||||
download_stage3
|
download_stage3
|
||||||
|
|
|
@ -242,6 +242,14 @@ function create_resolve_entry_device() {
|
||||||
# Return matching device from /dev/disk/by-id/ if possible,
|
# Return matching device from /dev/disk/by-id/ if possible,
|
||||||
# otherwise return the parameter unchanged.
|
# otherwise return the parameter unchanged.
|
||||||
function canonicalize_device() {
|
function canonicalize_device() {
|
||||||
|
given_dev="$(realpath "$1")"
|
||||||
|
for dev in /dev/disk/by-id/*; do
|
||||||
|
if [[ "$(realpath "$dev")" == "$given_dev" ]]; then
|
||||||
|
echo -n "$dev"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo -n "$1"
|
echo -n "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue