-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall
More file actions
executable file
·100 lines (70 loc) · 2.71 KB
/
install
File metadata and controls
executable file
·100 lines (70 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
set -e
##### Variables ###############################################################
export PATH=${HOME}/.local/bin:${HOME}/bin:${HOME}/.local/share/mise/shims:/usr/local/bin:${PATH}
# Defind Colors
BANNER="\033[38;2;101;178;255m" # BLUE
DEBUG="\033[38;2;144;108;255m" # MAGENTA
INFO="\033[38;2;98;209;150m" # GREEN
WARN="\033[38;2;255;179;120m" # YELLOW
ERROR="\033[38;2;255;84;88m" # RED
CODE="\033[38;2;99;242;241m" # CYAN
CLEAR_COLOR="\033[0m"
# Define path
DOTPATH="$HOME/.dotfiles"
##### Functions ###############################################################
COL=120
function _banner() {
sep=$(for ((i = 1; i < COL; i++)); do echo -n =; done)
printf "\n${BANNER}%s %s${CLEAR_COLOR}\n\n" "${1}" "${sep:${#1}}"
}
function _logger() {
LOG_LEVEL="${1}"
printf "${!LOG_LEVEL}%s${CLEAR_COLOR}\n" "${1}: ${2}"
}
##### Clone Dotfiles ##########################################################
_banner "Clone Dotfiles..."
if [[ ! -d "${DOTPATH}" ]]; then
_logger INFO "Clone dotfiles repository"
git clone --recursive https://github.com/IMOKURI/dotfiles.git "${DOTPATH}"
fi
##### Install dotfiles ########################################################
_banner "Deploy dotfiles..."
pushd "$(pwd)"
cd "${DOTPATH}"
make install
if ! grep -q '.config/bashrc' "${HOME}/.bashrc"; then
echo -e "\nif [[ -f ~/.config/bashrc ]]; then\n . ~/.config/bashrc\nfi" >>"${HOME}/.bashrc"
fi
if ! grep -q '.config/profile.d/local.sh' "${HOME}/.profile"; then
echo -e "\nif [[ -f ~/.config/profile.d/local.sh ]]; then\n . ~/.config/profile.d/local.sh\nfi" >>"${HOME}/.profile"
fi
mkdir -p -m 700 ~/.ssh
if ! grep -q 'Include ~/.config/ssh/' "${HOME}/.ssh/config"; then
echo -e "\nInclude ~/.config/ssh/*.conf" >>"${HOME}/.ssh/config"
fi
popd
##### Install starship ########################################################
_banner "Install Starship..."
mkdir -p "${HOME}/.local/bin"
sh -c "$(curl -fsSL https://starship.rs/install.sh)" dollar_zero --yes --bin-dir "${HOME}/.local/bin"
##### Install Mise ############################################################
_banner "Install Mise..."
pushd "$(pwd)"
cd "${DOTPATH}"
make mise
popd
##### Install bashmarks #######################################################
_banner "Install Bashmarks..."
pushd "$(pwd)"
cd "${DOTPATH}"
make bashmarks
popd
##### Instruct next steps #####################################################
_banner "Please follow the instructions below to finish the installation."
_logger INFO "Restart your shell session."
_logger INFO "Run following commands to install development tools."
_logger CODE " mise install"
_logger CODE " make bat-theme"
_logger INFO "Restart your shell session."
_banner "Well done!"