星期二, 8月 03, 2010

利用 script 更新台灣的openSUSE套件庫

有時候安裝完 openSUSE Linux
套件庫預設是去抓 software.opensuse.org 的套件庫

有時候連線的速度很慢, 所以就寫了一個懶人的 script 來更換台灣這邊的套件庫

目前 openSUSE 11.3  高品質學術網路還沒有 sync, 所以先用原來的套件庫

shell script 內容如下

#!/bin/bash
echo "Print the rep  in use"
zypper  lr -u


#Define openSUSE Version
VERSION=`cat /etc/SuSE-release | grep VERSION | cut -d ' ' -f 3`
echo "This openSUSE version is $VERSION"


echo "Remove Ori Rep"
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1


echo "Add Taiwan's rep "


## for OSS
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/distribution/$VERSION/repo/oss/  Twaren-Oss
#zypper ar -f http://download.opensuse.org/distribution/$VERSION/repo/non-oss/ suse_non-oss
#zypper ar -f http://ftp.ncnu.edu.tw/Linux/opensuse/distribution/$VERSION/repo/non-oss/ ncnu_non-oss


## for Non-OSS
#zypper ar -f http://ftp.cse.yzu.edu.tw/pub/Linux/openSUSE/distribution/$VERSION/repo/non-oss/  cse_non-oss
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/distribution/$VERSION/repo/non-oss/ Twaren-Non-oss


## for update
#zypper ar http://ftp.twaren.net/Linux/OpenSuSE/update/$VERSION/repodata/  twaren_update
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/update/$VERSION/  Twaren-Update
#zypper ar -f http://download.opensuse.org/update/$VERSION/  suse_update


## for Pacman Rep
zypper ar -f http://ftp.nchc.org.tw/Linux/Packman/suse/$VERSION/ NCHC-Pacman
#zypper ar -f http://ftp.twaren.net/Linux/Packman/suse/$VERSION/ twaren_packman



先記下來  ︿︿
以後在新的電腦, 複製貼上來執行即可

enjoy it ~

沒有留言: