diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a82daca --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.deb +debian/boot diff --git a/README.md b/README.md new file mode 100644 index 0000000..755a1e5 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Windows GRUB 样式 + +仿写了一个类似 Windows Boot Manager 的 GRUB 主题,简体中文版。 + +## 效果 + +![1](./img/1.png) + +作为对比,这是原版 Windows Boot Manager 在我的电脑中的效果 + +![2](./img/2.png) + +## 使用方法 + +首先你需要准备好你自己的 `微软雅黑` 和 `微软静黑` 字体。文件名一般是 `msyh.ttc` ,`msyhl.ttc` 和 `msjh.ttc`,这个可以从 Windows 获得,在 `C:\Windows\Fonts` 里。 + +### Debian 系简易安装 + +我提供了 deb 安装包,您需要从 release 里下载 deb 包进行安装,同时根据安装时的终端的提示完成字体配置。 + +该 deb 包适用于任何架构,但仅限于 Debian 系发行版。卸载该 deb 包时会打扫干净恢复原样。 + +### 手动安装 + +对于 Debian 系发行版,手动安装的方法是: + +1. 下载本仓库,把本仓库 `src` 目录复制为 `/boot/grub/themes/Windows` 目录。 +2. 修改 `/boot/grub/themes/Windows/theme.txt` 第 35 行为你自己的操作系统。 +3. 修改 `/etc/grub.d/00_header`,在顶上添加一行 + + ```bash + GRUB_THEME=/boot/grub/themes/Windows/theme.txt + ```` + +4. 修改 `/etc/grub.d/10_linux`,在含有 `gettext_printf "Advanced options for %s"` 的那一行(本人电脑是 393 行)里,`\$menuentry_id_option` 前添加一项 `${CLASS}`(前后带空格) +5. 修改 `/etc/grub.d/30_os-prober`,在含有 `gettext_printf "Advanced options for %s"` 的那一行(本人电脑是 291 行)里,`\$menuentry_id_option` 前添加一项 `${CLASS}`(前后带空格) +6. 修改 `/etc/grub.d/30_uefi-firmware`,在含有 `menuentry '$LABEL'` 的那一行(本人电脑是 37 行)里,`\$menuentry_id_option` 前添加一项 `--class efi`(前后带空格) +7. 完成字体配置 + + ```bash + sudo grub-mkfont -s 24 -o /boot/grub/themes/Windows/msjh24.pf2 your/msjh.ttc + sudo grub-mkfont -s 16 -o /boot/grub/themes/Windows/msyh16.pf2 your/msyh.ttc + sudo grub-mkfont -s 64 -o /boot/grub/themes/Windows/msyh64.pf2 your/msyhl.ttc + ``` + +8. 执行 `update-grub` + +其他发行版暂不清楚能否可以运行,但方法类似。 + +## 感谢 + +图标来自于 [https://github.com/MrVivekRajan/Grub-Themes](https://github.com/MrVivekRajan/Grub-Themes) 的二次制作。 + +## 免责声明 + +本仓库仅供学习交流使用,禁止用于商用,若使用本仓库内容请标明出处。 + +使用本开源仓库及其成果时,您知道可能对你的计算机产生危害,产生的一切损失由使用者承担。 diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control new file mode 100644 index 0000000..bcbff6a --- /dev/null +++ b/debian/DEBIAN/control @@ -0,0 +1,5 @@ +Package: grub-theme-windows +Version: 1.0.0 +Architecture: all +Maintainer: github.com/KZ25T +Description: A windows-like GRUB theme diff --git a/debian/DEBIAN/postinst b/debian/DEBIAN/postinst new file mode 100755 index 0000000..b32a7f9 --- /dev/null +++ b/debian/DEBIAN/postinst @@ -0,0 +1,21 @@ +#!/bin/bash +cp -r /etc/grub.d /etc/grub.d.bak +source /etc/os-release +echo "generating for $NAME" +sed -i '/^prefix=/i GRUB_THEME=/boot/grub/themes/Windows/theme.txt' /etc/grub.d/00_header +sed -i 's/\(.*Advanced options for %s.*\)\\\$menuentry/\1\${CLASS} \\\$menuentry/' /etc/grub.d/10_linux +sed -i 's/\(.*Advanced options for %s.*\)\\\$menuentry/\1\${CLASS} \\\$menuentry/' /etc/grub.d/30_os-prober +sed -i 's|^\(.*\)\\$menuentry_id_option|\1--class efi \\$menuentry_id_option|' /etc/grub.d/30_uefi-firmware +sed -i "s#HOST_DISTRO#$NAME#g" /boot/grub/themes/Windows/theme.txt +update-grub + +echo -e "\e[1;33m" +echo "Attention: This is NOT an ERROR but you have to read it." +echo "We didn't prepare font file because of copyright. YOU SHOULD DO IT YOURSELF LIKE BELOW." +echo "You should prepare your Microsoft YaHei and JhengHei font, name like: msjh.ttc msyh.ttc msyhl.ttc from Windows." +echo "Then run command below:" +echo "\$ sudo grub-mkfont -s 24 -o /boot/grub/themes/Windows/msjh24.pf2 your/msjh.ttc" +echo "\$ sudo grub-mkfont -s 16 -o /boot/grub/themes/Windows/msyh16.pf2 your/msyh.ttc" +echo "\$ sudo grub-mkfont -s 64 -o /boot/grub/themes/Windows/msyh64.pf2 your/msyhl.ttc" +read -s -n 1 -p "DO YOU KNOW THAT? Press RETURN to continue." +echo -e "\e[0m" diff --git a/debian/DEBIAN/postrm b/debian/DEBIAN/postrm new file mode 100755 index 0000000..553f1f9 --- /dev/null +++ b/debian/DEBIAN/postrm @@ -0,0 +1,16 @@ +#!/bin/bash +dir_A="/etc/grub.d.bak" +dir_B="/etc/grub.d" + +if [ -d "$dir_A" ]; then + if [ -d "$dir_B" ]; then + rm -r "$dir_B" + mv "$dir_A" "$dir_B" + else + echo "We have not found $dir_B, maybe it's wrong, please fix it yourself. Hope you a good luck." + fi +else + echo "Directory $dir_A does not exist, no action taken. Maybe it's wrong, please fix it yourself. Hope you a good luck." +fi + +update-grub diff --git a/img/1.png b/img/1.png new file mode 100644 index 0000000..98654f1 Binary files /dev/null and b/img/1.png differ diff --git a/img/2.png b/img/2.png new file mode 100644 index 0000000..fd7eb0c Binary files /dev/null and b/img/2.png differ diff --git a/src/frame_c.png b/src/frame_c.png new file mode 100644 index 0000000..6300b2b Binary files /dev/null and b/src/frame_c.png differ diff --git a/src/frame_e.png b/src/frame_e.png new file mode 100644 index 0000000..c0346b1 Binary files /dev/null and b/src/frame_e.png differ diff --git a/src/frame_w.png b/src/frame_w.png new file mode 100644 index 0000000..b0e960c Binary files /dev/null and b/src/frame_w.png differ diff --git a/src/icons/4MLinux.png b/src/icons/4MLinux.png new file mode 100644 index 0000000..cc7db38 Binary files /dev/null and b/src/icons/4MLinux.png differ diff --git a/src/icons/AlpineLinux.png b/src/icons/AlpineLinux.png new file mode 100644 index 0000000..8e8b1c6 Binary files /dev/null and b/src/icons/AlpineLinux.png differ diff --git a/src/icons/Manjaro.i686.png b/src/icons/Manjaro.i686.png new file mode 100644 index 0000000..ebf6b95 Binary files /dev/null and b/src/icons/Manjaro.i686.png differ diff --git a/src/icons/Manjaro.x86_64.png b/src/icons/Manjaro.x86_64.png new file mode 100644 index 0000000..ebf6b95 Binary files /dev/null and b/src/icons/Manjaro.x86_64.png differ diff --git a/src/icons/SystemRescueCD.png b/src/icons/SystemRescueCD.png new file mode 100644 index 0000000..8df285b Binary files /dev/null and b/src/icons/SystemRescueCD.png differ diff --git a/src/icons/alma.png b/src/icons/alma.png new file mode 100644 index 0000000..f898e62 Binary files /dev/null and b/src/icons/alma.png differ diff --git a/src/icons/android.png b/src/icons/android.png new file mode 100644 index 0000000..c604976 Binary files /dev/null and b/src/icons/android.png differ diff --git a/src/icons/anonymous.png b/src/icons/anonymous.png new file mode 100644 index 0000000..d0c4458 Binary files /dev/null and b/src/icons/anonymous.png differ diff --git a/src/icons/antergos.png b/src/icons/antergos.png new file mode 100644 index 0000000..88426b8 Binary files /dev/null and b/src/icons/antergos.png differ diff --git a/src/icons/arch-advance.png b/src/icons/arch-advance.png new file mode 100644 index 0000000..c029439 Binary files /dev/null and b/src/icons/arch-advance.png differ diff --git a/src/icons/arch.png b/src/icons/arch.png new file mode 100644 index 0000000..11a5e06 Binary files /dev/null and b/src/icons/arch.png differ diff --git a/src/icons/archcraft.png b/src/icons/archcraft.png new file mode 100644 index 0000000..0e9eb8a Binary files /dev/null and b/src/icons/archcraft.png differ diff --git a/src/icons/arcolinux.png b/src/icons/arcolinux.png new file mode 100644 index 0000000..bca546d Binary files /dev/null and b/src/icons/arcolinux.png differ diff --git a/src/icons/artix.png b/src/icons/artix.png new file mode 100644 index 0000000..1e83e62 Binary files /dev/null and b/src/icons/artix.png differ diff --git a/src/icons/bedrock.png b/src/icons/bedrock.png new file mode 100644 index 0000000..f635799 Binary files /dev/null and b/src/icons/bedrock.png differ diff --git a/src/icons/cancel.png b/src/icons/cancel.png new file mode 100644 index 0000000..c239125 Binary files /dev/null and b/src/icons/cancel.png differ diff --git a/src/icons/centos.png b/src/icons/centos.png new file mode 100644 index 0000000..879f2f2 Binary files /dev/null and b/src/icons/centos.png differ diff --git a/src/icons/chakra.png b/src/icons/chakra.png new file mode 100644 index 0000000..d763f39 Binary files /dev/null and b/src/icons/chakra.png differ diff --git a/src/icons/chromeos.png b/src/icons/chromeos.png new file mode 100644 index 0000000..1b26961 Binary files /dev/null and b/src/icons/chromeos.png differ diff --git a/src/icons/debian-advance.png b/src/icons/debian-advance.png new file mode 100644 index 0000000..83810b0 Binary files /dev/null and b/src/icons/debian-advance.png differ diff --git a/src/icons/debian.png b/src/icons/debian.png new file mode 100644 index 0000000..c26a46c Binary files /dev/null and b/src/icons/debian.png differ diff --git a/src/icons/deepin.png b/src/icons/deepin.png new file mode 100644 index 0000000..10ffcc0 Binary files /dev/null and b/src/icons/deepin.png differ diff --git a/src/icons/devuan.png b/src/icons/devuan.png new file mode 100644 index 0000000..d7fdb96 Binary files /dev/null and b/src/icons/devuan.png differ diff --git a/src/icons/driver.png b/src/icons/driver.png new file mode 100644 index 0000000..1d2a1a3 Binary files /dev/null and b/src/icons/driver.png differ diff --git a/src/icons/edit.png b/src/icons/edit.png new file mode 100644 index 0000000..95dd854 Binary files /dev/null and b/src/icons/edit.png differ diff --git a/src/icons/efi.png b/src/icons/efi.png new file mode 100644 index 0000000..b9cf070 Binary files /dev/null and b/src/icons/efi.png differ diff --git a/src/icons/elementary.png b/src/icons/elementary.png new file mode 100644 index 0000000..4fa4c3f Binary files /dev/null and b/src/icons/elementary.png differ diff --git a/src/icons/endeavouros.png b/src/icons/endeavouros.png new file mode 100644 index 0000000..123adb2 Binary files /dev/null and b/src/icons/endeavouros.png differ diff --git a/src/icons/fedora.png b/src/icons/fedora.png new file mode 100644 index 0000000..d73fca4 Binary files /dev/null and b/src/icons/fedora.png differ diff --git a/src/icons/find.efi.png b/src/icons/find.efi.png new file mode 100644 index 0000000..953ce4a Binary files /dev/null and b/src/icons/find.efi.png differ diff --git a/src/icons/find.none.png b/src/icons/find.none.png new file mode 100644 index 0000000..d1dc2f4 Binary files /dev/null and b/src/icons/find.none.png differ diff --git a/src/icons/freebsd.png b/src/icons/freebsd.png new file mode 100644 index 0000000..5e609cb Binary files /dev/null and b/src/icons/freebsd.png differ diff --git a/src/icons/garuda.png b/src/icons/garuda.png new file mode 100644 index 0000000..f303aba Binary files /dev/null and b/src/icons/garuda.png differ diff --git a/src/icons/gentoo.png b/src/icons/gentoo.png new file mode 100644 index 0000000..d82e8c4 Binary files /dev/null and b/src/icons/gentoo.png differ diff --git a/src/icons/gnu-linux.png b/src/icons/gnu-linux.png new file mode 100644 index 0000000..821bd4f Binary files /dev/null and b/src/icons/gnu-linux.png differ diff --git a/src/icons/haiku.png b/src/icons/haiku.png new file mode 100644 index 0000000..409b218 Binary files /dev/null and b/src/icons/haiku.png differ diff --git a/src/icons/help.png b/src/icons/help.png new file mode 100644 index 0000000..62f3738 Binary files /dev/null and b/src/icons/help.png differ diff --git a/src/icons/kali.png b/src/icons/kali.png new file mode 100644 index 0000000..201c912 Binary files /dev/null and b/src/icons/kali.png differ diff --git a/src/icons/kaos.png b/src/icons/kaos.png new file mode 100644 index 0000000..edc118d Binary files /dev/null and b/src/icons/kaos.png differ diff --git a/src/icons/kbd.png b/src/icons/kbd.png new file mode 100644 index 0000000..058599a Binary files /dev/null and b/src/icons/kbd.png differ diff --git a/src/icons/korora.png b/src/icons/korora.png new file mode 100644 index 0000000..e841133 Binary files /dev/null and b/src/icons/korora.png differ diff --git a/src/icons/kubuntu.png b/src/icons/kubuntu.png new file mode 100644 index 0000000..a89c8a7 Binary files /dev/null and b/src/icons/kubuntu.png differ diff --git a/src/icons/lang.png b/src/icons/lang.png new file mode 100644 index 0000000..5e8d3cd Binary files /dev/null and b/src/icons/lang.png differ diff --git a/src/icons/lfs.png b/src/icons/lfs.png new file mode 100644 index 0000000..821bd4f Binary files /dev/null and b/src/icons/lfs.png differ diff --git a/src/icons/linux.png b/src/icons/linux.png new file mode 100644 index 0000000..821bd4f Binary files /dev/null and b/src/icons/linux.png differ diff --git a/src/icons/linuxlite.png b/src/icons/linuxlite.png new file mode 100644 index 0000000..70e00ef Binary files /dev/null and b/src/icons/linuxlite.png differ diff --git a/src/icons/linuxmint.png b/src/icons/linuxmint.png new file mode 100644 index 0000000..74def0f Binary files /dev/null and b/src/icons/linuxmint.png differ diff --git a/src/icons/lubuntu.png b/src/icons/lubuntu.png new file mode 100644 index 0000000..187aa30 Binary files /dev/null and b/src/icons/lubuntu.png differ diff --git a/src/icons/macosx.png b/src/icons/macosx.png new file mode 100644 index 0000000..e0a1ff8 Binary files /dev/null and b/src/icons/macosx.png differ diff --git a/src/icons/mageia.png b/src/icons/mageia.png new file mode 100644 index 0000000..321efa1 Binary files /dev/null and b/src/icons/mageia.png differ diff --git a/src/icons/manjaro.png b/src/icons/manjaro.png new file mode 100644 index 0000000..ebf6b95 Binary files /dev/null and b/src/icons/manjaro.png differ diff --git a/src/icons/mate.png b/src/icons/mate.png new file mode 100644 index 0000000..12a64ed Binary files /dev/null and b/src/icons/mate.png differ diff --git a/src/icons/memtest.png b/src/icons/memtest.png new file mode 100644 index 0000000..1d2a1a3 Binary files /dev/null and b/src/icons/memtest.png differ diff --git a/src/icons/mx-linux.png b/src/icons/mx-linux.png new file mode 100644 index 0000000..c5d31a8 Binary files /dev/null and b/src/icons/mx-linux.png differ diff --git a/src/icons/neon.png b/src/icons/neon.png new file mode 100644 index 0000000..5701792 Binary files /dev/null and b/src/icons/neon.png differ diff --git a/src/icons/nix.png b/src/icons/nix.png new file mode 100644 index 0000000..168dda5 Binary files /dev/null and b/src/icons/nix.png differ diff --git a/src/icons/nixos.png b/src/icons/nixos.png new file mode 100644 index 0000000..168dda5 Binary files /dev/null and b/src/icons/nixos.png differ diff --git a/src/icons/nobara.png b/src/icons/nobara.png new file mode 100644 index 0000000..a2613ef Binary files /dev/null and b/src/icons/nobara.png differ diff --git a/src/icons/opensuse.png b/src/icons/opensuse.png new file mode 100644 index 0000000..ea49c85 Binary files /dev/null and b/src/icons/opensuse.png differ diff --git a/src/icons/parrot.png b/src/icons/parrot.png new file mode 100644 index 0000000..3f33a67 Binary files /dev/null and b/src/icons/parrot.png differ diff --git a/src/icons/pop-os.png b/src/icons/pop-os.png new file mode 100644 index 0000000..e8ccf3e Binary files /dev/null and b/src/icons/pop-os.png differ diff --git a/src/icons/pop.png b/src/icons/pop.png new file mode 100644 index 0000000..e8ccf3e Binary files /dev/null and b/src/icons/pop.png differ diff --git a/src/icons/recovery.png b/src/icons/recovery.png new file mode 100644 index 0000000..4e680b2 Binary files /dev/null and b/src/icons/recovery.png differ diff --git a/src/icons/regolith.png b/src/icons/regolith.png new file mode 100644 index 0000000..9bb02ad Binary files /dev/null and b/src/icons/regolith.png differ diff --git a/src/icons/restart.png b/src/icons/restart.png new file mode 100644 index 0000000..7154ee4 Binary files /dev/null and b/src/icons/restart.png differ diff --git a/src/icons/rocky.png b/src/icons/rocky.png new file mode 100644 index 0000000..b7815e3 Binary files /dev/null and b/src/icons/rocky.png differ diff --git a/src/icons/shutdown.png b/src/icons/shutdown.png new file mode 100644 index 0000000..04f7b5a Binary files /dev/null and b/src/icons/shutdown.png differ diff --git a/src/icons/siduction.png b/src/icons/siduction.png new file mode 100644 index 0000000..5419604 Binary files /dev/null and b/src/icons/siduction.png differ diff --git a/src/icons/silverblue.png b/src/icons/silverblue.png new file mode 100644 index 0000000..f769918 Binary files /dev/null and b/src/icons/silverblue.png differ diff --git a/src/icons/slackware.png b/src/icons/slackware.png new file mode 100644 index 0000000..a021f96 Binary files /dev/null and b/src/icons/slackware.png differ diff --git a/src/icons/solus.png b/src/icons/solus.png new file mode 100644 index 0000000..64ba75f Binary files /dev/null and b/src/icons/solus.png differ diff --git a/src/icons/steamos.png b/src/icons/steamos.png new file mode 100644 index 0000000..660231a Binary files /dev/null and b/src/icons/steamos.png differ diff --git a/src/icons/type.png b/src/icons/type.png new file mode 100644 index 0000000..f360c4c Binary files /dev/null and b/src/icons/type.png differ diff --git a/src/icons/tz.png b/src/icons/tz.png new file mode 100644 index 0000000..ca6c4fd Binary files /dev/null and b/src/icons/tz.png differ diff --git a/src/icons/ubuntu.png b/src/icons/ubuntu.png new file mode 100644 index 0000000..7874b4b Binary files /dev/null and b/src/icons/ubuntu.png differ diff --git a/src/icons/ultramarine.png b/src/icons/ultramarine.png new file mode 100644 index 0000000..edc5f96 Binary files /dev/null and b/src/icons/ultramarine.png differ diff --git a/src/icons/unknown.png b/src/icons/unknown.png new file mode 100644 index 0000000..821bd4f Binary files /dev/null and b/src/icons/unknown.png differ diff --git a/src/icons/unset.png b/src/icons/unset.png new file mode 100644 index 0000000..bf04861 Binary files /dev/null and b/src/icons/unset.png differ diff --git a/src/icons/vanillaos.png b/src/icons/vanillaos.png new file mode 100644 index 0000000..9859250 Binary files /dev/null and b/src/icons/vanillaos.png differ diff --git a/src/icons/ventoy.png b/src/icons/ventoy.png new file mode 100644 index 0000000..8fc3e7a Binary files /dev/null and b/src/icons/ventoy.png differ diff --git a/src/icons/void.png b/src/icons/void.png new file mode 100644 index 0000000..651a3a5 Binary files /dev/null and b/src/icons/void.png differ diff --git a/src/icons/windows.png b/src/icons/windows.png new file mode 100644 index 0000000..442058b Binary files /dev/null and b/src/icons/windows.png differ diff --git a/src/icons/xero.png b/src/icons/xero.png new file mode 100644 index 0000000..fbc448a Binary files /dev/null and b/src/icons/xero.png differ diff --git a/src/icons/xerolinux.png b/src/icons/xerolinux.png new file mode 100644 index 0000000..fbc448a Binary files /dev/null and b/src/icons/xerolinux.png differ diff --git a/src/icons/xubuntu.png b/src/icons/xubuntu.png new file mode 100644 index 0000000..c140871 Binary files /dev/null and b/src/icons/xubuntu.png differ diff --git a/src/icons/zorin.png b/src/icons/zorin.png new file mode 100644 index 0000000..b2787dc Binary files /dev/null and b/src/icons/zorin.png differ diff --git a/src/msjh24.pf2 b/src/msjh24.pf2 new file mode 100644 index 0000000..e69de29 diff --git a/src/msyh16.pf2 b/src/msyh16.pf2 new file mode 100644 index 0000000..e69de29 diff --git a/src/msyh64.pf2 b/src/msyh64.pf2 new file mode 100644 index 0000000..e69de29 diff --git a/src/theme.txt b/src/theme.txt new file mode 100644 index 0000000..bc4e4c4 --- /dev/null +++ b/src/theme.txt @@ -0,0 +1,45 @@ +# Global Property +title-text: "" +desktop-color: "#2165b5" +terminal-left: "0" +terminal-top: "0" +terminal-width: "100%" +terminal-height: "100%" +terminal-border: "0" +terminal-font: "GNU Unifont Regular 16" + +# Show the boot menu ++ boot_menu { + left = 8% + top = 17% + width = 500 + height = 70% + item_font = "Microsoft JhengHei Regular 24" + item_color = "#ffffff" + icon_width = 128 + icon_height = 128 + item_icon_space = 10 + item_height = 144 + item_padding = 10 + item_spacing = 10 + selected_item_pixmap_style = "frame_*.png" +} + +# Show a countdown message using the label component ++ label { + top = 13% + left = 9% + width = 30% + id = "__timeout__" + font = "Microsoft YaHei Regular 16" + text = "HOST_DISTRO 将在 %d 秒 内自动运行。" + color = "#ffffff" +} + ++ label { + text = "选择操作系统" + font = "Microsoft YaHei Regular 64" + top = 3% + left = 9% + color = "#ffffff" +}