[PATCH 1/4] grub: Added submenu for languages change
Anton Midyukov
antohami at altlinux.org
Tue Mar 3 16:50:43 MSK 2020
---
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@ (<E>, 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
--------------06E346EE013123DEE309E4A9
Content-Type: text/x-patch; charset=UTF-8;
name="0004-grub-Added-submenu-for-kernel-flavour-change.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0004-grub-Added-submenu-for-kernel-flavour-change.patch"
More information about the devel-distro
mailing list