#!/usr/bin/env bash
# test script for 256 color on the fb console. https://www.robmeerman.co.uk/unix/256colours
#wget -c -O /var/tmp/256color.pl https://gist.githubusercontent.com/hSATAC/1095100/raw/ee5b4d79aee151248bdafa8b8412497a5a688d42/256color.pl

# supported modes can be found at the grub console with 'vbeinfo' or 'videoinfo
# 0x17d 1920x1200x32 vga=381
# 0x17c 1920x1200x8  vga=380

## Add this to the /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT
gfxmode="1920x1200x32,1920x1200x8"
sed -i "s|^\(GRUB_GFXMODE=\).*|\1\"$gfxmode\"|" /etc/default/grub
sed -i '/^GRUB_GFXMODE=.*/ s/.*/&\nGRUB_GFXPAYLOAD_LINUX=\"keep\"/' /etc/default/grub


# DEPRICATED: vesafb requires a vga= on the kernel commandline.
#sed -i 's,^\(GRUB_CMDLINE_LINUX=\).*,\1'\"vga=381\"',' /etc/default/grub

mount /boot/grub
update-grub
