-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
133 lines (102 loc) · 3.75 KB
/
install.sh
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# Define variable
UNAME=$(uname)
DOTFILES_PATH=$HOME/dotfiles
ZSH_CUSTOM=$HOME/.oh-my-zsh/custom
# Define output formats
question=$(tput bold)
error=$(tput setaf 1)
info=$(tput setaf 4)
success=$(tput setaf 2)
reset=$(tput sgr0)
# Check if the installation is possible
if [[ "$UNAME" != "Darwin" ]] ; then
echo "${error}Sorry, this OS is not supported yet via this installer.${reset}"
exit 1
fi
if [[ -z $HOME ]] || [[ ! -d $HOME ]]; then
echo "${error}The installation and use of this dotfiles requires the \$HOME environment variable be set to a directory where its files can be installed.${reset}"
exit 1
fi
if [[ -d ${DOTFILES_PATH} ]]; then
echo "${error}You already have an installation of this dotfiles.${reset}"
echo "${error}==> Installation abort...${reset}"
exit 1
fi
echo ""
echo "${info}==> Installation in progress...${reset}"
mkdir -p $HOME/Pictures/screenshot
# Create archi
mkdir -p $HOME/www
mkdir -p $HOME/www/opensource
mkdir -p $HOME/www/perso
mkdir -p $HOME/www/work
mkdir -p $HOME/www/sandbox
mkdir -p $HOME/backup
mkdir -p $HOME/logs
### MacOs stuff ###
# Ask for the administrator password upfront
sudo -v
# Install Brew if not already installed
command -v brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Fetch the newest version of Homebrew and all formulae & install Git
brew update
brew install git
# Get repository
git clone https://github.com/maxhelias/dotfiles-macos ${DOTFILES_PATH}
# Trigger the initialization
sh ${DOTFILES_PATH}/mac/configure.sh
xcodebuild --install
xcodebuild -license
brew bundle install --file ${DOTFILES_PATH}/mac/Brewfile --verbose
### Git stuff ###
echo ""
echo "${info}==> Setting your profile Git...${reset}"
ln -sf ${DOTFILES_PATH}/git/.gitconfig $HOME/.gitconfig
ln -sf ${DOTFILES_PATH}/git/.gitconfig-opensource $HOME/.gitconfig-opensource
ln -sf ${DOTFILES_PATH}/git/.gitconfig-work $HOME/.gitconfig-work
ln -sf ${DOTFILES_PATH}/git/.gitignore_global $HOME/.gitignore_global
ln -sf ${DOTFILES_PATH}/git/.gitattributes $HOME/.gitattributes
### Console stuff ###
echo ""
echo "${info}==> Setting your environnement...${reset}"
# Bash
ln -sf ${DOTFILES_PATH}/console/bash/.bashrc $HOME/.bashrc
ln -sf ${DOTFILES_PATH}/console/bash/.bash_profile $HOME/.bash_profile
# Zsh
# Oh my zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Config Zsh
ln -sf ${DOTFILES_PATH}/console/zsh/.zshrc $HOME/.zshrc
ln -sf ${DOTFILES_PATH}/console/zsh/.p10k.zsh $HOME/.p10k.zsh
# Plugins Zsh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM}/plugins/zsh-autosuggestions
git clone https://github.com/paulirish/git-open.git ${ZSH_CUSTOM}/plugins/git-open
# Themes Zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM}/themes/powerlevel10k
### Langs stuff ###
# GO
curl -sSL https://git.io/g-install | sh -s -- bash
# PHP / Composer
mkdir -p $HOME/.composer
ln -sf ${DOTFILES_PATH}/langs/php/composer.json $HOME/.composer/composer.json
composer global update
# Yarn
mkdir -p $HOME/.config/yarn/global
ln -sf ${DOTFILES_PATH}/langs/yarn/package.json $HOME/.config/yarn/global/package.json
cd (yarn global dir) && yarn install
cd ~ && yarn global upgrade
### Tools stuff ###
# GitHub
gh extension install dlvhdr/gh-dash
gh extension install seachicken/gh-poi
### Init project ###
### Install opensource
sh ${DOTFILES_PATH}/mac/opensource.sh
### Install Certificationy
composer create-project certificationy/certificationy-cli $HOME/www/perso/certificationy-cli
# Refresh terminal
source ~/.zshrc
echo ""
echo "${success}==> Installation completed${reset}"