-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathCheemaFy
executable file
·204 lines (171 loc) · 6.03 KB
/
CheemaFy
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
#!/usr/bin/env bash
help_CheemaFy="Usage: ./CheemaFy [options]
--ubuntu
--arch
--help
--remove"
_linux=$1
if [ "$_linux" = "--help" ]
then
echo "$help_CheemaFy"
exit
fi
if [ "$_linux" = "" ]
then
_linux="--ubuntu"
fi
if [ "$1" = "--remove" ]
then
echo "removing CheemaFy"
sh ~/programs/CheemaFy/srbScripts/restore_old_config.sh
mv ~/.CheemaFy/installed ~/.CheemaFy/not_installed
exit
fi
place=`pwd`
prog=$HOME"/programs"
#these commands are safe to execute they create folder only when
#the folders are missing, they dont harm old content
mkdir -p $prog
mkdir -p $HOME"/.CheemaFy/srb_clip_board"
#file to hold your password
if ! [ -f ~/.CheemaFy/.pass ]
then
i=1
while [ $i -ne 0 ]
do
stty -echo
printf "[sudo] password for $USER:" && read passwrd
stty echo
echo "" && echo $passwrd > ~/.CheemaFy/.pass
sudo -k -S ls < ~/.CheemaFy/.pass > /dev/null 2>&1
i=$?
if [ $i -ne 0 ]
then
sleep 1
if [ -f ~/dead.letter ]
then
rm ~/dead.letter
fi
echo "[sudo], try again."
fi
done
fi
if ! [ $place = $prog"/CheemaFy" ]
then
echo creating CheemaFy
cp -r ../CheemaFy $prog
cd $prog"/CheemaFy/"
sh $prog"/CheemaFy/srbScripts/save_old_config.sh"
bash $prog"/CheemaFy/CheemaFy"
exit
fi
#customise terminal
UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
#gsettings list-keys org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
cursor-shape ibeam
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
background-color 'rgb(11,11,11)'
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
default-size-columns 126
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
default-size-rows 33
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
foreground-color 'rgb(222,222,222)'
_comment="
I removed these settings as they are not in new gnome, so they cause problem in arch.
they work only in ubuntu
not in arch as it has updated gnome.
I will soon figure something out as I love transparent terminal
"
if [ "$_linux" = "--ubuntu" ]
then
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
use-transparent-background true
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ \
background-transparency-percent 3
fi
# CONFIGURING HOME FILES
printf "Do you want to configure home_files yes/no : "
read ans
bashrc_content="# CheemaFy bash
if [ -f ~/.CheemaFy/installed ]; then
if [ -f ~/programs/CheemaFy/myPlugins/bash_extended/bash_extended ]; then
. ~/programs/CheemaFy/myPlugins/bash_extended/setup_bash
fi
fi
if [ -f ~/.CheemaFy/installed ]; then
if [ -f ~/.CheemaFy/temp_bashrc ]; then
. ~/.CheemaFy/temp_bashrc
fi
fi"
gitconfig_content="[include]
path = ~/.CheemaFy/installed"
vimrc_content=":so ~/programs/CheemaFy/srbScripts/vim_scripts/setup.vim"
installed_content="[include]
path = ~/programs/CheemaFy/myPlugins/git_extended/gitconfig"
temp_bashrc_content="export PATH=\$PATH:~/Desktop/test/path_place
default_cp_file=~/programs/CheemaFy/myPlugins/default_codes/cpp/main/cf_programming.cpp"
echo "$installed_content" >> ~/.CheemaFy/installed
echo "$temp_bashrc_content" >> ~/.CheemaFy/temp_bashrc
if [ $ans = "yes" ]
then
echo "$vimrc_content" >> ~/.vimrc
echo "$bashrc_content" >> ~/.bashrc
echo "$gitconfig_content" >> ~/.gitconfig
sudo updatedb
fi
if [ $ans = "Y" ]
then
echo "$vimrc_content" > ~/.vimrc
echo "$bashrc_content" > ~/.bashrc
echo "$gitconfig_content" > ~/.gitconfig
fi
#install other useful things
if [ "$_linux" = "--ubuntu" ]
then
sudo -S -k apt-get update -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install vim -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install xsel -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install build-essential -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install cmake -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install xdotool -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install wmctrl -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install tilda -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install tree -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install locate -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install vim-gnome -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install clang-format-6.0 -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install clang-4.0 -y < ~/.CheemaFy/.pass
sudo -S -k apt-get install libboost-all-dev -y < ~/.CheemaFy/.pass
elif [ "$__linux" = "--arch" ]
then
echo "in arch"
sudo pacman -Syu
sudo pacman -S wpa_supplicant wireless_tools networkmanager network-manager-applet
sudo pacman -S base-devel python python3 gcc firefox bash-completion lsb-release
sudo pacman -S ntfs-3g
sudo pacman -S xsel gvim cmake xdotool wmctrl tilda tree clang boost boost-libs mlocate
systemctl enable NetworkManager.service
systemctl enable wpa_supplicant.service
systemctl start NetworkManager.service
fi
#install Vundle
if ! [ -d "$HOME"/.vim/bundle/ ]
then
echo installing vim bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi
echo instaling vimSyntax
cp -r ~/programs/CheemaFy/myPlugins/vim/syntax ~/.vim/
cp -r ~/programs/CheemaFy/myPlugins/vim/ftdetect ~/.vim/
printf "Do you want to add vim plugins y/n : "
read ans
if [ $ans = "y" ]
then
vim hell -c ":PluginInstall" -c ":q!" -c ":q!"
~/.vim/bundle/YouCompleteMe/install.py --clang-completer --system-libclang
fi
#gnome-terminal -e "bash -c \"echo 'Thanks for using CheemaFy' ; exec bash\"" & disown
#wmctrl -i -c `xdotool getactivewindow` &
echo 'Thanks for using CheemaFy'