|
发表于 2004-11-16 12:18:22
|
显示全部楼层
目录为/usr/local/glc的修订版
- #!/bin/bash
- ###
- ### sync with the chinese portages
- ###
- WORKDIR=/tmp
- PORTAGEDIR=/usr/local/glc
- # reset CTRL+C signal
- trap "clean_and_exit" 2
- function clean_and_exit ()
- {
- printf " ....Received KILL signal, NOW exit!!
- "
- rm -f ${WORKDIR}/portage.tar.gz
- exit
- }
- if [ `whoami` != "root" ]
- then
- echo "....Sorry dude, you need to be root to do this!"
- exit
- fi
- echo "Start downloading the glc snapshot...."
- wget http://www.magiclinux.org/cgi-bin/viewcvs.cgi/gentoo/portage.tar.gz?view=tar -O ${WORKDIR}/portage.tar.gz
- if [ $? -ne 0 ]
- then
- echo "....Oho! Something went wrong with the download!"
- exit
- fi
- echo "Download successful!"
- echo "Removing the old snapshot..."
- rm -rf ${PORTAGEDIR}/*
- echo "Extracting files..."
- tar zxvf ${WORKDIR}/portage.tar.gz -C ${PORTAGEDIR}
- mv ${PORTAGEDIR}/portage/* ${PORTAGEDIR}
- rmdir ${PORTAGEDIR}/portage
- if [ $? -ne 0 ]
- then
- echo "....Something went wrong in extracting files!"
- exit
- fi
- echo "Removing the temp file..."
- rm -f ${WORKDIR}/portage.tar.gz
- echo "Sync completed successfully, enjoy!"
复制代码 |
|