-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·100 lines (80 loc) · 2.23 KB
/
install.sh
File metadata and controls
executable file
·100 lines (80 loc) · 2.23 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
#!/bin/bash
# ---------------------
#
# ---------------------
set -xeu
echo $PATH
### constant value
### --------------------------------------------
DIR_NAME="${HOME}/dotfiles"
DOT_DIR__="${DIR_NAME}/_dotfiles"
DOT_DIR="${DIR_NAME}/dotfiles"
BACKUP_DIR="${DIR_NAME}/backup"
INSTALL_MODE=${1}
install_mac="mac"
install_apt="linux_normal"
install_linuxbrew="linuxbrew"
### OS recognition
OS_MAC="Mac"
OS_WSL="WSL"
OS_LINUX="Linux"
OS_BASE="Undefined"
### ---------------------------------------------
### OS recognition
### --------------------------------------------
if [ "$(uname)" == 'Darwin' ]; then
OS_BASE=$OS_MAC
elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
if [[ "$(uname -r)" == *Microsoft* ]]; then
OS_BASE=$OS_WSL
else
OS_BASE=$OS_LINUX
fi
else
echo "Your platform ($(uname -a)) is not supported."
exit 1
fi
if [ "$OS_BASE" = "$OS_MAC" ] && [ "$INSTALL_MODE" = "$install_mac" ] ; then
echo "This is ${OS_BASE}. Install_mode: ${install_mac}"
elif [ "$OS_BASE" = "$OS_LINUX" -o "$OS_BASE" = "$OS_WSL" ] && [ "$INSTALL_MODE" = "$install_apt" ] ; then
echo "This is ${OS_BASE}. Install mode: ${install_apt}"
elif [ "$OS_BASE" = "$OS_LINUX" -o "$OS_BASE" = "$OS_WSL" ] && [ "$INSTALL_MODE" = "$install_linuxbrew" ] ; then
echo "This is ${OS_BASE}. Install mode: ${install_linuxbrew}"
else
echo "This is ${OS_BASE}, but your argument is wrong. See README.md."
exit 1
fi
### --------------------------------------------
### Read functions.
### ---------------------------------------------
cd ${DIR_NAME}
. ./deploy.sh force
. ./func_apt.sh
. ./func_brew.sh
. ./func_fish.sh
. ./func_python.sh
. ./func_fonts.sh
### ----------------------------------------------
### This must be exexute first.
### --------------------------------------------
cd ${HOME}
## apt
if [ "$INSTALL_MODE" = "$install_apt" ] || [ "$INSTALL_MODE" = "$install_linuxbrew" ] ; then
set_apt
fi
## brew
if [ "$INSTALL_MODE" = "$install_mac" ] || [ "$INSTALL_MODE" = "$install_linuxbrew" ] ; then
set_brew
fi
## -------------------------------------------
### Python
set_pyenv
set_pipenv
# set_poetry
### fish
set_fish
### fonts
set_fonts
### restart shell
### -------------------------------------
exec $SHELL