-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy-config.sh
More file actions
executable file
·57 lines (45 loc) · 1.47 KB
/
deploy-config.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.47 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
#!/bin/bash -e
SKIP_CLONE=false
if [[ ! -z "$1" ]]; then
if [[ "$1" == "-local" ]] || [[ "$1" == "-l" ]]; then
echo Running from local folder
SKIP_CLONE=true
else
echo Invalid option: $1
exit 1
fi
fi
echo '########## Update & Install Git ##########'
sudo apt-get update
sudo apt-get -y install git
if [[ "${SKIP_CLONE}" -eq "false" ]]; then
# Clone repo
git clone https://github.com/go-dima/linux-config.git ~/.linux-config
cd ~/.linux-config
fi
echo '########## Install Tools ##########'
packages_to_install=`cat packages | awk '{printf("%s ",$0)}'`
sudo apt-get -y install ${PACKAGES_TO_INSTALL}
echo '########## Configure bash-git-prompt ##########'
BASH_GIT_PROMPT_URL=https://github.com/magicmonty/bash-git-prompt.git
BASH_GIT_PROMPT_FOLDER=~/.bash-git-prompt
if [[ ! -d "$BASH_GIT_PROMPT_FOLDER" ]] ; then
git clone $BASH_GIT_PROMPT_URL $BASH_GIT_PROMPT_FOLDER --depth=1
else
cd "$BASH_GIT_PROMPT_FOLDER"
git pull $BASH_GIT_PROMPT_URL
cd -
fi
echo '########## Configure bashrc ##########'
PATTERN='source ~/.linux-config/profile/my_bashrc'
BASHRC_FILE=~/.bashrc
grep -qxF -- "$PATTERN" "$BASHRC_FILE" || echo "$PATTERN" >> "$BASHRC_FILE"
echo '########## Configure git ##########'
cat profile/my_gitconfig > ~/.gitconfig
mkdir -p ~/bin
cp git-commands/* ~/bin/
echo '########## Configure vim ##########'
cat profile/my_vimrc > ~/.vimrc
echo '########## Apply Changes ##########'
source ~/.bashrc
echo '########## Configuration Complete ##########'