mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-11-05 13:36:14 +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 |
|
| -l, --slaze | Slaze grub theme |
|
||||||
| -2, --2k | Install 2k(2560x1440) background image |
|
| -2, --2k | Install 2k(2560x1440) background image |
|
||||||
| -4, --4k | Install 4k(3840x2160) background image |
|
| -4, --4k | Install 4k(3840x2160) background image |
|
||||||
|
| -r, --remove | Remove theme (must add theme name option) |
|
||||||
| -h, --help | Show this help |
|
| -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
|
## Screenshots
|
||||||
|
|
||||||
|
93
install.sh
93
install.sh
@ -52,6 +52,7 @@ usage() {
|
|||||||
printf " %-25s%s\n" "-v, --vimix" "vimix grub theme"
|
printf " %-25s%s\n" "-v, --vimix" "vimix grub theme"
|
||||||
printf " %-25s%s\n" "-2, --2k" "Install 2k(2560x1440) background image"
|
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" "-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"
|
printf " %-25s%s\n" "-h, --help" "Show this help"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +92,6 @@ install() {
|
|||||||
# Copy theme
|
# Copy theme
|
||||||
prompt -i "\n Installing ${name} ${screen} theme..."
|
prompt -i "\n Installing ${name} ${screen} theme..."
|
||||||
|
|
||||||
|
|
||||||
cp -a "${REO_DIR}/common/"*.png "${THEME_DIR}/${name}"
|
cp -a "${REO_DIR}/common/"*.png "${THEME_DIR}/${name}"
|
||||||
cp -a "${REO_DIR}/common/"*.pf2 "${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"
|
cp -a "${REO_DIR}/common/theme-${screen}.txt" "${THEME_DIR}/${name}/theme.txt"
|
||||||
@ -136,11 +136,11 @@ install() {
|
|||||||
|
|
||||||
# persisted execution of the script as root
|
# persisted execution of the script as root
|
||||||
read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s
|
read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s
|
||||||
[[ -n "$REPLY" ]]&& {
|
[[ -n "$REPLY" ]] && {
|
||||||
if [[ -n "${theme}" ]] ; then
|
if [[ -n "${theme}" && -n "${screen}" ]]; then
|
||||||
sudo -S <<< $REPLY $0 --${theme}
|
sudo -S <<< $REPLY $0 --${theme} --${screen}
|
||||||
fi
|
fi
|
||||||
}|| {
|
} || {
|
||||||
prompt "\n Operation canceled Bye"
|
prompt "\n Operation canceled Bye"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -168,9 +168,9 @@ run_dialog() {
|
|||||||
2 "2k" off \
|
2 "2k" off \
|
||||||
3 "4k" off --output-fd 1 )
|
3 "4k" off --output-fd 1 )
|
||||||
case "$tui" in
|
case "$tui" in
|
||||||
1) screen="1080p" ;;
|
1) screen="1080p" ;;
|
||||||
2) screen="2k" ;;
|
2) screen="2k" ;;
|
||||||
3) screen="4k" ;;
|
3) screen="4k" ;;
|
||||||
*) prompt "Canceled" ;;
|
*) prompt "Canceled" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -198,6 +198,69 @@ install_dialog() {
|
|||||||
fi
|
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
|
# show terminal user interface for better use
|
||||||
if [[ $# -lt 1 ]] && [[ $UID -eq $ROOT_UID ]]; then
|
if [[ $# -lt 1 ]] && [[ $UID -eq $ROOT_UID ]]; then
|
||||||
run_dialog
|
run_dialog
|
||||||
@ -231,12 +294,18 @@ while [[ $# -ge 1 ]]; do
|
|||||||
-v|--vimix)
|
-v|--vimix)
|
||||||
theme='vimix'
|
theme='vimix'
|
||||||
;;
|
;;
|
||||||
|
-1|--1080p)
|
||||||
|
screen='1080p'
|
||||||
|
;;
|
||||||
-2|--2k)
|
-2|--2k)
|
||||||
screen='2k'
|
screen='2k'
|
||||||
;;
|
;;
|
||||||
-4|--4k)
|
-4|--4k)
|
||||||
screen='4k'
|
screen='4k'
|
||||||
;;
|
;;
|
||||||
|
-r|--remove)
|
||||||
|
remove='true'
|
||||||
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
@ -250,6 +319,12 @@ while [[ $# -ge 1 ]]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
install
|
if [[ "${remove:-}" != 'true' ]]; then
|
||||||
|
install
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${remove:-}" == 'true' ]]; then
|
||||||
|
remove
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user