[更新]中文portage同步脚本:glc_sync
by xiaosuo | 软件相关 |
2004年11月20日23:36星期六 |
处理了本地中文portage的目录可能不是portage的情形,将配置独立出来到/etc/glc.conf 配置文件如下:
代码 | ### ###the glc portage config file ###
###the glc portage directory that you have set in /etc/make.conf ###WARNING:NO space near the "="
GLCPORTAGE=/usr/local/portage
|
警告:等号两边不要有空格。 glc_sync脚本下载 glc_sync脚本源码:
代码 | #!/bin/bash ### ### sync with the chinese portages ###
source /etc/glc.conf if [ -z ${ GLCPORTAGE } ] then echo "!!!GLCPORTAGE is empty,so use the default value" GLCPORTAGE=/usr/local/portage fi
TMPDIR=/tmp PORTAGEDIR=${ GLCPORTAGE%/* } PORTAGE=${ GLCPORTAGE##*/ } # reset CTRL+C signal trap "clean_and_exit" 2
function clean_and_exit () { printf "\n!!!Received KILL signal, NOW exit\n" rm -f ${ TMPDIR }/portage.tar.gz rm -rf ${ TMPDIR }/portage exit }
if [ `whoami` != "root" ] then echo "!!!Sorry, you need to be root to do this" exit fi
#the download loop #if something went wrong, retry while : do echo "Start downloading the glc snapshot...." wget http://www.magiclinux.org/cgi-bin/viewcvs.cgi/gentoo/portage.tar.gz?view=tar -O ${ TMPDIR }/portage.tar.gz
if [ $? -ne 0 ] then echo "!!!Something went wrong when downloading" rm -f ${ TMPDIR }/portage.tar.gz echo "Now retry to download" continue fi
echo "Download successfully"
echo "Extracting files..." rm -rf ${ TMPDIR }/portage tar zxvf ${ TMPDIR }/portage.tar.gz -C ${ TMPDIR }
if [ $? -ne 0 ] then echo "!!!Something went wrong when extracting" echo "Now retry to download" rm -f ${ TMPDIR }/portage.tar.gz continue fi
#download successfully break done
rm -rf ${ PORTAGEDIR }/${ PORTAGE } mv ${ TMPDIR }/portage ${ PORTAGEDIR }/${ PORTAGE }
echo "Removing the temp file..." rm -f ${ TMPDIR }/portage.tar.gz
echo "Sync completed successfully, enjoy!"
|
|
字体:大 中 小 |
|
|
|
|
|