sublime安装新

ban掉了wget,我还有curl

error() {
	echo -e "\033[31;1mERROR\033[0m \033[31m$1\033[0m"
	exit 1
}
mkdir -p ~/.local/bin
cd /tmp
if [ ! -d ~/.bin ]; then
	echo -n "Downloading tools..."
	curl -O https://files-cdn.cnblogs.com/files/youxam/bin.tar.gz -s || error
	echo -e -n "\033[32;1mOK\033[0m\nInstalling tools..."
	tar xzvf bin.tar.gz -C ~ > /dev/null || error
	rm bin.tar.gz
	grep  "~/.bin" ~/.bashrc || sed -i '1i\PATH=\${PATH}:~/.bin'  ~/.bashrc
	echo -e "\033[32;1mOK\033[0m"
fi
echo -n "Downloading fonts..."
curl -O https://files-cdn.cnblogs.com/files/hellohhy/fonts.tar.gz -s || error
echo -e -n "\033[32;1mOK\033[0m\nInstalling fonts..."
tar -xzvf fonts.tar.gz > /dev/null
rm fonts.tar.gz ~/.local/share/fonts -rf
mkdir -p ~/.local/share/fonts
mv fonts/*.ttf ~/.local/share/fonts/
fc-cache
cd ~/.local/bin
echo -e -n "\033[32;1mOK\033[0m\nDownloading sublime..."
curl -O https://files-cdn.cnblogs.com/files/rui-4825/linux_sublime_text_3_build_3211_x32.001.7z -O https://files-cdn.cnblogs.com/files/rui-4825/linux_sublime_text_3_build_3211_x32.002.7z -O https://files-cdn.cnblogs.com/files/rui-4825 /linux_sublime_text_3_build_3211_x32.003.7z  -s || error
echo -e -n "\033[32;1mOK\033[0m\nInstalling sublime..."
j=0; for i in *.7z; do let j=j+1; mv $i ${i%.0*}.7z.00$j; done
7z x linux_sublime_text_3_build_3211_x32.7z.001 > /dev/null 
tar jxvf sublime_text_3_build_3211_x32.tar.bz2 > /dev/null
rm linux_sublime_text_3_build_3211_x32.7z.00* sublime_text_3_build_3211_x32.tar.bz2 linux_sublime_text_3_build_3211_x32.001.7z -f
echo -e -n "\033[32;1mOK\033[0m\nDownloading config..."
cd ~/.config
curl -O https://files-cdn.cnblogs.com/files/youxam/sublime-text-3.tar.gz -s || error
echo -e "\033[32;1mOK\033[0m"
curl -o ~/Desktop/sublime_text_3.desktop  https://blog-static.cnblogs.com/files/youxam/sublime_text_3.desktop.js -s
chmod +x ~/Desktop/sublime_text_3.desktop
tar -xzvf sublime-text-3.tar.gz > /dev/null && rm sublime-text-3.tar.gz -f
if [ ! $1 ]; then
	echo "config source: default"
	echo -e -n "Configuring..."
else
	echo "config source: $1"
	echo -e -n "Configuring..."
	curl -o /tmp/config.tar.gz  https://files-cdn.cnblogs.com/files/$1/config.tar.gz -s
	tar xzvf /tmp/config.tar.gz -C ~/.config/sublime-text-3/Packages > /dev/null || error
fi
echo -e "\033[32;1mOK\033[0m"
grep  "sublime_text_3" ~/.bashrc || sed -i '1i\alias code=\"~/.local/bin/sublime_text_3/sublime_text\"'  ~/.bashrc
echo "Successfully installed!"
上一篇:Linux自启动服务守护进程,jar包启动服务shell脚本实现


下一篇:嵌入式100题(033):TCP、UDP的优缺点