Skip to content
Snippets Groups Projects
Commit dfaae83b authored by root's avatar root
Browse files

fix vim and docker bug

parent 831e4b45
No related branches found
No related tags found
No related merge requests found
......@@ -31,25 +31,28 @@ function setDocker(){
if yum list installed docker-ce &>/dev/null; then
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo &>/dev/null
$PWD/tools/setdocker.py --proxy="http://$PROXYIP:$PROXYPORT"
systemctl daemon-reload
if systemctl is-active docker -q; then systemctl restart docker; fi
if [[ $? == 0 ]]; then
systemctl daemon-reload
if systemctl is-active docker -q; then systemctl restart docker; fi
fi
fi
}
function setVim(){
# for git and wsl
echo -e "\e[32mConfiguring Vim...\e[0m"
yes | cp -f $PWD/src/vimrc_base ~/.env/vimrc_base &>/dev/null
if ! grep "source ~/.env/vimrc_base" ~/.vimrc &>/dev/null; then echo -e "source ~/.env/vimrc_base" >> ~/.vimrc; fi
if [[ ! -f ~/.vim/autoload/plug.vim ]]; then
wget -q -P ~/.vim/autoload/ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim -c PlugUpdate -c PlugClean -c qa
vim -E -s -u ~/.vimrc -c PlugUpdate -c PlugClean -c qa
else
if [[ $(ls -l ~/.vim/autoload/plug.vim | awk '{print $5}') -eq 0 ]]; then
wget -q -P ~/.vim/autoload/ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -c PlugUpgrade -c PlugUpdate -c PlugClean -c qa
vim -E -s -u ~/.vimrc -c PlugUpgrade -c PlugUpdate -c PlugClean -c qa
fi
yes | cp -f $PWD/src/vimrc_base ~/.env/vimrc_base &>/dev/null
if ! grep "source ~/.env/vimrc_base" ~/.vimrc &>/dev/null; then echo -e "source ~/.env/vimrc_base" >> ~/.vimrc; fi
}
function setGithub(){
......
......@@ -21,11 +21,16 @@ if not os.path.exists(file_path):
# print(json.dumps(proxy_json, indent = 2))
with open(file_path, 'w') as f:
f.write(json.dumps(proxy_json, indent = 2))
exit(0)
else:
with open(file_path, 'r') as f:
conf_json = json.load(f)
if not conf_json.get("proxies"):
conf_json.update(proxy_json)
# print(json.dumps(conf_json))
with open(file_path, 'w') as f:
f.write(json.dumps(conf_json, indent = 2))
# print(json.dumps(conf_json))
with open(file_path, 'w') as f:
f.write(json.dumps(conf_json, indent = 2))
exit(0)
else:
exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment