-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
executable file
·148 lines (121 loc) · 4.21 KB
/
INSTALL
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
#!/bin/bash
####################################################################################################################
# Author : Spyridakis Christos
# Created Date : 4/10/2021
# Last Updated : 11/10/2021
# Email : spyridakischristos@gmail.com
#
#
# Description :
# Install to your HOME dir this repo's tmux theme, just by coping or linking files .tmux.conf
# and .tmux-functions.sh
#
####################################################################################################################
# Auxiliary variables for transferring tmux files to ${HOME} dir
TAR_SCRIPT="`pwd`/tmux-functions.sh"
DES_SCRIPT="$HOME/.tmux-functions.sh"
TAR_TMUX="`pwd`/.tmux.conf"
DES_TMUX="$HOME/.tmux.conf"
help_menu(){
echo "Usage: $0 [Option] [Option] "
echo "Install this custom made tmux theme to your system"
echo
echo "Options:"
echo " -h, --help show this help page"
echo
echo " -r, --requirements install requirements"
echo
echo " -z, --zsh install also zsh with agnoster theme"
echo
echo " -c, --copy-both copy both needed files"
echo " -l, --link-both link both needed files"
echo
echo " -t, --copy-tmux only copy .tmux.conf"
echo " -T, --link-tmux only link .tmux.conf"
echo
echo " -f, --copy-functions only copy .tmux-functions.sh"
echo " -F, --link-functions only link .tmux-functions.sh"
echo
echo "Notes:"
echo " - I suggest for a normal installation to run with parameter -c."
echo
echo " - If you want to regularly update status bar's content then you could"
echo " copy .tmux.conf file and link .tmux-functions.sh with the one you"
echo " have in your version control repo (in that case run -t -F)."
}
# Install ZSH with agnoster theme
install_zsh_agnoster(){
sudo apt-get -y install zsh
sudo apt-get -y install fonts-powerline
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
chsh -s $(which zsh)
MY_THEME="agnoster"
MY_PLUGINS="git"
sed -e "s/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"${MY_THEME}\"/g" -i ${HOME}/.zshrc
sed -e "s/plugins=(git)/plugins=(${MY_PLUGINS})/g" -i ${HOME}/.zshrc
}
# Install needed applications if not already been installed
install_requirements(){
sudo apt-get -y install tmux dc bc psensor xclip
}
# ----
# If tmux files already exist, create a copy of them
bu_tmux(){
[ -e ${DES_TMUX} ] && mv ${DES_TMUX} ${DES_TMUX}.`date '+%d.%m.%Y_T%H-M%M-S%S'`.bu
}
bu_functions(){
[ -e ${DES_SCRIPT} ] && mv ${DES_SCRIPT} ${DES_SCRIPT}.`date '+%d.%m.%Y_T%H-M%M-S%S'`.bu
}
bu_files(){
bu_tmux
bu_functions
}
# ----
copy_tmux(){
cp ${TAR_TMUX} ${DES_TMUX} && echo "Copy .tmux.conf file..."
}
copy_functions(){
cp ${TAR_SCRIPT} ${DES_SCRIPT} && echo "Copy .tmux-functions.sh file..."
}
copy_files(){
copy_tmux
copy_functions
}
# ----
link_tmux(){
[ ! -e ${DES_TMUX} ] && (echo -e "\nln -s ${TAR_TMUX} ${DES_TMUX}" && ln -s ${TAR_TMUX} ${DES_TMUX} && echo "Create symlink for .tmux.conf")
}
link_functions(){
[ ! -e ${DES_SCRIPT} ] && (echo -e "\nln -s ${TAR_SCRIPT} ${DES_SCRIPT}" && ln -s ${TAR_SCRIPT} ${DES_SCRIPT} && echo "Create symlink for .tmux-functions.sh")
}
link_files(){
link_tmux
link_functions
}
#MAIN
while :
do
case "$1" in
-c | --copy-both) bu_files ; copy_files ; shift ;;
-l | --link-both) bu_files ; link_files ; shift ;;
-t | --copy-tmux) bu_tmux ; copy_tmux ; shift ;;
-T | --link-tmux) bu_tmux ; link_tmux ; shift ;;
-f | --copy-functions) bu_functions ; copy_functions ; shift ;;
-F | --link-functions) bu_functions ; link_functions ; shift ;;
-r | --requirements) install_requirements ; shift ;;
-z | --zsh) install_zsh_agnoster ; shift ;;
-h | --help) help_menu ; exit 0 ;;
--*)
echo "Unknown option: $1" >&2
helpMenu
exit 1
;;
-*)
echo "Unknown option: $1" >&2
helpMenu
exit 1
;;
*)
break
esac
done