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
```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
NAME FSTYPE FSVER LABEL
sda

View File

@ -1,4 +1,4 @@
if [ -s $prefix/grubenv ]; then
if [ -s $prefix/grubenv ] ; then
set have_grubenv=true
load_env
fi
@ -12,7 +12,7 @@ else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
if [ x"${feature_menuentry_id}" = xy ] ; then
menuentry_id_option="--id"
else
menuentry_id_option=""
@ -20,7 +20,7 @@ fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
if [ "${prev_saved_entry}" ] ; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
@ -29,7 +29,7 @@ if [ "${prev_saved_entry}" ]; then
fi
function savedefault {
if [ -z "${boot_once}" ]; then
if [ -z "${boot_once}" ] ; then
saved_entry="${chosen}"
save_env saved_entry
fi
@ -37,15 +37,15 @@ function savedefault {
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then
if [ -z "${boot_once}" ]; then
save_env recordfail;
if [ -n "${have_grubenv}" ] ; then
if [ -z "${boot_once}" ] ; then
save_env recordfail
fi;
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
if [ x$feature_all_video_module = xy ] ; then
insmod all_video
else
insmod efi_gop
@ -75,22 +75,23 @@ terminal_output gfxterm
insmod part_msdos
insmod ext2
insmod gfxmenu
insmod regexp
function loadtheme {
theme=$1
theme_name=$1
insmod jpeg
insmod png
for font in ($root)/boot/grub/themes/$theme/*.pf2 ; do
loadfont $font
for font in (${root})/boot/grub/themes/${theme_name}/*.pf2 ; do
loadfont ${font}
done
set theme=($root)/boot/grub/themes/Stylish/theme.txt
set theme=(${root})/boot/grub/themes/${theme_name}/theme.txt
export theme
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set menu_color_normal="white/black"
set menu_color_highlight="black/light-gray"
}
loadtheme "default"
@ -106,13 +107,13 @@ else
fi
fi
if [ "${grub_platform}" = "efi" ]; then
if [ "${grub_platform}" = "efi" ] ; then
rmmod tpm
fi
# Подключение конфигурационных файлов
for cfg in ($root)/boot/grub/menuentries/*.cfg ; do
for cfg in (${root})/boot/grub/menuentries/*.cfg ; do
source $cfg
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%
align = "center"
id = "__timeout__"
text = "Booting in %d seconds"
text = "Автоматическая загрузка через %d секунд"
color = "#cccccc"
font = "Unifont Regular 16"
}

View File

@ -5,7 +5,7 @@
# set -x
SCRIPT_NAME="${0}"
SCRIPT_PATH=$(realpath ${SCRIPT_NAME})
SCRIPT_PATH=$(dirname $(realpath ${SCRIPT_NAME}))
GFU_PARTED=$(which parted 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
fi
mkdir -v -p ${GFU_MOUNT_PATH} 2>/dev/null
if [ ! -d ${GFU_MOUNT_PATH} ] ; then
echo "Path is not a directory: ${GFU_MOUNT_PATH}"
exit 1
@ -117,9 +115,13 @@ main () {
parted ${GFU_DEVICE} -s mklabel gpt
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
if ${GFU_LEGACY_MODE} ; then
parted ${GFU_DEVICE} -s set 1 lba on
fi
mkfs.fat -F32 ${GFU_DEVICE}1
if ! mount -v -o umask=000 ${GFU_DEVICE}1 ${GFU_MOUNT_PATH} ; then
@ -128,10 +130,10 @@ main () {
fi
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
${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_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_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=${GFU_GRUB_EFI_X64} ${GFU_DEVICE}
fi
if [ -d ${SCRIPT_PATH}/grub ] ; then