From 8b273390c258071ab9f6ba4d1a8097dfa4a0c07b Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Mon, 14 Oct 2024 18:20:36 +0300 Subject: [PATCH] fix errors --- README.md | 25 ---------------------- grub/grub.cfg | 33 +++++++++++++++-------------- grub/themes/default/background.jpg | Bin 24828 -> 33267 bytes grub/themes/default/theme.txt | 2 +- install.sh | 16 ++++++++------ 5 files changed, 27 insertions(+), 49 deletions(-) mode change 100755 => 100644 grub/themes/default/background.jpg diff --git a/README.md b/README.md index cc0b351..cf480ae 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/grub/grub.cfg b/grub/grub.cfg index d50773a..7b8426b 100755 --- a/grub/grub.cfg +++ b/grub/grub.cfg @@ -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 diff --git a/grub/themes/default/background.jpg b/grub/themes/default/background.jpg old mode 100755 new mode 100644 index 907a48434328b56c831e6ea6d25f46bacc0b0955..b1bd2c9e21288dccad7922079080c9163d74b69a GIT binary patch literal 33267 zcmeIwIZzW(0D$55vb)(0Fu+R!K?af`1dVnaD%v=JqR@f29eCS;2kMM7f;S!B+JQG6 zDtJ_)h)0JfU?bjIfj2hs1st8RQX8B9?d)sz?aur6eX;)7Q;}L(UQsTj6hi7t#GZ&U zVHu`r8kU|c%W~UEj;%*ZVxlKWrFgw6MJZo;R>0@aOj9Z&CnGaEI}{4}0^vwF7|9BT zg7J??{i^M@lN~2H=vV&WUys-|p&YZ=-fqaSa4Bgh8S4=ty-!Py4e?`0mtpE%I-Z0? zy`VEyxTImY^!{~#UcF5}7pAhjIr$}SUsa7AuJac(wzN9Ar5)XA)qTT}!rJ;KPeOVi zV?t)$#7WV~Q;Mcen_fI)X4&jH<#Xp%RL)`90!{#kp zckJA?d(Yl|&HE1=JaqWT(PPKkPMkb-`pnsL?dLCC?CiR9`O4MnH+pXN-nxC~?!EgD z9zJ^9KQK7-?D>nAuU@}-`)=g@hmW5=fB8E4E#4)CF`lL8@vz^zlZ~>ccaXm?cJgo1^W~Xj`-3<{w}H0~o*n1~7mD3}65Q7{CAqFn|FJU;qOczyJm? zfB_6(00S7n00uCC0SsUO0~o*n1~7mD3}65Q7{CAqFn|FJU;qOczyJm?fB_6(00S7n z00uCC0SsUO0~o*n1~7mD3}65Q7{CAqFn|FJU;qOczyJm?fB_6(00S7n00uCC0SsUO u0~o*n1~7mD3}65Q7{CAqFn|FJU;qOczyJm?fB_6(00S7n!2dK58~6@FgdTSQ literal 24828 zcmeI(J4ysW5C-6?X&);X%zz$X^F4ss1j2%z$5ikL9>KGShwzc?O~xJ>m0k7$8-JB` z^Y?=/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