forked from jonathanpmartins/ubuntusetup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_client.sh
executable file
·201 lines (167 loc) · 5.17 KB
/
setup_client.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/bin/bash
ask() {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
read -p "$1 [$prompt] " REPLY
if [ -z "$REPLY" ]; then
REPLY=$default
fi
case "$REPLY" in
Y*|y*) return 0 ;;
N*|n*) return 1 ;;
esac
done
}
#
# GENERATE NEW SSH KEY
#
if [ ! -f ~/.ssh/id_rsa.pub ]; then
ssh-keygen;
fi
echo "--------------- Here is your ssh public key";
cat ~/.ssh/id_rsa.pub || echo;
if ask "--------------- Have you copied the key? Can we proceed?" y; then
echo "Forward...";
else
exit 0;
fi
#
# REPOSITORIES
#
echo "--------------- Adding new repositories";
# sublime text 3
if [ $(sudo apt-cache policy | grep -c "sublime-text-3") -eq 0 ];
then
sudo add-apt-repository ppa:webupd8team/sublime-text-3;
else
echo "--------------- Sublime Text 3 repository already installed";
fi
# brackets
if [ $(sudo apt-cache policy | grep -c "brackets") -eq 0 ];
then
sudo add-apt-repository ppa:webupd8team/brackets;
else
echo "--------------- Brackets repository already installed";
fi
# chrome
if [ $(sudo apt-cache policy | grep -c "chrome") -eq 0 ];
then
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - ;
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list';
else
echo "--------------- Chrome repository already installed";
fi
#skype
if [ $(sudo apt-cache policy | grep -c "skype") -eq 0 ];
then
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner";
else
echo "--------------- Skype repository already installed";
fi
#java
if [ $(sudo apt-cache policy | grep -c "java") -eq 0 ];
then
sudo add-apt-repository -y ppa:webupd8team/java
else
echo "--------------- Java repository already installed";
fi
#
# UPDATE / UPGRADE
#
echo "--------------- Update + Upgrade";
sudo apt-get update;
sudo apt-get -y upgrade;
# sudo apt-get dist-upgrade
#
# INSTALL
#
echo "--------------- Installing Tools";
apt_get_packages=("google-chrome-stable" "brackets" "sublime-text-installer" "git" "curl" "git-core" "gitk" "gitg" "git-gui" "nodejs-legacy" "npm" "mysql-server" "php5-mysqlnd" "php5-fpm" "php5-cli" "php5-mcrypt" "php5-curl" "php5-json" "php5-gd" "php5-dev" "php-pear" "php5-xdebug" "nginx" "ruby-full" "phantomjs" "filezilla" "virtualbox" "virtualbox-dkms" "vagrant" "skype" "docker.io" "python-pip" "meld" "inotify-tools" "openjdk-8-jre" "oracle-java8-installer" "whois" "mytop" "jmeter" "awscli" "ec2-api-tools");
for i in "${!apt_get_packages[@]}"; do
if [ $(dpkg-query -W -f='${Status}' "${apt_get_packages[$i]}" 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "--------------- Installing ${apt_get_packages[$i]}";
if [ $(echo ${apt_get_packages[$i]} | grep -c "sublime-text-installer") -eq 1 ]
then
sudo apt-get install -y sublime-text;
else
sudo apt-get install -y ${apt_get_packages[$i]};
fi
else
echo "--------------- '${apt_get_packages[$i]}' already installed";
fi
done
sudo php5enmod mcrypt;
sudo php5enmod xdebug;
npm_packages=("gulp" "bower" "mup" "browserify");
for i in "${!npm_packages[@]}"; do
if [ $(npm list -g "${npm_packages[$i]}" 2>/dev/null | grep -c "${npm_packages[$i]}") -eq 0 ];
then
echo "--------------- Installing ${npm_packages[$i]}";
sudo npm install -g ${npm_packages[$i]};
else
echo "--------------- '${npm_packages[$i]}' already installed";
fi
done
sudo chown -R $LOGNAME:$LOGNAME ~/.npm;
# composer
if [ ! -f /usr/local/bin/composer ]; then
echo "--------------- Installing Composer";
curl -sS https://getcomposer.org/installer | php;
sudo mv composer.phar /usr/local/bin/composer;
else
echo "--------------- Updating Composer";
sudo composer self-update;
fi
# meteor js
if [ ! -d ~/.meteor ]; then
echo "--------------- Installing Meteor";
curl https://install.meteor.com/ | sh;
fi
#
# ADD ALIASES TO BASH
#
if [ $(cat ~/.bashrc | grep -c "mybash") -eq 0 ];
then
# working on
#Install Elastic Beanstalk
#if [ $($LOGNAME | grep -c "jonathan") -eq 1 ];
#then
# Download From https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.6.4.zip
#export PATH=$PATH:/usr/share/aws/eb/linux/python2.7/
#fi
echo '
alias reload="sudo service nginx reload"
alias restart="sudo service nginx restart"
alias restartphp="sudo service php5-fpm restart"
alias restartsql="sudo service mysql restart"
alias hosts="sudo subl /etc/hosts"
alias phpini="sudo subl /etc/php5/fpm/php.ini"
alias mybash="subl ~/.bashrc"
alias vhosts="sudo subl /etc/nginx/sites-available;"
alias www="cd /var/www; ls -li"
alias html="cd /var/www/html; ls -li"
alias dev="cd /var/www/dev; ls -li"
alias logs="cd /var/log/nginx; ls -li"
alias dir="ls -la"
alias b="cd .."
alias ..="cd .."
alias ...="cd ../.."
alias dump="composer dump-autoload;"
alias migrate="php artisan migrate;"
alias refresh="php artisan migrate:refresh --seed";
alias seed="php artisan db:seed";
alias push="git push origin develop;";
alias run="codecept run -d;";
' >> ~/.bashrc;
exec bash;
fi