>From be9cfcf212fd923ac476233463d83f75f1ee5a9d Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Tue, 3 Mar 2020 20:50:43 +0700 Subject: [PATCH 1/4] grub: Added submenu for languages change --- features.in/grub/cfg.in/00defaults.cfg | 1 + features.in/grub/cfg.in/20install2.cfg | 2 +- features.in/grub/cfg.in/25install-vnc-connect.cfg | 2 +- features.in/grub/cfg.in/25install-vnc-listen.cfg | 2 +- features.in/grub/cfg.in/30live.cfg | 2 +- features.in/grub/cfg.in/32live_rw.cfg | 2 +- features.in/grub/cfg.in/40lang.cfg | 14 ++++++++++++++ features.in/grub/generate.mk | 10 ++++++++++ 8 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 features.in/grub/cfg.in/40lang.cfg diff --git a/features.in/grub/cfg.in/00defaults.cfg b/features.in/grub/cfg.in/00defaults.cfg index 88b56d9873..cad492cd73 100644 --- a/features.in/grub/cfg.in/00defaults.cfg +++ b/features.in/grub/cfg.in/00defaults.cfg @@ -4,3 +4,4 @@ insmod minicmd insmod normal insmod test set timeout=@timeout@ +if [ ! "$language" ]; then language=@LOCALE@; fi diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg index 9cf86bbed0..b88f44ae01 100644 --- a/features.in/grub/cfg.in/20install2.cfg +++ b/features.in/grub/cfg.in/20install2.cfg @@ -1,6 +1,6 @@ default='linux' menuentry 'Install @relname@' --hotkey 'i' --id 'linux' { - linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ + linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ lang=$language initrd@linux_suffix@ @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg index b4a435dc58..7a1ce36d25 100644 --- a/features.in/grub/cfg.in/25install-vnc-connect.cfg +++ b/features.in/grub/cfg.in/25install-vnc-connect.cfg @@ -1,5 +1,5 @@ menuentry '^VNC install @relname@ (edit to set server IP address)' --id 'vncconnect' { - linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP + linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP lang=$language initrd@linux_suffix@ @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg index 7b6146ad0c..90a285fdda 100644 --- a/features.in/grub/cfg.in/25install-vnc-listen.cfg +++ b/features.in/grub/cfg.in/25install-vnc-listen.cfg @@ -1,6 +1,6 @@ menuentry 'VNC install @relname@ (, set password and connect here)' --id 'vncpasswd' { - linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD + linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$language initrd@linux_suffix@ @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg index 5e4b85ada6..be62b59a79 100644 --- a/features.in/grub/cfg.in/30live.cfg +++ b/features.in/grub/cfg.in/30live.cfg @@ -1,5 +1,5 @@ menuentry 'LiveCD (no hard disk needed)' --id 'live' { - linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ + linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ lang=$language initrd@linux_suffix@ @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg index 4bac28aa65..240b6a4e12 100644 --- a/features.in/grub/cfg.in/32live_rw.cfg +++ b/features.in/grub/cfg.in/32live_rw.cfg @@ -1,4 +1,4 @@ menuentry 'LiveCD with sessions support' --id 'session' { - linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ + linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ lang=$language initrd@linux_suffix@ @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/40lang.cfg b/features.in/grub/cfg.in/40lang.cfg new file mode 100644 index 0000000000..85cc9241a1 --- /dev/null +++ b/features.in/grub/cfg.in/40lang.cfg @@ -0,0 +1,14 @@ +submenu "Change Language" { + insmod regexp + for langstr in "ru_RU=Russian" "en_US=English" "pt_BR=Portuguese" "kk_KZ=Kazakh" "uk_UA=Ukrainian"; do + regexp -s 2:langname -s 1:langcode '(.*)=(.*)' "$langstr" + menuentry "${langname}" "$langcode" { + language="$2" + export language + configfile ${prefix}/grub.cfg + } + done + menuentry "Return to the Main menu" { + configfile ${prefix}/grub.cfg + } +} diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk index 3a9f332fd7..f6bdd586e2 100644 --- a/features.in/grub/generate.mk +++ b/features.in/grub/generate.mk @@ -19,6 +19,10 @@ ifndef GRUB_DIRECT GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults fwsetup_efi endif +ifdef LOCALE +GRUB_CFG := $(GRUB_CFG) lang +endif + DSTDIR := $(BUILDDIR)/stage1/files/boot/grub/.in DSTCFGS := $(DSTDIR)/*.cfg @@ -77,6 +81,12 @@ bootargs: clean sed -i "s,@bootvga@,$(BOOTVGA)," $(DSTCFGS); \ fi; \ sed -i "s,@bootvga@,,;s,vga= ,," $(DSTCFGS) + @if [ -n "$(LOCALE)" ]; then \ + sed -i "s,@LOCALE@,$(LOCALE),g" $(DSTCFGS); \ + else \ + sed -i "s, lang=.language,,g" $(DSTCFGS); \ + fi; \ + sed -i "/language=@LOCALE@/d" $(DSTCFGS) clean: copy @if [ "$(GRUB_UI)" = gfxboot ]; then \ -- 2.24.1