#!/bin/bash
#Note: No guarantee that this theme will be seen correctly at all screen resolutions available
#execute only from within the onyx folder!

sudo mkdir /usr/share/plymouth/themes/onyx
clear
sudo rsync -aq --exclude=install-onyx --exclude=plymouth-i18n-fonts * /usr/share/plymouth/themes/onyx/
clear
sudo update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/onyx/onyx.plymouth 100
sudo update-alternatives --config default.plymouth  #here, choose the number of the theme you want to use then hit enter

echo
echo Installing non-Latin fonts needed by the theme...
sudo apt-get install -y fonts-noto-core fonts-noto-cjk

echo
echo Installing initramfs font hook...
sudo cp plymouth-i18n-fonts /etc/initramfs-tools/hooks/plymouth-i18n-fonts
sudo chmod +x /etc/initramfs-tools/hooks/plymouth-i18n-fonts

sudo update-initramfs -u
echo
echo Installing plymouth-x11...   Redundant if already installed.
sudo apt-get install plymouth-x11
echo
echo Running 10-second test...
sudo plymouthd ; sudo plymouth --show-splash ; for ((I=0; I<10; I++)); do sleep 1 ; sudo plymouth --update=test$I ; done ; sudo plymouth --quit
exit
