为避免重装完系统后的琐碎重复的配置工作,写一自动化配置脚本如下:
ubuntu_rc
#!/bin/sh
# ubuntu_rc: Config the environment after the installation of Ubuntu
# this script is strongly recommend executed with root
#
# define variables
SRC=~/Downloads
LOG=~/log
ERROR_LOG=~/error_log
# define functions
status()
{
STATUS=$?
#echo -en "\033[68G"
if [ "$STATUS" -eq 0 ] ; then
echo "\033[1m[OK]\033[0m"
else
echo "\033[1m[Failed]\033[0m"
fi
}
# Update from source list
echo "Updating from Ubuntu source list..."
apt-get update 2>$ERROR_LOG
apt-get upgrade 2>>$ERROR_LOG
status
# Install google chrome
cd $SRC
echo "Installing Google Chrome..."
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 2>>$ERROR_LOG
dpkg -i google-chrome-stable_current_amd64.deb 2>>$ERROR_LOG
apt-get -f install 2>>$ERROR_LOG
status
# Install vimide
echo "Installing vim..."
apt-get install vim ctags 2>>$ERROR_LOG
apt-get install git 2>>$ERROR_LOG
status
echo "Configing vimide..."
git clone git://github.com/victorschen/vimide.git 2>>$ERROR_LOG
mv vimide ~/.vim 2>>$ERROR_LOG
ln -s ~/.vim/vimrc ~/.vimrc 2>>$ERROR_LOG
status
# Check if success
if [ -f $ERROR_LOG ] ; then
echo "Execute failed!"
cat $ERROR_LOG
else
echo "All success!"
fi
浙公网安备 33010602011771号