[zt]stable-supfile-利用CVSUP更新Security+Patch

来源:互联网 发布:程序源码去哪里卖 编辑:程序博客网 时间:2024/06/07 06:07
 【前言】

CVSUP是一套維持軟體原始碼和開發團隊的更新工具,本篇為說明更新 Security Patch,即只執行

 1.編譯所有的系統程式 (make buildworld)
2.編譯新的系統核心 (make buildkernel)
3.安裝新的系統核心 (make installkernel)
4.安裝新的系統程式 (make installworld)

上述第二、三步驟可簡化為 make kernel (配合/etc/make.conf),但不執行更新系統設定檔 (mergemaster) 因為本篇只針對安全性作更新而以並不打算更新設定檔。

【作業環境】

FreeBSD 5.4-RELEASE

cvsup-without-gui-16.1h

【安裝及設定】

Step1.安裝cvsup

 #cd  /usr/ports/net/cvsup-without-gui/     //路徑
#make install clean //安裝套件並清除安裝過程中產生不必要檔案

Step2.說明

 #cd /usr/share/examples/cvsup/             //路徑

檔案介紹:

 cvs-supfile        //更新Main source tree and ports collection
doc-supfile //更新Document
gnats-supfile //更新FreeBSD bug database
ports-supfile //更新Ports collection
stable-supfile //更新Main source tree
standard-supfile //更新Main source tree
www-supfile //更新FreeBSD 官方網頁

Step3.修改stable-supfile

修改 stable-supfile 內容

 #cd /usr/share/examples/cvsup            //路徑
#vi stable-supfile //修改原更新站台位置內容如下
*default host=CHANGE_THIS.FreeBSD.org //官方站台(預設值)
*default host=cvsup.tw.freebsd.org //改為國內站台交大資工如此下載速度較快(還有cvsup1~13都可使用)
*default release=cvs tag=RELENG_5 //預設值
*default release=cvs tag=RELENG_5_4 //更改後只有安全更新會進入這個 branch的 source code

Step4.執行更新

執行更新的方式有二種(看個人習慣擇一吧)

方式一、使用修改後的 stable-supfile 來更新,更新方式如下

 #cd /usr/share/examples/cvsup           //切換路徑
#rehash //才不會出現指令無效訊息(cvsup: Command not found.)
#cvsup -g -L 2 stable-supfile //開始更新

方式二、修改 /etc/make.conf 來執行更新,更新方式如下

先修改 /etc/make.conf

 KERNCONF=XEON                                     //指定要編譯的核心設定檔名稱
SUP_UPDATE=yes //自動呼叫 cvsup 更新
SUP=/usr/local/bin/cvsup //指定 cvsup 的程式路徑
SUPFLAGS=-g -L 2 //採用的 cvsup 參數
SUPHOST=cvsup.tw.FreeBSD.org //指定 cvsup 的主機網址
SUPFILE=/usr/share/examples/cvsup/stable-supfile //指定使用哪一個 supfile 範本

再來執行更新動作

 #cd /usr/src
#make update

可以看到更新資訊

 更新完成訊息:Shutting down connection to server
Finished successfully
更新中斷訊息:Suspended(再執行一次吧)

更新完成後可less /usr/src/UPDATING可看到更新後 patch 的日期、說明

Step5.利用make world更新

系統對時,為了避免因為系統時間不準而造成執行 make 時失敗,我們先以 ntpdate 進行網路對時

 #ntpdate -s watch.stdtime.gov.tw

由於儘是 security branch upgrade 而以執行後不在執行mergemaster來更新/etc下及相關檔案

 #cd /usr/src 
#make world kernel //4.x版本請執行此行
#make kernel world //5.2及更早的版本請執行此行
#reboot

而使用5.3及5.4版本的朋友因為make world必須分開執行了(若還是執行make kernel world將會出現錯誤訊息)所以步驟如下(其實就是/usr/src/Makefile步驟)

 #cd /usr/src
#make buildworld kernel
#reboot
#make installworld
#reboot

重開機完成後再鍵入uname -rs可知patch已經上去(-pX),今天更新後為FreeBSD 5.4-RELEASE-p8