Update install.sh

This commit is contained in:
Vince 2022-10-30 23:36:05 +08:00
parent e77cbfa662
commit 48338ec6a3

View File

@ -57,14 +57,22 @@ function has_command() {
} }
usage() { usage() {
printf "%s\n" "Usage: ${0##*/} [OPTIONS...]" cat << EOF
printf "\n%s\n" "OPTIONS:"
printf " %-25s%s\n" "-t, --theme" "theme variant(s) [tela|vimix|stylish|whitesur] (default is tela)" Usage: $0 [OPTION]...
printf " %-25s%s\n" "-i, --icon" "icon variant(s) [color|white|whitesur] (default is color)"
printf " %-25s%s\n" "-s, --screen" "screen display variant(s) [1080p|2k|4k|ultrawide|ultrawide2k] (default is 1080p)" OPTIONS:
printf " %-25s%s\n" "-r, --remove" "Remove theme (must add theme name option)" -t, --theme theme variant(s) [tela|vimix|stylish|whitesur] (default is tela)
printf " %-25s%s\n" "-g, --generate" "do not install, but generate theme into chosen directory" -i, --icon icon variant(s) [color|white|whitesur] (default is color)
printf " %-25s%s\n" "-h, --help" "Show this help" -s, --screen screen display variant(s) [1080p|2k|4k|ultrawide|ultrawide2k] (default is 1080p)
-r, --remove Remove theme [tela|vimix|stylish|whitesur] (must add theme name option, default is tela)
-b, --boot install theme into '/boot/grub' or '/boot/grub2'
-g, --generate do not install but generate theme into chosen directory (must add your directory)
-h, --help Show this help
EOF
} }
generate() { generate() {
@ -371,7 +379,7 @@ remove() {
if [[ -d "${THEME_DIR}/${theme}" ]]; then if [[ -d "${THEME_DIR}/${theme}" ]]; then
prompt -s "\n Find installed theme: '${THEME_DIR}/${theme}'..." prompt -s "\n Find installed theme: '${THEME_DIR}/${theme}'..."
rm -rf "${THEME_DIR}/${theme}" rm -rf "${THEME_DIR}/${theme}"
prompt -w "Removed: '${THEME_DIR}/${theme}'..." prompt -w "\n Removed: '${THEME_DIR}/${theme}'..."
elif [[ -d "/boot/grub/themes/${theme}" ]]; then elif [[ -d "/boot/grub/themes/${theme}" ]]; then
prompt -s "\n Find installed theme: '/boot/grub/themes/${theme}'..." prompt -s "\n Find installed theme: '/boot/grub/themes/${theme}'..."
rm -rf "/boot/grub/themes/${theme}" rm -rf "/boot/grub/themes/${theme}"
@ -478,7 +486,35 @@ while [[ $# -gt 0 ]]; do
case "${1}" in case "${1}" in
-r|--remove) -r|--remove)
remove='true' remove='true'
shift 1 shift
for theme in "${@}"; do
case "${theme}" in
tela)
themes+=("${THEME_VARIANTS[0]}")
shift
;;
vimix)
themes+=("${THEME_VARIANTS[1]}")
shift
;;
stylish)
themes+=("${THEME_VARIANTS[2]}")
shift
;;
whitesur)
themes+=("${THEME_VARIANTS[3]}")
shift
;;
-*)
break
;;
*)
prompt -e "ERROR: Unrecognized theme variant '$1'."
prompt -i "Try '$0 --help' for more information."
exit 1
;;
esac
done
;; ;;
-g|--generate) -g|--generate)
shift 1 shift 1