用脚本修改UBUNTU源为archive.ylmf.net

九月 10th, 2009 Posted in Shell, Ubuntu | 阅读次数: 155 次

vi ylmf-apt.sh

#!/bin/bash
#power by hugwww
#change apt source

#ubuntu 8.04
if [ $(cat /etc/lsb-release |grep "\" |wc -l ) -ge 1 ];
then
CODENAME=”hardy”
fi

#ubuntu 8.10
if [ $(cat /etc/lsb-release |grep "\" |wc -l ) -ge 1 ];
then
CODENAME=”intrepid”
fi

#ubuntu 9.04
if [ $(cat /etc/lsb-release |grep "\" |wc -l ) -ge 1 ];
then
CODENAME=”jaunty”
fi

#ubuntu 9.10
if [ $(cat /etc/lsb-release |grep "\" |wc -l ) -ge 1 ];
then
CODENAME=”karmic”
fi

#back old source,update to ylmf ubuntu source
if [ $CODENAME ]
then

msg=”#ylmf ubuntu apt source 2009-09-09 update:`date` \n\n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME main restricted \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME main restricted \n\
\n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME-updates main restricted \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME-updates main restricted \n\
\n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME universe \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME universe \n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME-updates universe \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME-updates universe \n\
\n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME multiverse \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME multiverse \n\
deb http://archive.ylmf.net/ubuntu/ $CODENAME-updates multiverse \n\
deb-src http://archive.ylmf.net/ubuntu/ $CODENAME-updates multiverse \n\
\n\
deb http://security.ubuntu.com/ubuntu $CODENAME-security main restricted \n\
deb-src http://security.ubuntu.com/ubuntu $CODENAME-security main restricted \n\
deb http://security.ubuntu.com/ubuntu $CODENAME-security universe \n\
deb-src http://security.ubuntu.com/ubuntu $CODENAME-security universe \n\
deb http://security.ubuntu.com/ubuntu $CODENAME-security multiverse \n\
deb-src http://security.ubuntu.com/ubuntu $CODENAME-security multiverse \n”

#echo -e $msg
cp /etc/apt/sources.list /etc/apt/sources.list-bak
echo $msg >/etc/apt/sources.list
echo “已更改为ylmf ubuntu源!”

fi

完成!

随机日志

One Response to “用脚本修改UBUNTU源为archive.ylmf.net”

  1. antwerp hotels Says:

    Great website…

    [...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]………


留下您的脚印