Bibata_Cursor/Bibata.sh

87 lines
2 KiB
Bash
Raw Normal View History

2019-11-13 22:20:42 -05:00
#!/bin/sh
# Default settings
2019-11-13 22:40:43 -05:00
BIBATA=${BIBATA:-/tmp/Bibata}
2019-11-13 22:20:42 -05:00
REPO=${REPO:-KaizIqbal/Bibata_Cursor}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
2019-11-19 04:59:33 -05:00
BRANCH=${BRANCH:-master}
2019-11-13 22:20:42 -05:00
command_exists() {
command -v "$@" >/dev/null 2>&1
}
error() {
echo ${RED}"Error: $@"${RESET} >&2
}
setup_color() {
# Only use colors if connected to a terminal
if [ -t 1 ]; then
RED=$(printf '\033[31m')
GREEN=$(printf '\033[32m')
YELLOW=$(printf '\033[33m')
BLUE=$(printf '\033[34m')
BOLD=$(printf '\033[1m')
RESET=$(printf '\033[m')
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
RESET=""
fi
}
setup_bibata_repo() {
echo "${BLUE}Cloning Bibata Cursor...${RESET}"
command_exists git || {
error "git is not installed"
exit 1
}
git clone -c core.eol=lf -c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
--depth=1 --branch "$BRANCH" "$REMOTE" "$BIBATA" || {
error "git clone of bibata_cursor repo failed"
exit 1
}
echo
}
setup_bibata() {
2019-11-13 22:40:43 -05:00
cd /tmp/Bibata/
2019-11-13 22:20:42 -05:00
./install.sh
2019-11-13 22:40:43 -05:00
rm -rf /tmp/Bibata
2019-11-13 22:34:57 -05:00
echo
2019-11-13 22:20:42 -05:00
}
main() {
printf "$GREEN"
cat <<-'EOF'
██████╗ ██╗██████╗ █████╗ ████████╗ █████╗
██╔══██╗██║██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗
██████╔╝██║██████╔╝███████║ ██║ ███████║
██╔══██╗██║██╔══██╗██╔══██║ ██║ ██╔══██║
██████╔╝██║██████╔╝██║ ██║ ██║ ██║ ██║
╚═════╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
EOF
setup_color
setup_bibata_repo
setup_bibata
2019-11-13 22:40:43 -05:00
rm -rf /tmp/Bibata
2019-11-13 22:20:42 -05:00
printf "$RESET"
}
main "$@"