USB Pendrive의 GRUB 사용자 정의 항목 해결 방법

USB Pendrive의 GRUB 사용자 정의 항목 해결 방법

USB Pendrive에 Porteus를 설치하고 3개의 파티션으로 나누었습니다. 첫 번째 파티션은 exFAT(이전 Windows와의 호환성을 위해)이고, 두 번째 파티션은 부팅 파티션이므로 ext2에 있고, 세 번째 파티션에는 다음이 포함되어 있습니다. Porteus ISO 및 데이터 폴더.

다른 포스팅을 보실 수 있습니다 ->https://forum.porteus.org/viewtopic.php?f=140&t=10878&p=94752#p94752

글쎄, 문제는 내 grub.conf에 있습니다. 이 솔루션을 넣었습니다.

    if [ "$root" == "hd0,msdos2" ]; then unset root ; root="sda2" ; fi
    if [ "$root" == "hd0,msdos3" ]; then unset root ; root="sda3" ; fi
    if [ "$root" == "hd0,msdos4" ]; then unset root ; root="sda4" ; fi
    if [ "$root" == "hd0,msdos5" ]; then unset root ; root="sda5" ; fi
    if [ "$root" == "hd0,msdos6" ]; then unset root ; root="sda6" ; fi
    if [ "$root" == "hd0,msdos7" ]; then unset root ; root="sda7" ; fi
    if [ "$root" == "hd0,msdos8" ]; then unset root ; root="sda8" ; fi
    if [ "$root" == "hd0,msdos9" ]; then unset root ; root="sda9" ; fi
    if [ "$root" == "hd1,msdos1" ]; then unset root ; root="sdb1" ; fi
    if [ "$root" == "hd1,msdos2" ]; then unset root ; root="sdb2" ; fi
    if [ "$root" == "hd1,msdos3" ]; then unset root ; root="sdb3" ; fi
    if [ "$root" == "hd1,msdos4" ]; then unset root ; root="sdb4" ; fi
    if [ "$root" == "hd1,msdos5" ]; then unset root ; root="sdb5" ; fi
    if [ "$root" == "hd1,msdos6" ]; then unset root ; root="sdb6" ; fi
    if [ "$root" == "hd1,msdos7" ]; then unset root ; root="sdb7" ; fi
    if [ "$root" == "hd1,msdos8" ]; then unset root ; root="sdb8" ; fi
    if [ "$root" == "hd1,msdos9" ]; then unset root ; root="sdb9" ; fi
    if [ "$root" == "hd2,msdos1" ]; then unset root ; root="sdc1" ; fi
    if [ "$root" == "hd2,msdos2" ]; then unset root ; root="sdc2" ; fi
    if [ "$root" == "hd2,msdos3" ]; then unset root ; root="sdc3" ; fi
    if [ "$root" == "hd2,msdos4" ]; then unset root ; root="sdc4" ; fi
    if [ "$root" == "hd2,msdos5" ]; then unset root ; root="sdc5" ; fi
    if [ "$root" == "hd2,msdos6" ]; then unset root ; root="sdc6" ; fi
    if [ "$root" == "hd2,msdos7" ]; then unset root ; root="sdc7" ; fi
    if [ "$root" == "hd2,msdos8" ]; then unset root ; root="sdc8" ; fi
    if [ "$root" == "hd2,msdos9" ]; then unset root ; root="sdc9" ; fi
    if [ "$root" == "hd3,msdos1" ]; then unset root ; root="sdd1" ; fi
    if [ "$root" == "hd3,msdos2" ]; then unset root ; root="sdd2" ; fi
    if [ "$root" == "hd3,msdos3" ]; then unset root ; root="sdd3" ; fi
    if [ "$root" == "hd3,msdos4" ]; then unset root ; root="sdd4" ; fi
    if [ "$root" == "hd3,msdos5" ]; then unset root ; root="sdd5" ; fi
    if [ "$root" == "hd3,msdos6" ]; then unset root ; root="sdd6" ; fi
    if [ "$root" == "hd3,msdos7" ]; then unset root ; root="sdd7" ; fi
    if [ "$root" == "hd3,msdos8" ]; then unset root ; root="sdd8" ; fi
    if [ "$root" == "hd3,msdos9" ]; then unset root ; root="sdd9" ; fi
    if [ "$root" == "hd4,msdos1" ]; then unset root ; root="sde1" ; fi
    if [ "$root" == "hd4,msdos2" ]; then unset root ; root="sde2" ; fi
    if [ "$root" == "hd4,msdos3" ]; then unset root ; root="sde3" ; fi
    if [ "$root" == "hd4,msdos4" ]; then unset root ; root="sde4" ; fi
    if [ "$root" == "hd4,msdos5" ]; then unset root ; root="sde5" ; fi
    if [ "$root" == "hd4,msdos6" ]; then unset root ; root="sde6" ; fi
    if [ "$root" == "hd4,msdos7" ]; then unset root ; root="sde7" ; fi
    if [ "$root" == "hd4,msdos8" ]; then unset root ; root="sde8" ; fi
    if [ "$root" == "hd4,msdos9" ]; then unset root ; root="sde9" ; fi
    if [ "$root" == "hd5,msdos1" ]; then unset root ; root="sdf1" ; fi
    if [ "$root" == "hd5,msdos2" ]; then unset root ; root="sdf2" ; fi
    if [ "$root" == "hd5,msdos3" ]; then unset root ; root="sdf3" ; fi
    if [ "$root" == "hd5,msdos4" ]; then unset root ; root="sdf4" ; fi
    if [ "$root" == "hd5,msdos5" ]; then unset root ; root="sdf5" ; fi
    if [ "$root" == "hd5,msdos6" ]; then unset root ; root="sdf6" ; fi
    if [ "$root" == "hd5,msdos7" ]; then unset root ; root="sdf7" ; fi
    if [ "$root" == "hd5,msdos8" ]; then unset root ; root="sdf8" ; fi
    if [ "$root" == "hd5,msdos9" ]; then unset root ; root="sdf9" ; fi
    if [ "$root" == "hd6,msdos1" ]; then unset root ; root="sdg1" ; fi
    if [ "$root" == "hd6,msdos2" ]; then unset root ; root="sdg2" ; fi
    if [ "$root" == "hd6,msdos3" ]; then unset root ; root="sdg3" ; fi
    if [ "$root" == "hd6,msdos4" ]; then unset root ; root="sdg4" ; fi
    if [ "$root" == "hd6,msdos5" ]; then unset root ; root="sdg5" ; fi
    if [ "$root" == "hd6,msdos6" ]; then unset root ; root="sdg6" ; fi
    if [ "$root" == "hd6,msdos7" ]; then unset root ; root="sdg7" ; fi
    if [ "$root" == "hd6,msdos8" ]; then unset root ; root="sdg8" ; fi
    if [ "$root" == "hd6,msdos9" ]; then unset root ; root="sdg9" ; fi
    if [ "$root" == "hd7,msdos1" ]; then unset root ; root="sdh1" ; fi
    if [ "$root" == "hd7,msdos2" ]; then unset root ; root="sdh2" ; fi
    if [ "$root" == "hd7,msdos3" ]; then unset root ; root="sdh3" ; fi
    if [ "$root" == "hd7,msdos4" ]; then unset root ; root="sdh4" ; fi
    if [ "$root" == "hd7,msdos5" ]; then unset root ; root="sdh5" ; fi
    if [ "$root" == "hd7,msdos6" ]; then unset root ; root="sdh6" ; fi
    if [ "$root" == "hd7,msdos7" ]; then unset root ; root="sdh7" ; fi
    if [ "$root" == "hd7,msdos8" ]; then unset root ; root="sdh8" ; fi
    if [ "$root" == "hd7,msdos9" ]; then unset root ; root="sdh9" ; fi
    if [ "$root" == "hd8,msdos1" ]; then unset root ; root="sdi1" ; fi
    if [ "$root" == "hd8,msdos2" ]; then unset root ; root="sdi2" ; fi
    if [ "$root" == "hd8,msdos3" ]; then unset root ; root="sdi3" ; fi
    if [ "$root" == "hd8,msdos4" ]; then unset root ; root="sdi4" ; fi
    if [ "$root" == "hd8,msdos5" ]; then unset root ; root="sdi5" ; fi
    if [ "$root" == "hd8,msdos6" ]; then unset root ; root="sdi6" ; fi
    if [ "$root" == "hd8,msdos7" ]; then unset root ; root="sdi7" ; fi
    if [ "$root" == "hd8,msdos8" ]; then unset root ; root="sdi8" ; fi
    if [ "$root" == "hd8,msdos9" ]; then unset root ; root="sdi9" ; fi
    if [ "$root" == "hd9,msdos1" ]; then unset root ; root="sdj1" ; fi
    if [ "$root" == "hd9,msdos2" ]; then unset root ; root="sdj2" ; fi
    if [ "$root" == "hd9,msdos3" ]; then unset root ; root="sdj3" ; fi
    if [ "$root" == "hd9,msdos4" ]; then unset root ; root="sdj4" ; fi
    if [ "$root" == "hd9,msdos5" ]; then unset root ; root="sdj5" ; fi
    if [ "$root" == "hd9,msdos6" ]; then unset root ; root="sdj6" ; fi
    if [ "$root" == "hd9,msdos7" ]; then unset root ; root="sdj7" ; fi
    if [ "$root" == "hd9,msdos8" ]; then unset root ; root="sdj8" ; fi
    if [ "$root" == "hd9,msdos9" ]; then unset root ; root="sdj9" ; fi

루프, 배열 등을 사용하는 것과 같이 grub에서 이 해결 방법이 더 짧아질 수 있는지 누군가 말해 줄 수 있습니까?

Linux가 사용했던 hd "번호"(번호는 0=a, 1=b, 2=c,...와 같이 문자로 변경되어야 함)의 경우 msdos "번호" 번호는 변경되지 않았습니다. 이 전환에서 "msdos"라는 단어가 다시 나타나서는 안 됩니다.

나는 grub이 bash와 호환되기를 원합니다(하지만 더 적은 수의 명령으로). 단 몇 줄로 이 작업을 수행하는 방법을 아는 사람이 있습니까? 저는 매 줄마다 거의 동일한 것을 반복하는 것을 정말로 좋아하지 않습니다.

관련 정보