Skip to main content

Preview a GRUB 2.x theme using KVM/QEMU

Project description

pre-commit Run Python test suite Packaging status

About

grub2-theme-preview came into life when I was looking around for available GRUB 2.x themes and wanted a way to quickly see a theme in action without rebooting real hardware.

It takes a theme folder (or just a single picture), creates a temporary bootable image using grub2-mkrescue and launches that image in a virtual machine using KVM/QEMU, all without root privileges.

grub2-theme-preview showing theme "gutsblack-archlinux"

(Showing theme gutsblack-archlinux)

Installation

To install the latest release from PyPI:

# pip3 install --user grub2-theme-preview

To install from a Git clone for development:

# pip3 install --user --editable .

Please make sure to install these non-PyPI dependencies as well:

  • grub-mkrescue of GRUB 2 (package grub-common on Debian and Ubuntu)
  • QEMU (with GTK or SDL display support) — hypervisor that performs hardware virtualization
  • OVMF — EFI bios image for use with QEMU
  • mtoolscollection of utilities to access MS-DOS
  • xorriso of libisoburnfrontend which enables creation and expansion of the ISO format

Usage

# COLUMNS=80 grub2-theme-preview --help
usage: grub2-theme-preview [-h] [--grub-cfg PATH] [--verbose]
                           [--resolution WxH] [--timeout SECONDS]
                           [--add TARGET=/SOURCE] [--version]
                           [--grub2-mkrescue COMMAND] [--qemu COMMAND]
                           [--xorriso COMMAND] [--display DISPLAY]
                           [--full-screen] [--no-kvm] [--vga CARD] [--debug]
                           [--plain-rescue-image]
                           PATH

Preview a GRUB 2.x theme using KVM/QEMU

positional arguments:
  PATH                  path of theme directory (or PNG/TGA image file) to
                        preview

options:
  -h, --help            show this help message and exit
  --grub-cfg PATH       path of custom grub.cfg file to use (default:
                        /boot/grub{2,}/grub.cfg)
  --verbose             increase verbosity
  --resolution WxH      set a custom resolution, e.g. 800x600
  --timeout SECONDS     set GRUB timeout in whole seconds or -1 to disable
                        (default: 30 seconds)
  --add TARGET=/SOURCE  make grub2-mkrescue add file(s) from /SOURCE to
                        /TARGET in the rescue image (can be passed multiple
                        times)
  --version             show program's version number and exit

command location arguments:
  --grub2-mkrescue COMMAND
                        grub2-mkrescue command (default: auto-detect)
  --qemu COMMAND        KVM/QEMU command (default: qemu-system-<machine>)
  --xorriso COMMAND     xorriso command (default: xorriso)

arguments related to invokation of QEMU/KVM:
  --display DISPLAY     pass "-display DISPLAY" to QEMU, see "man qemu" for
                        details (default: use QEMU's default display,
                        hopefully either GTK or SDL)
  --full-screen         pass "-full-screen" to QEMU
  --no-kvm              do not pass -enable-kvm to QEMU (and hence fall back
                        to acceleration "tcg" which is significantly slower
                        than KVM)
  --vga CARD            pass "-vga CARD" to QEMU, see "man qemu" for details
                        (default: use QEMU's default VGA card)

debugging arguments:
  --debug               enable debugging output
  --plain-rescue-image  use unprocessed GRUB rescue image with no theme
                        patched in; useful for checking if a plain GRUB rescue
                        image shows up a GRUB shell, successfully.

environment variables:
  G2TP_GRUB_LIB         Path of GRUB platform files parent directory
                        (default: "/usr/lib/grub")
  G2TP_OVMF_IMAGE       Path of OVMF image file (default: auto-detect)
                        (e.g. "/usr/share/[..]/OVMF_CODE.fd")

Software libre licensed under GPL v2 or later.
Brought to you by Sebastian Pipping <sebastian@pipping.org>.

Please report bugs at https://github.com/hartwork/grub2-theme-preview -- thank you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grub2_theme_preview-2.9.0.tar.gz (208.3 kB view details)

Uploaded Source

Built Distribution

grub2_theme_preview-2.9.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file grub2_theme_preview-2.9.0.tar.gz.

File metadata

  • Download URL: grub2_theme_preview-2.9.0.tar.gz
  • Upload date:
  • Size: 208.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for grub2_theme_preview-2.9.0.tar.gz
Algorithm Hash digest
SHA256 678ab7d318814ecc59dc8bf35f78bbf088c1ed47ed2487a1f95777ca7e578db3
MD5 fe4feabb3c0a6b67010ad8f005968941
BLAKE2b-256 0b9711b10c8caed79f590e5bdecc42d0eca9aca1d2a11b607da6fd3936bc6b2d

See more details on using hashes here.

File details

Details for the file grub2_theme_preview-2.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for grub2_theme_preview-2.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfd15fb6c67ad9c1221cb81dd25ba2b6a556d1869e8b24600e4d91f136ec62a3
MD5 dd3e49920763d2b4e9c2ada5f2459ad3
BLAKE2b-256 2aa5fbccafb49ce4fc1296316b021298e592e93a506fbea75a7a6bfce5ea29a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page