fix errors

This commit is contained in:
Alexander Zhirov 2024-10-14 18:20:36 +03:00
parent f9e5de3364
commit 8b273390c2
5 changed files with 27 additions and 49 deletions

View File

@ -1,30 +1,5 @@
# GRUB for USB # GRUB for USB
```sh
#!/bin/bash
disk="${1}"
parted ${disk} -s mklabel gpt
parted ${disk} -s -- mkpart primary 2048s 2099199s
parted ${disk} -s -- mkpart primary 2099200s 40G
parted ${disk} -s -- mkpart primary 40G 100%
parted ${disk} -s set 1 boot on
mkfs.fat -F32 ${disk}1
mkfs.ext4 -F ${disk}2
mount -v -o umask=000 ${disk}1 /mnt
grub-install --removable --boot-directory=/mnt/boot --efi-directory=/mnt --target=x86_64-efi ${disk}
grub-install --removable --boot-directory=/mnt/boot --efi-directory=/mnt --target=i386-efi ${disk}
touch /mnt/boot/grub/grub.cfg
umount -v ${disk}1
```
```sh ```sh
NAME FSTYPE FSVER LABEL NAME FSTYPE FSVER LABEL
sda sda

View File

@ -39,7 +39,7 @@ function recordfail {
set recordfail=1 set recordfail=1
if [ -n "${have_grubenv}" ] ; then if [ -n "${have_grubenv}" ] ; then
if [ -z "${boot_once}" ] ; then if [ -z "${boot_once}" ] ; then
save_env recordfail; save_env recordfail
fi; fi;
fi fi
} }
@ -75,22 +75,23 @@ terminal_output gfxterm
insmod part_msdos insmod part_msdos
insmod ext2 insmod ext2
insmod gfxmenu insmod gfxmenu
insmod regexp
function loadtheme { function loadtheme {
theme=$1 theme_name=$1
insmod jpeg insmod jpeg
insmod png insmod png
for font in ($root)/boot/grub/themes/$theme/*.pf2 ; do for font in (${root})/boot/grub/themes/${theme_name}/*.pf2 ; do
loadfont $font loadfont ${font}
done done
set theme=($root)/boot/grub/themes/Stylish/theme.txt set theme=(${root})/boot/grub/themes/${theme_name}/theme.txt
export theme export theme
set menu_color_normal=white/black set menu_color_normal="white/black"
set menu_color_highlight=black/light-gray set menu_color_highlight="black/light-gray"
} }
loadtheme "default" loadtheme "default"
@ -112,7 +113,7 @@ fi
# Подключение конфигурационных файлов # Подключение конфигурационных файлов
for cfg in ($root)/boot/grub/menuentries/*.cfg ; do for cfg in (${root})/boot/grub/menuentries/*.cfg ; do
source $cfg source $cfg
done done

BIN
grub/themes/default/background.jpg Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -38,7 +38,7 @@ terminal-border: "0"
width = 30% width = 30%
align = "center" align = "center"
id = "__timeout__" id = "__timeout__"
text = "Booting in %d seconds" text = "Автоматическая загрузка через %d секунд"
color = "#cccccc" color = "#cccccc"
font = "Unifont Regular 16" font = "Unifont Regular 16"
} }

View File

@ -5,7 +5,7 @@
# set -x # set -x
SCRIPT_NAME="${0}" SCRIPT_NAME="${0}"
SCRIPT_PATH=$(realpath ${SCRIPT_NAME}) SCRIPT_PATH=$(dirname $(realpath ${SCRIPT_NAME}))
GFU_PARTED=$(which parted 2>/dev/null) GFU_PARTED=$(which parted 2>/dev/null)
GFU_GRUB=$(which grub-install 2>/dev/null) GFU_GRUB=$(which grub-install 2>/dev/null)
@ -83,8 +83,6 @@ main () {
! ${GFU_GRUB_EFI_MODE_X32} && ! ${GFU_GRUB_EFI_MODE_X64} && echo "No EFI bootloader was found for installation: ${GFU_GRUB_EFI_X32} or ${GFU_GRUB_EFI_X64}" && exit 1 ! ${GFU_GRUB_EFI_MODE_X32} && ! ${GFU_GRUB_EFI_MODE_X64} && echo "No EFI bootloader was found for installation: ${GFU_GRUB_EFI_X32} or ${GFU_GRUB_EFI_X64}" && exit 1
fi fi
mkdir -v -p ${GFU_MOUNT_PATH} 2>/dev/null
if [ ! -d ${GFU_MOUNT_PATH} ] ; then if [ ! -d ${GFU_MOUNT_PATH} ] ; then
echo "Path is not a directory: ${GFU_MOUNT_PATH}" echo "Path is not a directory: ${GFU_MOUNT_PATH}"
exit 1 exit 1
@ -117,9 +115,13 @@ main () {
parted ${GFU_DEVICE} -s mklabel gpt parted ${GFU_DEVICE} -s mklabel gpt
fi fi
parted ${GFU_DEVICE} -s -- mkpart primary 2048s 2099199s parted ${GFU_DEVICE} -s -- mkpart primary fat32 2048s 2099199s
parted ${GFU_DEVICE} -s set 1 boot on parted ${GFU_DEVICE} -s set 1 boot on
if ${GFU_LEGACY_MODE} ; then
parted ${GFU_DEVICE} -s set 1 lba on
fi
mkfs.fat -F32 ${GFU_DEVICE}1 mkfs.fat -F32 ${GFU_DEVICE}1
if ! mount -v -o umask=000 ${GFU_DEVICE}1 ${GFU_MOUNT_PATH} ; then if ! mount -v -o umask=000 ${GFU_DEVICE}1 ${GFU_MOUNT_PATH} ; then
@ -128,10 +130,10 @@ main () {
fi fi
if ${GFU_LEGACY_MODE} ; then if ${GFU_LEGACY_MODE} ; then
${GFU_GRUB_LEGACY_MODE} && grub-install --no-floppy --boot-directory=${GFU_MOUNT_PATH}/boot --target=i386-pc ${GFU_DEVICE} ${GFU_GRUB_LEGACY_MODE} && grub-install --no-floppy --boot-directory=${GFU_MOUNT_PATH}/boot --target=${GFU_GRUB_LEGACY} ${GFU_DEVICE}
else else
${GFU_GRUB_EFI_MODE_X32} && grub-install --removable --boot-directory=${GFU_MOUNT_PATH}/boot --efi-directory=${GFU_MOUNT_PATH} --target=i386-efi ${GFU_DEVICE} ${GFU_GRUB_EFI_MODE_X32} && grub-install --removable --boot-directory=${GFU_MOUNT_PATH}/boot --efi-directory=${GFU_MOUNT_PATH} --target=${GFU_GRUB_EFI_X32} ${GFU_DEVICE}
${GFU_GRUB_EFI_MODE_X64} && grub-install --removable --boot-directory=${GFU_MOUNT_PATH}/boot --efi-directory=${GFU_MOUNT_PATH} --target=x86_64-efi ${GFU_DEVICE} ${GFU_GRUB_EFI_MODE_X64} && grub-install --removable --boot-directory=${GFU_MOUNT_PATH}/boot --efi-directory=${GFU_MOUNT_PATH} --target=${GFU_GRUB_EFI_X64} ${GFU_DEVICE}
fi fi
if [ -d ${SCRIPT_PATH}/grub ] ; then if [ -d ${SCRIPT_PATH}/grub ] ; then