mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-11-05 13:26:14 +01:00
update
This commit is contained in:
parent
7ded5467a6
commit
a1bb9a8a82
@ -5,7 +5,6 @@
|
|||||||
| |_| | _ <| |_| | |_) / __/ | | | _ | |___| | | | |___ ___) |
|
| |_| | _ <| |_| | |_) / __/ | | | _ | |___| | | | |___ ___) |
|
||||||
\____|_| \_\\___/|____/_____| |_| |_| |_|_____|_| |_|_____|____/
|
\____|_| \_\\___/|____/_____| |_| |_| |_|_____|_| |_|_____|____/
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Flat Design themes for Grub2.
|
## Flat Design themes for Grub2.
|
||||||
@ -13,6 +12,7 @@
|
|||||||
## Install
|
## Install
|
||||||
|
|
||||||
Usage: `sudo ./install.sh` **[OPTIONS...]**
|
Usage: `sudo ./install.sh` **[OPTIONS...]**
|
||||||
|
|
||||||
*if no option used the terminal user interface will be show up*
|
*if no option used the terminal user interface will be show up*
|
||||||
|
|
||||||
| OPTIONS: | |
|
| OPTIONS: | |
|
||||||
|
81
install.sh
81
install.sh
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
# Grub2 Dark Theme
|
# Grub2 Dark Theme
|
||||||
|
|
||||||
|
|
||||||
ROOT_UID=0
|
ROOT_UID=0
|
||||||
THEME_DIR="/boot/grub/themes"
|
THEME_DIR="/boot/grub/themes"
|
||||||
THEME_DIR_2="/boot/grub2/themes"
|
THEME_DIR_2="/boot/grub2/themes"
|
||||||
@ -40,23 +39,11 @@ prompt () {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# print "GRUB THEME" whene the script is launched
|
|
||||||
ascii_art_header () {
|
|
||||||
[[ -f README.md ]] && {
|
|
||||||
header_title=$(sed -n 2,8p README.md)
|
|
||||||
prompt -i "$header_title"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ascii_art_header # uncomment this line to show Grub theme ascii art
|
|
||||||
|
|
||||||
|
|
||||||
# Check command avalibility
|
# Check command avalibility
|
||||||
function has_command() {
|
function has_command() {
|
||||||
command -v $1 > /dev/null
|
command -v $1 > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "%s\n" "Usage: ${0##*/} [OPTIONS...]"
|
printf "%s\n" "Usage: ${0##*/} [OPTIONS...]"
|
||||||
printf "\n%s\n" "OPTIONS:"
|
printf "\n%s\n" "OPTIONS:"
|
||||||
@ -68,7 +55,6 @@ usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
|
|
||||||
if [[ ${theme} == 'slaze' ]]; then
|
if [[ ${theme} == 'slaze' ]]; then
|
||||||
local name="Slaze"
|
local name="Slaze"
|
||||||
elif [[ ${theme} == 'stylish' ]]; then
|
elif [[ ${theme} == 'stylish' ]]; then
|
||||||
@ -78,23 +64,23 @@ install() {
|
|||||||
elif [[ ${theme} == 'vimix' ]]; then
|
elif [[ ${theme} == 'vimix' ]]; then
|
||||||
local name="Vimix"
|
local name="Vimix"
|
||||||
else
|
else
|
||||||
echo -e "\n Please run ./install.sh with option, run ./install.sh -h for help!"
|
prompt -i "\n Run sudo ./install.sh again! or run ./install.sh -h for help"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# 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..."
|
||||||
|
|
||||||
[[ -d ${THEME_DIR}/${name} ]] && rm -rf ${THEME_DIR}/${name}
|
[[ -d ${THEME_DIR}/${name} ]] && rm -rf ${THEME_DIR}/${name}
|
||||||
[[ -d ${THEME_DIR_2}/${name} ]] && rm -rf ${THEME_DIR_2}/${name}
|
[[ -d ${THEME_DIR_2}/${name} ]] && rm -rf ${THEME_DIR_2}/${name}
|
||||||
[[ -d /boot/grub ]] && mkdir -p ${THEME_DIR}/${name}
|
[[ -d /boot/grub ]] && mkdir -p ${THEME_DIR}/${name}
|
||||||
[[ -d /boot/grub2 ]] && mkdir -p ${THEME_DIR_2}/${name}
|
[[ -d /boot/grub2 ]] && mkdir -p ${THEME_DIR_2}/${name}
|
||||||
|
|
||||||
# Copy theme
|
# Copy theme
|
||||||
prompt -i "Installing ${name} theme..."
|
prompt -i "\n Installing ${name} theme..."
|
||||||
|
|
||||||
if [ -d /boot/grub ]; then
|
if [ -d /boot/grub ]; then
|
||||||
cp -a ${REO_DIR}/common/* ${THEME_DIR}/${name}
|
cp -a ${REO_DIR}/common/* ${THEME_DIR}/${name}
|
||||||
@ -123,14 +109,14 @@ install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set theme
|
# Set theme
|
||||||
prompt -i "Setting ${name} as default..."
|
prompt -i "\n Setting ${name} as default..."
|
||||||
grep "GRUB_THEME=" /etc/default/grub 2>&1 >/dev/null && sed -i '/GRUB_THEME=/d' /etc/default/grub
|
grep "GRUB_THEME=" /etc/default/grub 2>&1 >/dev/null && sed -i '/GRUB_THEME=/d' /etc/default/grub
|
||||||
|
|
||||||
[[ -d /boot/grub ]] && echo "GRUB_THEME=\"${THEME_DIR}/${name}/theme.txt\"" >> /etc/default/grub
|
[[ -d /boot/grub ]] && echo "GRUB_THEME=\"${THEME_DIR}/${name}/theme.txt\"" >> /etc/default/grub
|
||||||
[[ -d /boot/grub2 ]] && echo "GRUB_THEME=\"${THEME_DIR_2}/${name}/theme.txt\"" >> /etc/default/grub
|
[[ -d /boot/grub2 ]] && echo "GRUB_THEME=\"${THEME_DIR_2}/${name}/theme.txt\"" >> /etc/default/grub
|
||||||
|
|
||||||
# Update grub config
|
# Update grub config
|
||||||
prompt -i "Updating grub config..."
|
prompt -i "\n Updating grub config..."
|
||||||
if has_command update-grub; then
|
if has_command update-grub; then
|
||||||
update-grub
|
update-grub
|
||||||
elif has_command grub-mkconfig; then
|
elif has_command grub-mkconfig; then
|
||||||
@ -140,7 +126,7 @@ install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Success message
|
# Success message
|
||||||
prompt -s "All done!"
|
prompt -s "\n All done!"
|
||||||
|
|
||||||
else
|
else
|
||||||
# Error message
|
# Error message
|
||||||
@ -159,8 +145,7 @@ install() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# show terminal user interface for better use
|
run_dialog() {
|
||||||
if [[ $# -lt 1 ]] ;then
|
|
||||||
if [[ -x /usr/bin/dialog ]]; then
|
if [[ -x /usr/bin/dialog ]]; then
|
||||||
tui=$(dialog --backtitle "Grub 2 Themes" \
|
tui=$(dialog --backtitle "Grub 2 Themes" \
|
||||||
--radiolist "Choose your Grub theme : " 15 40 5 \
|
--radiolist "Choose your Grub theme : " 15 40 5 \
|
||||||
@ -175,9 +160,53 @@ if [[ $# -lt 1 ]] ;then
|
|||||||
4) theme="vimix" ;;
|
4) theme="vimix" ;;
|
||||||
*) prompt "Canceled" ;;
|
*) prompt "Canceled" ;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_dialog() {
|
||||||
|
if [ ! "$(which dialog 2> /dev/null)" ]; then
|
||||||
|
prompt -i "\n 'dialog' needs to be installed for this shell "
|
||||||
|
if has_command zypper; then
|
||||||
|
|
||||||
|
sudo zypper in dialog
|
||||||
|
elif has_command apt-get; then
|
||||||
|
|
||||||
|
sudo apt-get install dialog
|
||||||
|
elif has_command dnf; then
|
||||||
|
|
||||||
|
sudo dnf install dialog
|
||||||
|
elif has_command yum; then
|
||||||
|
|
||||||
|
sudo yum install dialog
|
||||||
|
elif has_command pacman; then
|
||||||
|
|
||||||
|
sudo pacman -S --noconfirm dialog
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# show terminal user interface for better use
|
||||||
|
if [[ $# -lt 1 ]] && [[ $UID -eq $ROOT_UID ]]; then
|
||||||
|
run_dialog
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]]; then
|
||||||
|
|
||||||
|
# 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" ]]&& {
|
||||||
|
sudo -S <<< $REPLY $0
|
||||||
|
}|| {
|
||||||
|
prompt "\n Operation canceled Bye"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
run_dialog
|
||||||
|
fi
|
||||||
|
|
||||||
while [[ $# -ge 1 ]]; do
|
while [[ $# -ge 1 ]]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-l|--slaze)
|
-l|--slaze)
|
||||||
@ -197,12 +226,14 @@ while [[ $# -ge 1 ]]; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
prompt -e "ERROR: Unrecognized installation option '$1'."
|
prompt -e "\n ERROR: Unrecognized installation option '$1'."
|
||||||
prompt -i "Try '$0 --help' for more information."
|
prompt -i "\n Try '$0 --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
install
|
install_dialog && install
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user