forked from tatumsu/vm_setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_vm.sh
executable file
·36 lines (26 loc) · 1.01 KB
/
init_vm.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
#!/bin/bash
echo "------------Init VM: isntall necessary packages and setup enviornment for vagrant user------------"
# Make sure this script can be run multiple times without side effect
sudo yum -y install vim htop man mlocate python-devel
sudo pip install fabric
git --version
if [ $? -ne 0 ]
then
yum -y install git
fi
if [ ! -d /home/vagrant/github ]
then
mkdir -p /home/vagrant/github
fi
cd /home/vagrant/github/
if [ ! -d /home/vagrant/github/resource ]
then
git clone https://github.com/tatumsu/resource.git
fi
sudo chown -R vagrant:vagrant /home/vagrant/
cd /home/vagrant/github/resource
sudo cp alias.sh /etc/profile.d/
cat /etc/vimrc | grep "color desert" || echo "color desert" | sudo tee -a /etc/vimrc
cat /etc/vimrc | grep "set tabstop=4" || echo "set tabstop=4" | sudo tee -a /etc/vimrc
cat /home/vagrant/.bashrc | grep "export VM_SETUP=" || echo "export VM_SETUP=/home/vagrant/github/resource/vm-setup" >> /home/vagrant/.bashrc
echo "Run source ~/.bashrc to make the new environment setting in effect"