|
1 | 1 | # common linbo shell functions |
2 | 2 | # |
3 | 3 | |
4 | | -# 20250717 |
| 4 | +# 20250801 |
5 | 5 | # |
6 | 6 |
|
7 | 7 | set -o pipefail |
@@ -501,6 +501,23 @@ get_partnr(){ |
501 | 501 | } |
502 | 502 |
|
503 | 503 |
|
| 504 | +# compute real partition name from unified partition name |
| 505 | +get_real_partname(){ |
| 506 | + local part="$1" |
| 507 | + # if not a unified name do nothing |
| 508 | + if [ "${part:0:9}" != "/dev/disk" ]; then |
| 509 | + echo "$part" |
| 510 | + return |
| 511 | + fi |
| 512 | + local disk="$(get_disk_from_partition "$part")" |
| 513 | + local realdisk="$(realpath "$disk")" |
| 514 | + case "$realdisk" in |
| 515 | + /dev/mmcblk[0-9]|/dev/nvme0n[0-9]) echo "$part" | sed -e "s|$disk|$realdisk|" ;; |
| 516 | + *) echo "$part" | sed -e "s|${disk}p|$realdisk|" ;; |
| 517 | + esac |
| 518 | +} |
| 519 | + |
| 520 | + |
504 | 521 |
|
505 | 522 | #### boot, grub & efi #### |
506 | 523 |
|
@@ -608,7 +625,7 @@ create_efiboot(){ |
608 | 625 | # return if entry exists |
609 | 626 | efibootmgr | grep ^Boot[0-9] | awk -F\* '{ print $2 }' | grep -qiw " $1" && return 0 |
610 | 627 | local label="$1" |
611 | | - local efipart="$(realpath "$2")" |
| 628 | + local efipart="$2" |
612 | 629 | local efipartnr="$(get_partnr "$efipart")" |
613 | 630 | local efidisk="$(get_disk_from_partition "$efipart")" |
614 | 631 | local efiloader |
@@ -689,7 +706,7 @@ repair_efi(){ |
689 | 706 | echo "repair_efi $@" |
690 | 707 | local doneflag="/tmp/.repair_efi" |
691 | 708 | [ -e "$doneflag" ] && return 0 |
692 | | - local efipart="$(realpath "$1")" |
| 709 | + local efipart="$1" |
693 | 710 | local efiout="/tmp/efiout" |
694 | 711 | local startflag="/tmp/.start" |
695 | 712 | local line |
@@ -730,7 +747,7 @@ mk_winefiboot(){ |
730 | 747 | local partition="$1" |
731 | 748 | local doneflag="/tmp/.mk_winefiboot.$(basename "$partition")" |
732 | 749 | [ -e "$doneflag" ] && return 0 |
733 | | - local efipart="$(realpath "$2")" |
| 750 | + local efipart="$2" |
734 | 751 | local bootloaderid="$3" |
735 | 752 | local RC="0" |
736 | 753 | local win_bootdir="$(ls -d /mnt/[Ee][Ff][Ii]/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]/[Bb][Oo][Oo][Tt] 2> /dev/null)" |
@@ -762,7 +779,7 @@ mk_winefiboot(){ |
762 | 779 | # mk_efiboot: if returns 1 a reboot via grub will be initiated, othwerwise reboot via efi directly |
763 | 780 | # args: efipart partition grubdisk |
764 | 781 | mk_efiboot(){ |
765 | | - local efipart="$(realpath "$1")" |
| 782 | + local efipart="$1" |
766 | 783 | local partition="$2" |
767 | 784 | local grubdisk="$3" |
768 | 785 | local startflag="/tmp/.start" |
@@ -822,7 +839,7 @@ mk_linefiboot(){ |
822 | 839 | local doneflag="/tmp/.mk_linefiboot.$(basename "$partition")" |
823 | 840 | [ -e "$doneflag" ] && return 0 |
824 | 841 | local grubdisk="$2" |
825 | | - local efipart="$(realpath "$3")" |
| 842 | + local efipart="$3" |
826 | 843 | local bootloaderid="$4" |
827 | 844 | local RC="0" |
828 | 845 | mkdir -p /mnt/boot/efi |
@@ -880,14 +897,14 @@ prepare_grub(){ |
880 | 897 | # args: grubdisk partition grubenv kernel initrd append efipart |
881 | 898 | prepare_reboot(){ |
882 | 899 | echo "prepare_reboot $@" |
883 | | - local grubdisk="$(realpath "$1")" |
884 | | - local partition="$(realpath "$2")" |
| 900 | + local grubdisk="$1" |
| 901 | + local partition="$2" |
885 | 902 | local grubenv="$3" |
886 | 903 | local KERNEL="${4#/}" |
887 | 904 | local INITRD="${5#/}" |
888 | 905 | local APPEND="$6" |
889 | 906 | if [ -n "$7" ]; then |
890 | | - local efipart="$(realpath "$7")" |
| 907 | + local efipart="$7" |
891 | 908 | fi |
892 | 909 | local efiboot="false" |
893 | 910 | remote_cache "$cache" || local localcache="yes" |
@@ -958,7 +975,7 @@ mk_boot(){ |
958 | 975 | local INITRD="${3#/}" |
959 | 976 | local APPEND="$4" |
960 | 977 | if [ -n "$(print_efipart)" ]; then |
961 | | - local efipart="$(realpath "$(print_efipart)")" |
| 978 | + local efipart="$(print_efipart)" |
962 | 979 | fi |
963 | 980 | local partition="$1" |
964 | 981 | remote_cache "$cache" || local localcache="yes" |
|
0 commit comments