mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-11-05 11:36:12 +01:00
Add remove option and fixed install issues
This commit is contained in:
parent
9c649498e3
commit
a17983d9f6
10
README.md
10
README.md
@ -23,11 +23,17 @@ Usage: `sudo ./install.sh` **[OPTIONS...]**
|
||||
| -l, --slaze | Slaze grub theme |
|
||||
| -2, --2k | Install 2k(2560x1440) background image |
|
||||
| -4, --4k | Install 4k(3840x2160) background image |
|
||||
| -r, --remove | Remove theme (must add theme name option) |
|
||||
| -h, --help | Show this help |
|
||||
|
||||
For example: `Install Tela theme on 2k display device`
|
||||
For example:
|
||||
1. `Install Tela theme on 2k display device`
|
||||
|
||||
sudo ./install -t -2
|
||||
sudo ./install.sh -t -2
|
||||
|
||||
2. `Remove Tela theme`
|
||||
|
||||
sudo ./install.sh -r -t
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
81
install.sh
81
install.sh
@ -52,6 +52,7 @@ usage() {
|
||||
printf " %-25s%s\n" "-v, --vimix" "vimix grub theme"
|
||||
printf " %-25s%s\n" "-2, --2k" "Install 2k(2560x1440) background image"
|
||||
printf " %-25s%s\n" "-4, --24" "Install 4k(3840x2160) background image"
|
||||
printf " %-25s%s\n" "-r, --remove" "Remove theme (must add theme name option)"
|
||||
printf " %-25s%s\n" "-h, --help" "Show this help"
|
||||
}
|
||||
|
||||
@ -91,7 +92,6 @@ install() {
|
||||
# Copy theme
|
||||
prompt -i "\n Installing ${name} ${screen} theme..."
|
||||
|
||||
|
||||
cp -a "${REO_DIR}/common/"*.png "${THEME_DIR}/${name}"
|
||||
cp -a "${REO_DIR}/common/"*.pf2 "${THEME_DIR}/${name}"
|
||||
cp -a "${REO_DIR}/common/theme-${screen}.txt" "${THEME_DIR}/${name}/theme.txt"
|
||||
@ -137,8 +137,8 @@ install() {
|
||||
# persisted execution of the script as root
|
||||
read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s
|
||||
[[ -n "$REPLY" ]] && {
|
||||
if [[ -n "${theme}" ]] ; then
|
||||
sudo -S <<< $REPLY $0 --${theme}
|
||||
if [[ -n "${theme}" && -n "${screen}" ]]; then
|
||||
sudo -S <<< $REPLY $0 --${theme} --${screen}
|
||||
fi
|
||||
} || {
|
||||
prompt "\n Operation canceled Bye"
|
||||
@ -198,6 +198,69 @@ install_dialog() {
|
||||
fi
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [[ ${theme} == 'slaze' ]]; then
|
||||
local name="Slaze"
|
||||
elif [[ ${theme} == 'stylish' ]]; then
|
||||
local name="Stylish"
|
||||
elif [[ ${theme} == 'tela' ]]; then
|
||||
local name="Tela"
|
||||
elif [[ ${theme} == 'vimix' ]]; then
|
||||
local name="Vimix"
|
||||
else
|
||||
prompt -i "\n Run ./install.sh -h for help!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Checking for root access and proceed if it is present
|
||||
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||
echo -e "\n Checking for the existence of themes directory..."
|
||||
if [[ -d "${THEME_DIR}/${name}" ]]; then
|
||||
rm -rf "${THEME_DIR}/${name}"
|
||||
else
|
||||
prompt -i "\n ${name} grub theme not exist!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Backup grub config
|
||||
if [[ -f /etc/default/grub.bak ]]; then
|
||||
rm -rf /etc/default/grub && mv /etc/default/grub.bak /etc/default/grub
|
||||
else
|
||||
prompt -i "\n grub.bak not exist!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Update grub config
|
||||
prompt -i "\n Resetting grub theme...\n"
|
||||
if has_command update-grub; then
|
||||
update-grub
|
||||
elif has_command grub-mkconfig; then
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
elif has_command grub2-mkconfig; then
|
||||
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
||||
fi
|
||||
|
||||
# Success message
|
||||
prompt -s "\n * All done!"
|
||||
prompt -w "\n * At the next restart of your computer you will see your default Grub theme back! "
|
||||
|
||||
else
|
||||
# Error message
|
||||
prompt -e "\n [ Error! ] -> Run me as root "
|
||||
|
||||
# persisted execution of the script as root
|
||||
read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s
|
||||
[[ -n "$REPLY" ]] && {
|
||||
if [[ -n "${theme}" ]]; then
|
||||
sudo -S <<< $REPLY $0 --remove --${theme}
|
||||
fi
|
||||
} || {
|
||||
prompt "\n Operation canceled Bye"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
# show terminal user interface for better use
|
||||
if [[ $# -lt 1 ]] && [[ $UID -eq $ROOT_UID ]]; then
|
||||
run_dialog
|
||||
@ -231,12 +294,18 @@ while [[ $# -ge 1 ]]; do
|
||||
-v|--vimix)
|
||||
theme='vimix'
|
||||
;;
|
||||
-1|--1080p)
|
||||
screen='1080p'
|
||||
;;
|
||||
-2|--2k)
|
||||
screen='2k'
|
||||
;;
|
||||
-4|--4k)
|
||||
screen='4k'
|
||||
;;
|
||||
-r|--remove)
|
||||
remove='true'
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
@ -250,6 +319,12 @@ while [[ $# -ge 1 ]]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ "${remove:-}" != 'true' ]]; then
|
||||
install
|
||||
fi
|
||||
|
||||
if [[ "${remove:-}" == 'true' ]]; then
|
||||
remove
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user