mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-12-25 20:15:35 +01:00
update
This commit is contained in:
parent
6050b6af0e
commit
839ff1186f
42
install.sh
42
install.sh
@ -16,31 +16,39 @@ function has_command() {
|
|||||||
usage() {
|
usage() {
|
||||||
printf "%s\n" "Usage: $0 [OPTIONS...]"
|
printf "%s\n" "Usage: $0 [OPTIONS...]"
|
||||||
printf "\n%s\n" "OPTIONS:"
|
printf "\n%s\n" "OPTIONS:"
|
||||||
printf " %-25s%s\n" "-l|--slaze" "slaze grub theme"
|
printf " %-25s%s\n" "-l, --slaze" "slaze grub theme"
|
||||||
printf " %-25s%s\n" "-s|--stylish" "stylish grub theme"
|
printf " %-25s%s\n" "-s, --stylish" "stylish grub theme"
|
||||||
printf " %-25s%s\n" "-t|--tela" "tela grub theme"
|
printf " %-25s%s\n" "-t, --tela" "tela grub theme"
|
||||||
printf " %-25s%s\n" "-v|--vimix" "vimix grub theme"
|
printf " %-25s%s\n" "-v, --vimix" "vimix grub theme"
|
||||||
printf " %-25s%s\n" "-h, --help" "Show this help"
|
printf " %-25s%s\n" "-h, --help" "Show this help"
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
[[ ${theme} == 'slaze' ]] && local name="Slaze"
|
if [[ ${theme} == 'slaze' ]]; then
|
||||||
[[ ${theme} == 'stylish' ]] && local name="Stylish"
|
local name="Slaze"
|
||||||
[[ ${theme} == 'tela' ]] && local name="Tela"
|
elif [[ ${theme} == 'stylish' ]]; then
|
||||||
[[ ${theme} == 'vimix' ]] && local name="Vimix"
|
local name="Stylish"
|
||||||
|
elif [[ ${theme} == 'tela' ]]; then
|
||||||
|
local name="Tela"
|
||||||
|
elif [[ ${theme} == 'vimix' ]]; then
|
||||||
|
local name="Vimix"
|
||||||
|
else
|
||||||
|
echo -e "\n Please run ./install.sh with option, run ./install.sh -h for help!"
|
||||||
|
exit 0
|
||||||
|
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 "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
|
||||||
echo -e "Installing ${name} theme..."
|
echo -e "\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}
|
||||||
@ -69,14 +77,14 @@ if [ "$UID" -eq "$ROOT_UID" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set theme
|
# Set theme
|
||||||
echo -e "Setting ${name} as default..."
|
echo -e "\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
|
||||||
echo -e "Updating grub config..."
|
echo -e "\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
|
||||||
@ -88,11 +96,10 @@ if [ "$UID" -eq "$ROOT_UID" ]; then
|
|||||||
# Success message
|
# Success message
|
||||||
echo -e "\n All done! "
|
echo -e "\n All done! "
|
||||||
|
|
||||||
else
|
else
|
||||||
# Error message
|
# Error message
|
||||||
echo -e "\n Error! -> Run me as root "
|
echo -e "\n Error! -> Run me as root "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@ -126,4 +133,3 @@ while [[ $# -gt 0 ]]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
install
|
install
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user