-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcore_init.bash
215 lines (199 loc) · 5.92 KB
/
core_init.bash
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
runner()
{
clear
linex
# =======================================================================
source "$rootmur/modules/$1.bash"
# =======================================================================
# read
}
check_shell_files()
{
if ! ls $log_file &> /dev/null ; then
touch $log_file
murlog "creating log_file :]" "$log_file"
fi
if ! ls $shell_f &> /dev/null ; then
murlog "creating shell_f" "$log_file"
touch $shell_f
fi
if ! ls $bash_login &> /dev/null ; then
murlog "creating bash_login" "$log_file"
touch $bash_login
fi
if ! ls $bash_profile &> /dev/null ; then
murlog "creating bash_profile" "$log_file"
touch $bash_profile
fi
}
check_murmur()
{
ali="source ~/.murmurbox/loader.bash"
ali_zsh="bash ~/.murmurbox/loader.bash"
agentmur="$HOME/Library/LaunchAgents/launch_agent.plist"
agentplist="$(cat $HOME/.murmurbox/agent.plist)"
if [ "$os" == "Linux" ]; then
murlog "skip creating agent file because linux" "$log_file"
elif [ "$os" == "Darwin" ]; then
if ! ls $agentmur &> /dev/null ; then
echo $agentplist > $agentmur
murlog "creating agent file" "$log_file"
else
if ! (grep "$agentplist" <"$agentmur" &>/dev/null) ; then
murlog "repairing agent file" "$log_file"
echo -en "$agentplist" > "$agentmur"
fi
fi
fi
if ! (grep "$ali" <"$shell_f" &>/dev/null) ; then
murlog "murmur alias repaired" "$log_file"
echo -en "\n$ali" >>"$shell_f"
cha=1
fi
if ! (grep "$ali_zsh" <"${HOME}/.zshrc" &>/dev/null) ; then
murlog "murmur alias zsh (bash) repaired" "$log_file"
echo -en "\n$ali_zsh" >>"${HOME}/.zshrc"
cha=1
fi
if ! (grep "$ali" <"${HOME}/.zshrc" &>/dev/null) ; then
murlog "murmur alias zsh (zsh) repaired" "$log_file"
echo -en "\n$ali" >>"${HOME}/.zshrc"
cha=1
fi
if ! ls "$HOME"/.murmurbox/murmurbox.bash &>/dev/null ; then
cha=1
/bin/rm -fr ~/.murmurbox &>/dev/null
git clone https://github.com/murmurlab/scripts.git ~/.murmurbox ; bash ~/.murmurbox/murmurbox.bash
murlog "murmur reinstall repaired" "$log_file"
fi
if [ ! "$cha" ]; then
murlog "murmur ok" "$log_file"
elif (grep "$ali" <"$shell_f" &>/dev/null && ls "$HOME"/.murmurbox/murmurbox.bash &>/dev/null && grep "$auto" <"$shell_f" &>/dev/null) ; then
murlog "murmur was auto repaired" "$log_file"
# echo -e "\n\033[32m -- murmur has been successfully updated! --\n\033[0m"
else
murlog "[CRITICAL WARNING!]" "$log_file"
cecho "[CRITICAL WARNING!]" "red" "reversed"
# echo -e "\033[31m\n -- murmur command has NOT been updated ! :( --\n\033[0m"
exit 1
fi
}
murmur_u()
{
if [[ $DEV -eq 0 ]]; then
murlog "triggered update" "$log_file"
# cecho "$DEV murmur_u" "red" ""
o="start update\n`
2>&1 git -C ~/.murmurbox pull
2>&1 git -C ~/.murmurbox reset --hard origin/master
`\nend update"
fi
murlog "update\n$o" $log_file
}
log()
{
cecho
}
register()
{
cecho
}
logger()
{
# install murmurlibc readline mlx etc.
stat "waiting select..." "light_blue" "" "$b"
stat2 "logger menu" "orange" "" "$m"
while true; do
clear
top_banner "$msg" "$color" "$style" "$msg2" "$color2" "$style2" "$banner_logger"
read -rn1 choice
case $choice in
'l') log ;;
'r') register ;;
'q'|''|0) echo "Çıkılmak murmurbox logger.";break;;
*)
# linex
clear
stat "invalid selection!" "red" "bold" "$b"
;;
esac
done
# i_7z
# 7zz a -t7z -ms=on -myx=5 -mx=9 -mf=off -m0=PPMd:mem2g:o14 "log.7z" "$log_file"
# data=$(binhex encode --stdout "log.7z")
# # data=$(base64 "log.7z")
# echo "${#data}"
# for (( i = 0; i < ${#data}; i+=2000 )); do
# echo "DATA $i : ${data:$i:$i+2000}"
# open "https://mail.google.com/mail/?view=cm&[email protected]&su=$USER logs p$i&body=${data:$i:$i+2000}&bcc=&"
# done
}
murminette() {
curl https://raw.githubusercontent.com/murmurlab/francinette/refs/heads/murmurlab-docker/bin/dockerize/Dockerfile | docker build -t murminette - && docker run -t --rm -v .:/tmp/proj murminette murminette $@
}
msvscode-install() {
mkdir -p ~/bin/
curl -L 'https://code.visualstudio.com/sha/download?build=stable&os=linux-x64' -o /tmp/msvscode.tar.gz
tar -xvf /tmp/msvscode.tar.gz -C ~/.local/share
ln -sf ~/.local/share/VSCode-linux-x64/bin/code ~/bin/code
}
msvscode() {
~/.local/share/VSCode-linux-x64/bin/code $@
}
arg_hook()
{
if [[ $arg1 ]]; then
murlog "triggered arg: $arg1" "$log_file"
case $arg1 in
"u")
murmur_u
# echo "ok."
murlog "arg u ok exiting" $log_file
exit 0
;;
"i")
echo "install is deprecated"
exit 0
while true; do
echo "\n\033[33mDo you really want to install murmurbox ? <yes/no> \033[0m\0"
read -r yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "\n\033[31mPlease answer yes or no !\033[0m\0\n" ;;
esac
done
exit 0
;;
"francinette"|"paco"|"murminette")
echo "murminette:"
echo "'paco'" ${@:2}
# shopt -s expand_aliases
# source "$shell_f"
murminette ${@:2}
exit 0
;;
"msvscode-install")
msvscode-install
;;
"_code"|"msvscode"|"kod"|"kode")
echo "_code|msvscode|kod|kode"
# echo "'paco'" ${@:2}
# shopt -s expand_aliases
# source "$shell_f"
msvscode ${@:2}
exit 0
;;
*)
# help
cecho "https://github.com/murmurlab/scripts" "white" "reversed"
cecho "normal calistirmak icin parametre vermeyin!" "red" "bold"
echo "Bu script için aşağıdaki parametreleri kullanabilirsiniz:"
echo " d: uninstall murmurbox. (not available)"
echo " f: reinstall murmurbox. (not available)"
echo " h: Yardım mesajını (bu) görüntüler."
exit 1
;;
esac
fi
}