forked from pmalek/ubuntupostinstall
-
Notifications
You must be signed in to change notification settings - Fork 2
/
afterinstall.sh
executable file
·259 lines (214 loc) · 11.2 KB
/
afterinstall.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#!/bin/bash
# Colors
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
current_dir=`pwd`
# script dir
DIR="$( cd "$( dirname "$0" )" && pwd )"
toinstall=""
topurge=""
createdir(){
if [[ ! -d "$1" ]]; then mkdir -p "$1"; fi
}
suretopurge(){
echo -e "$COL_YELLOW " && read -p "Are you sure to purge $1 ('y' to purge)? " -n 1 -r ; echo -e "$COL_RESET"
if [[ $REPLY =~ ^[Yy]$ ]]
then
topurge="$topurge $1"
echo "\"$topurge\""
# sudo apt-get purge $1 -y
fi
}
suretoinstall(){
echo -e "$COL_YELLOW " && read -p "Are you sure to install $1 ('y' to install)? " -n 1 -r ; echo -e "$col_reset"
if [[ $reply =~ ^[Yy]$ ]]
then
toinstall="$toinstall $1"
# sudo apt-get install $1 -y
fi
}
createdir ~/bin/
createdir ~/programming/{c,hackerrank,node,scripts}
createdir ~/.fonts/
# Fixes Skype theme on 64 bit systems
if [[ `uname -m` =~ .*64.* ]] ; then
toinstall="$toinstall gtk2-engines-murrine:i386"
fi
# purge unnecessary packages
sudo apt-get purge unity-scope-gdrive unity-scope-musicstores unity-scope-gmusicbrowser unity-scope-audacious unity-scope-firefoxbookmarks unity-scope-virtualbox unity-scope-yelp unity-scope-chromiumbookmarks rhythmbox account-plugin-facebook account-plugin-aim account-plugin-windows-live account-plugin-flickr account-plugin-yahoo account-plugin-jabber account-plugin-salut brasero brasero-cdrkit brasero-common gnome-mahjongg unity-scope-openclipart unity-scope-musique unity-scope-colourlovers gnome-orca unity-scope-zotero unity-scope-tomboy unity-scope-texdoc transmission-common transmission-gtk unity-scope-video-remote totem account-plugin-twitter landscape-client-ui-install gnome-mines gnome-sudoku gnome-mahjongg empathy gimp clementine $topurge -y
# latest stable git release
sudo add-apt-repository ppa:git-core/ppa -y
# deluge team ppa
sudo add-apt-repository ppa:deluge-team/ppa -y
sudo apt-get update
# install necessary
sudo apt-get install software-properties-common vim-nox git zsh indicator-multiload vlc ubuntu-restricted-extras tmux compizconfig-settings-manager compiz-plugins-extra libappindicator1 python-pip htop deluge colormake xsel synaptic openssh-client openssh-server shutter curl $toinstall -V -y
sudo apt-get purge `dpkg -l | grep unity-lens | grep -v unity-lens-files | grep -v unity-lens-applications | awk '{print $2}'` -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
# install chrome with dependencies
echo -e "$COL_YELLOW" && read -p "Are you sure to install google-chrome? " -n 1 -r ; echo -e "$COL_RESET"
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O chrome.deb
sudo dpkg -i chrome.deb
sudo apt-get -f install -y
rm -rf chrome.deb
fi
####################################################################
############################ VUNDLE
echo -e "$COL_YELLOW" && read -p "Are you sure to install vundle to manage your vim plugins? " -n 1 -r ; echo -e "$COL_RESET"
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n $COL_YELLOW Installing Vundle.vim ...\n $COL_RESET"
git clone --depth 1 https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
cp $DIR/.vimrc ~
cp $DIR/.tmux.conf ~
cp $DIR/.tmuxline.conf ~
sed -i 's/colorscheme solarized/"\ &/g' $HOME/.vimrc
vim +PluginInstall +qall!
sed -i 's/"\ \(colorscheme solarized\)/\1/g' $HOME/.vimrc
vim +PluginInstall +qall!
ln -s $HOME/.vim/bundle/xmledit/ftplugin/xml.vim $HOME/.vim/bundle/xmledit/ftplugin/html.vim
fi
############################ END OF VUNDLE
####################################################################
# network speed indicator
cd ~/programming/scripts
wget http://webupd8.googlecode.com/files/sysmon_0.2.tar.gz && tar -xvf sysmon_0.2.tar.gz
# copy indicator-multiload config
sudo cp $DIR/preferences.ui /usr/share/indicator-multiload/preferences.ui
####################################################################
################# BEGIN OF OH-MY-ZSH
echo -e "\n $COL_YELLOW Installing and configuring oh-my-zsh...\n $COL_RESET"
cd /tmp && wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
cd ~
chsh -s /bin/zsh
sed -i 's@robbyrussell@af-magic@' ~/.zshrc
sed -i 's@plugins=(git)@plugins=(git git-extras virtualenv copydir copyfile cp command-not-found debian encode64 mvn pip sudo jira zsh-syntax-highlighting emoji docker docker-compose go ubuntu heroku tmux history httpie rsync dircycle)@' ~/.zshrc
sed -i "s@\(export\ PATH=\"\)\(.*\)@\1/home/$(whoami)/bin:~/\.local/bin:\2@" ~/.zshrc
# oh-my-zsh fix for afmagic theme
sed -i -r "s@PROMPT=(.*virtualenv_)@RPROMPT=\1@" ~/.oh-my-zsh/themes/af-magic.zsh-theme
echo "alias pbcopy='xsel --clipboard --input'" >> ~/.zshrc
echo "alias pbpaste='xsel --clipboard --output'" >> ~/.zshrc
echo "alias tmux='tmux -2'" >> ~/.zshrc
echo "alias ll='ls -lhF'" >> ~/.zshrc
echo "alias lt='ls -lhtr'" >> ~/.zshrc
echo "alias la='ls -lhA'" >> ~/.zshrc
# lines and lines_sort methods
cat "$DIR/zshrc_methods" >> ~/.zshrc
# zsh-syntax-highlighting
( rm -rf ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && cd ~/.oh-my-zsh/custom/plugins && \
git clone --depth 1 git://github.com/zsh-users/zsh-syntax-highlighting.git 2> /dev/null && \
if ! grep -q zsh-syntax-highlighting ~/.zshrc; then sed -i -r 's#^(plugins=.*)\)#\1 zsh-syntax-highlighting)#' ~/.zshrc; fi && \
sed -i '/ZSH_HIGHLIGHT_.*/d' ~/.zshrc
cat << EOF >> ~/.zshrc
ZSH_HIGHLIGHT_HIGHLIGHTERS=( main brackets pattern)
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
EOF
)
# add shell completion after -t= parameters
echo "setopt magic_equal_subst" >> ~/.zshrc
# prevent Ctrl-S from stopping the terminal
echo "stty -ixon" >> ~/.zshrc
# help neovim produce beautiful colors
echo "export TERM=xterm" >> ~/.zshrc
################ END OF OH-MY-ZSH
####################################################################
####################################################################
echo -e "\n $COL_YELLOW Installing tmux plugins...\n $COL_RESET"
git clone --depth 1 https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm/
git clone --depth 1 https://github.com/tmux-plugins/tmux-copycat ~/.tmux/plugins/tmux-copycat/
git clone --depth 1 https://github.com/tmux-plugins/tmux-yank ~/.tmux/plugins/tmux-yank/
git clone --depth 1 https://github.com/tmux-plugins/tmux-resurrect ~/.tmux/plugins/tmux-resurrect/
git clone --depth 1 https://github.com/seebi/tmux-colors-solarized ~/.tmux/plugins/tmux-colors-solarized/
tmux source ~/.tmux.conf
####################################################################
####################################################################
############### Powerline fonts for gnome terminal
( cd ~/.fonts/ && wget https://github.com/Lokaltog/powerline-fonts/archive/master.zip && unzip master.zip && \
mv powerline-fonts-master/* . && rm -rf master.zip powerline-fonts-master && fc-cache -vf ~/.fonts
gconftool-2 --set /apps/gnome-terminal/profiles/Default/font --type string "Ubuntu Mono derivative Powerline 11"
gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_system_font --type bool "false" )
echo -e "$COL_YELLOW" && read -p "Do you want to set tmux as your default terminal command? (y to confirm) " -n 1 -r ; echo -e "$COL_RESET"
if [[ $REPLY =~ ^[Yy]$ ]]
then
gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_custom_command --type bool true
gconftool-2 --set /apps/gnome-terminal/profiles/Default/custom_command --type string "tmux -2"
fi
####################################################################
####################################################################
############## fix ubuntu privacy fixubuntu.com
############## Figure out the version of Ubuntu that you're running
V=`/usr/bin/lsb_release -rs`
# The privacy problems started with 12.10, so earlier versions should do nothing
if [ $V \< 12.10 ]; then
echo "\nGood news! Your version of Ubuntu doesn't invade your privacy.\n"
else
# Turn off "Remote Search", so search terms in Dash don't get sent to the internet
gsettings set com.canonical.Unity.Lenses remote-content-search none
# If you're using earlier than 13.10, uninstall unity-lens-shopping
if [ $V \< 13.10 ]; then
sudo apt-get remove -y unity-lens-shopping
# If you're using a later version, disable remote scopes
else
gsettings set com.canonical.Unity.Lenses disabled-scopes \
"['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']"
fi;
# Block connections to Ubuntu's ad server, just in case
if ! grep -q productsearch.ubuntu.com /etc/hosts; then
echo -e "\n127.0.0.1 productsearch.ubuntu.com" | sudo tee -a /etc/hosts >/dev/null
fi
echo -e "$COL_YELLOW All done. Enjoy your privacy. $COL_RESET"
fi
################################################################
# remove amazon from dash
sudo rm -rf /usr/share/applications/ubuntu-amazon-default.desktop 2>/dev/null
# disable overlay scrollbars
gsettings set com.canonical.desktop.interface scrollbar-mode normal
# disable guest login
[[ -s /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf ]] && \
echo allow-guest=false | sudo tee -a /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf
# disable crash reports
[[ -s /etc/default/apport ]] && sudo sed -i 's/enabled=1/enabled=0/' /etc/default/apport
# check updates each 2 weeks
dconf write /com/ubuntu/update-notifier/regular-auto-launch-interval 14
# DOES NOT WORK ?
#sudo xhost +SI:localuser:lightdm
#sudo su lightdm -s /bin/bash
#gsettings set com.canonical.unity-greeter draw-grid false
################################################################
echo -e "\n $COL_YELLOW Installing gvm and go...\n $COL_RESET"
sudo apt-get install bison -y
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) && \
source $HOME/.gvm/scripts/gvm && \
gvm install go1.4 && gvm use go1.4 && export GOROOT_BOOTSTRAP=$GOROOT && \
gvm install go1.6.2 && gvm use go1.6.2 && gvm uninstall go1.4
cat << EOF >> ~/.zshrc
[[ -s ~/.gvm/scripts/gvm ]] && source ~/.gvm/scripts/gvm
gvm use go1.6.2 >/dev/null
EOF
################################################################
################################################################
echo -e "\n $COL_YELLOW Installing silver_searcher - ag...\n $COL_RESET"
sudo apt-get install automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev -y
cd /tmp && git clone --depth 1 https://github.com/ggreer/the_silver_searcher.git ag && cd ag && \
./build.sh >/dev/null 2>&1
################################################################
################################################################
echo -e "\n $COL_YELLOW Copying .gdbinit to your home dir...\n $COL_RESET"
cp ${DIR}/.gdbinit ~
################################################################
cd $current_dir
echo -e "\n $COL_YELLOW Configuration complete :). Enjoy!\n $COL_RESET"