¡¾Ô´´¡¿Óýű¾ÊµÏÖÔ²ÌåµÄ×Ô¶¯°²×°£¨×ÖÌåÃÀ»¯£©
[code][0 No.510 bash_codes $ ] cat yuanti_fonts_install.sh
#! /bin/bash
# this script used to install VeraSansYuanTi on debian/ubuntu system
# [email]li-jiahuan@sohu.com[/email]
#set -n
workdir=/tmp/yuanti
mkdir -p $workdir
cd $workdir
trap 'cd;rm -rf $workdir;exit' 0 2 15
file=
link='http://download.ubuntu.org.cn/software/VeraSansYuanTi.tar.gz'
if [[ $(id -u) != 0 ]];then
echo "You must be root to run this scritp"
exit
fi
if [[ -z $1 ]];then
cat <<- EOF
1) Download VeraSansYuanTi.tar.gz from ubuntu.org.cn
2) Enter in location of VeraSansYuanTi.tar.gz
EOF
read opt
case $opt in
1)
wget -O VeraSansYuanTi.tar.gz -c $link
if [[ $? != 0 ]];then
echo "Failure, VeraSansYuanTi.tar.gz could not be downloaded"
exit
fi
file='VeraSansYuanTi.tar.gz'
;;
2)
read -p "location: " file
if [[ ! -e $file ]];then
echo VeraSansYuanTi.tar.gz not found via "$file"
exit
fi
;;
*) echo "Wrong selection"
exit
;;
esac
else
file=$1
if [[ ! -e $file ]];then
echo VeraSansYuanTi.tar.gz not found via $file
exit
fi
fi
echo -e "\nNow decompressing ...\n"
tar xzvf $file
echo -e "\nNow install fonts file ... \n"
mv VeraSansYuanTi /usr/share/fonts/
sudo fc-cache -f
cp /etc/fonts/fonts.conf /etc/fonts/fonts.conf.old
cp /usr/share/fonts/VeraSansYuanTi/fonts.conf /etc/fonts/
cd ; rm -rf $workdir
echo "YuanTi install done.If you are running X,you need to restart X to make it available."
[/code]
Ò³:
[1]