mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-11-05 14:56:14 +01:00
added better OO support and root access
This commit is contained in:
parent
9aaae0396c
commit
8f737a2ae6
60
install.sh
60
install.sh
@ -89,6 +89,7 @@ install() {
|
|||||||
|
|
||||||
# Checking for root access and proceed if it is present
|
# Checking for root access and proceed if it is present
|
||||||
if [ "$UID" -eq "$ROOT_UID" ]; then
|
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||||
|
clear
|
||||||
|
|
||||||
# Create themes directory if not exists
|
# Create themes directory if not exists
|
||||||
echo -e "\n Checking for the existence of themes directory..."
|
echo -e "\n Checking for the existence of themes directory..."
|
||||||
@ -129,33 +130,8 @@ install() {
|
|||||||
|
|
||||||
# Update grub config
|
# Update grub config
|
||||||
prompt -i "\n Updating grub config..."
|
prompt -i "\n Updating grub config..."
|
||||||
if has_command update-grub; then
|
|
||||||
update-grub
|
updating_grub
|
||||||
elif has_command grub-mkconfig; then
|
|
||||||
grub-mkconfig -o /boot/grub/grub.cfg
|
|
||||||
elif has_command zypper; then
|
|
||||||
grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
||||||
elif has_command dnf; 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 new Grub theme: '$theme' "
|
|
||||||
|
|
||||||
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}" && -n "${screen}" ]]; then
|
|
||||||
sudo -S <<< $REPLY $0 --${theme} --${screen}
|
|
||||||
fi
|
|
||||||
} || {
|
|
||||||
operation_canceled
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,10 +175,26 @@ run_dialog() {
|
|||||||
|
|
||||||
operation_canceled() {
|
operation_canceled() {
|
||||||
clear
|
clear
|
||||||
prompt "\n Operation canceled by user Bye"
|
prompt "\n Operation canceled by user, Bye!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updating_grub() {
|
||||||
|
if has_command update-grub; then
|
||||||
|
update-grub
|
||||||
|
elif has_command grub-mkconfig; then
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
elif has_command zypper; then
|
||||||
|
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||||
|
elif has_command dnf; 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 new Grub theme: '$theme' "
|
||||||
|
}
|
||||||
|
|
||||||
install_dialog() {
|
install_dialog() {
|
||||||
if [ ! "$(which dialog 2> /dev/null)" ]; then
|
if [ ! "$(which dialog 2> /dev/null)" ]; then
|
||||||
prompt -i "\n 'dialog' needs to be installed for this shell"
|
prompt -i "\n 'dialog' needs to be installed for this shell"
|
||||||
@ -254,17 +246,7 @@ remove() {
|
|||||||
|
|
||||||
# Update grub config
|
# Update grub config
|
||||||
prompt -i "\n Resetting grub theme...\n"
|
prompt -i "\n Resetting grub theme...\n"
|
||||||
if has_command update-grub; then
|
updating_grub
|
||||||
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
|
else
|
||||||
# Error message
|
# Error message
|
||||||
|
Loading…
Reference in New Issue
Block a user