Subscribe to RSS Subscribe to Comments Blog of Roy Chan

Blog of Roy Chan

Upgrade to Diablo (Maemo 4.1)

Ok, you won’t believe that I haven’t upgrade my N800 to the lateast OS2008, Diablo (Maemo 4.1) until today. I even unaware it til bunny tell me few weeks ago.

2 Major things that diablo delights me are the Chinese support on RSS reader and the new mail client Modest. Ok, it also shipped with the Chinese font MHei18030C5.ttf. But I used the Chinese font provided by Google’s Android SDK which is much better then AR PL UMing since I upgrade to OS2008 beta. I have never got a problem on reading Chinese in N800. However, the broken Chinese support in RSS reader in Maemo 4.0 really make it useless for me. It is great they really fix it in Diablo. Besides, the long waiting Modest is pretty great. I had try the beta version of it last year in OS2008 beta and found it is much better then the old mail client. However the beta version didn’t integrated well with Task applet. I haven’t use the N800 to read mail since I upgrade to the official OS2008 (Maemo 4.0) coz it didn’t ship with Modest. Now, n800 can really become the Internet Tablet instead of only an E-Book reader or Podcast player for me. Wow!!!!!


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


GNU/Linux HSDPA (3.5G) 上網!?

早一陣子,有人問我 GNU/Linux 可不可以 HSDRA (3.5G) 上網。現在香港 HSDPA 計畫都頗貴,我沒有錢使用,所以亦答不到。不過研究一下亦無況。

Google 搜索一下,Tuxmobil 有一專頁收集了有過 GNU/Linux 3G 上網的資料。似乎上 Smartone-Vodafone 最新那個 HSDPA USB stick 有 GNU/Linux 驅動器,有 Debian、Fedora 8 和 OpenSuSE 10.3 等 distro 的套件預備。但見討論區有不少人投訴驅動器有問題。

有機會要找個有 Smartone-Vodafone USB stick 的朋友備來試試。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Feodra 9 中 KDE4 的中文支援問題

KDE4 的介面有很多吸引人的支援,不過多個使用 KDE4 的 distribution 在中文支援都問題多,繼 Kubuntu KDE 4 Remix 後,Fedora 9 中的 KDE4 也是沒有搞好中文支援。在 VM 試了幾次,亦在些簡介一下修正中文支援問題的方法 (本文最新版本已拼入 OSWiki 中的 安裝 Fedora 9使用 LiveCD 安裝 Fedora 9 桌面中):

首先需要自行自行安裝下以套件(Package):

  • kde-l10n-Chinese - KDE 簡體中文支援
  • kde-l10n-Chinese-Traditional - KDE 繁體中文支援
  • im-chooser - 讓您設定輸入法引擎的圖形介面工具。
  • scim-tables-chinese - SCIM 的中文輸法表,包括香港人常用的倉頡、速成、港式廣東話、行列、五筆等。安裝此套件時 YUM 自動會安裝其他所需的 SCIM 套件。
  • scim-pinyin - SCIM 智能漢語拼音輸入法。安裝此套件時 YUM 自動會安裝其他所需的 SCIM 套件。
  • scim-chewing - SCIM 酷音輸入法 (一種智能注音輸入法)。安裝此套件時 YUM 自動會安裝其他所需的 SCIM 套件。

即是使用倉頡、速成或港式廣東話的使用者可以打命令:

yum install kde-l10n-Chinese-Traditional im-chooser scim-tables-chinese

即是使用漢語拼音的使用者可以打命令:

yum install kde-l10n-Chinese im-chooser scim-pinyin

即是使用的使用者可以打命令:

yum install kde-l10n-Chinese-Traditional im-chooser scim-chewing

安裝完成後,執行 im-chooser。勾選 Enable input method feature,選擇 “Use SCIM”

使用 LiveCD 安裝的朋友需要在 K 選單中選 應用程式(Application) -> 設定(Settings) -> 系統設定(System Settings)。在系統設定(System Settings)中選擇地區與語言(Regional and Language),並在新增語言 (Add Language) 中選擇『繁體中文』(Chinese)後按套用(Apply)。

再重新登入後,您需要在 SCIM 輸入法設定中的 介面(前端) -> 全域設定中的以下三個快速鍵:

  • 作用鍵: Control+space
  • 下一種輸入法: Shift+Control+KeyRelease+Shift_L

設定後,按『確定』。

相關連結:


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Ubuntu 上的圖形介面 PPPoE 連接程式!? Gnome System Tools 2.22

慣性教人在 Ubuntu 或 Debian 連上 xDSL 都是使用文字模式的 PPPoE 設定程式 pppoeconf 。不過跟據多年教人使用 GNU/Linux 的經驗,很多人對就算遇然打一兩句命令或文字模式的程式都很抗拒的。號稱人性化的 Ubuntu 多年來仍只用文字模式的 pppoeconf 來設定 xDSL 連線,似乎有點說不過去。

不過令天倒留意到 GNOME System Tools 2.22 中的 network-admin 似乎有了 PPPoE 的支援。翻查 changelog ,PPPoE 和 GPRS/UMTS 是在 2.21.4 時加入。(去年 12 月推出)

只要選取 系統 -> 管理 -> 網路 執行 network-admin ,雙擊 “點對點連接” (Point-to-Point connection) 。

GNOME System Tools 的 network-admin

在 ppp0 的屬性中,勾選啟用這個連線 (Enable this connection),就在連線類型 (Connection Type) 中,選擇 序列數據機 (Serial Modem)、 PPPoE 或 GPRS/UMTS 。

PPPoE 設定

因為本人的寬頻供應商不使用 PPPoE ,所以未能測試這個新功能。如果有人可以幫手測試一下,並郵寄一兩個 screenshot 給我, 我會感激不盡。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


堅強的鷺展翅! Ubuntu 第二個長期支援版 8.04 登場

Ubuntu 8.04 (Hardy Heron) 終於在最幾天正式進出。跑了幾天,似乎比 7.10 穩定很多。因為事前已把 OSWikiHK中的 Ubuntu 安裝手冊更新得七七八八,也在正式進出後幾個小時正式貼上 8.04 的桌面伺服器的安裝手冊。結果反應不錯,單計 8.04 桌面安裝手冊,兩天裡每天都有近 700 個 hits 。Mobile01 一個 post 就貢獻了百多個 hits。不過 server 就有點辛苦了。

留意這版本中 Edubuntu 不成有獨立的安裝光碟 ,反而變會 Ubuntu 的一個 extension 。而 Kubuntu 也分別有 KDE 3 和 KDE 4 兩個版本的光碟,KDE 4 版未能輸入中文。這個版本另一大賣點是收錄了著名 Wubi , Windows 使用者可以不分割硬碟安裝 Ubuntu。原理並不新鮮,只是在 Windows 上建立一個大的檔案作為 Ubuntu 的 virtual partition,Boot 入 Ubuntu 時, Ubuntu 自然會使用該檔案佔據的位置作為 / ,速度不會比平常安裝出來 Ubuntu 慢。更好的時,Windows 使用者可以像移除普通 Windows 軟件般在 Windows 上移除 Wubi 安裝出來的 Ubuntu。此舉加大了打破 Windows 使用者心理障礙的機會。找台 Windows 機來試,稍後再加上桌面安裝手冊中。

更新: 《使用 Wubi 在 Windows 安裝 Ubuntu/Kubuntu/Xubuntu》已完成了。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


修正 Ubuntu 在安裝其他 Distribution 後不能休眠問題

這個問題解決了差不多半年,不過近日安裝 Fedora 8 在 Ubuntu 7.10 的電腦上,又要修正一次。所以順道寫下來記錄一下。

Ubuntu 預設使用 UUID 辯認不同的分割區。格式化 swap 分割區會重新產生一個新的 UUID ,令 Ubuntu 不能找不到 swap 分割區。由於系統休眠 (Hibernation) 要將系統狀態儲存入 swap 分割區。找不到會令 swap 分割區會令休眠和回復失敗。所以我們需要告訴 Ubuntu swap 分割區的新 UUID 才能修正休眠功能。

先用 blkid 找出 swap 分割區的新 UUID :

# blkid  
/dev/sda1: TYPE=”ntfs” 
/dev/sda2: UUID=”b8a89b69-f090-4012-94f6-a243014d1184″ SEC_TYPE=”ext2″ TYPE=”ext3″ 
/dev/sda5: LABEL=”SwapSpace” UUID=”62a19d18-5c43-4df8-9df0-70353bf7dc5d” TYPE=”swap” 
/dev/sda6: UUID=”6357e627-dea6-418f-8735-14ddc377ff66″ SEC_TYPE=”ext2″ TYPE=”ext3″ 
/dev/sda7: UUID=”02c44f5b-d41e-42d3-9dfa-9517be310d3f” SEC_TYPE=”ext2″ TYPE=”ext3″ 
/dev/sda8: UUID=”0a22b594-f2ce-4183-8aa3-ea3a7b9a371d” SEC_TYPE=”ext2″ TYPE=”ext3″ 
/dev/sda9: LABEL=”/” UUID=”bc101f56-e391-4022-b280-d29eb7cf76a5″ SEC_TYPE=”ext2″ TYPE=”ext3″ 

現在我們可以得知 Swap 分割區的 UUID 是「62a19d18-5c43-4df8-9df0-70353bf7dc5d」。先修正 /etc/fstab 中的 Swap 分割區位置:

# /dev/sda5
# UUID=e5113b30-3c4c-4ddc-9c14-e4ecd0374886 none          swap    sw              0       0
UUID=62a19d18-5c43-4df8-9df0-70353bf7dc5d none            swap    sw              0       0

接著要改變休眠回復的分割區 UUID 。先修正 /etc/initramfs-tools/conf.d/resume上的 UUID:

RESUME=UUID=62a19d18-5c43-4df8-9df0-70353bf7dc5d

然後打「update-initramfs -u」重建 initrd 檔。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Philips 220EW and Gutsy

Spent some time to configure the Gutsy (Ubuntu 7.10) to work with Philips’ 22-inch LCD monitor. Th mon suppose can display up to 1680×1050 pixels. However, it doesn’t work in Gutsy. The display shift to right and keep blinking. I try to configure the X Window with displayconfig-gtk and editing xorg.conf manually but no luck.

xvidtune doesn’t help and Google show that some people also suffer same situation on Gutsy but fixed in Fedora 8. I haven’t try to install Fedora 8. But at least, I found the mon work well in 1440×900@60Hz. Anyway, lazy to make a further study. 1440×900 is fine for me. p

Update: Hardy (Ubuntu 8.04) fixed it and able to display 1680×1050.


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


N800 用後一週

R&D mode

之前提過 Maemo 的 R&D mode ,終於提到一點資料。做法頗煩複,要在 flash 時在 flasher 加上選項 “--enable-rd-mode“。啟用了 R&D mode 主要可以用 “sudo gainroot” 進入 root 和按開關掣會立即開機 (平時要按數秒才開機)。

似乎還是用 becomeroot 套件比較方便。

自動掛載或卸載 SD

年頭看一些 N800 的評論,有人投訴 N800 的 status bar 沒有退出 SD 卡的工具,懷疑要手動在終端機打 “umount /media/mmc1“。N800 到手後,我實際觀察,發覺當你打開 External SD slot 的蓋時, N800 已感應到並自動 unmount SD。當你關閉 slot 蓋,N800 又會自動 mount 起 SD 卡。如果你打開 slot 蓋時有程式正使用 SD 卡上卡的檔案 (如終端機 cd 到 /media/mmc1 ) ,N800 會彈出警告訊息。

在 MicroB Browser 選擇文字

初用 MicroB Browser ,發覺不能選擇文字作 copy&paste ,在網頁上拖拉只會令網頁捲上下左右。早幾天用手指捲動網頁才發覺偶然可以選擇文字,再查看線上說明,才知道要快速點擊網頁,就可以拖拉選擇文字作 copy&paste。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Ubuntu 7.10 和 Fedora 8

這大半年的時間都很懶寫 blog, 一來忙 MSc, 二來也多花時間去整理 OSWikiHK。順帶提一提 Ubuntu/Kubuntu/Edubuntu/Xubuntu 7.10 (Gusty Gibbon) 的安裝手冊 (桌面伺服器)早在個多月前已完成了。也有份教人由 Ubuntu 7.04 (Feisty)升級至 7.10 的文章Fedora 8 (Werewolf)才完成了幾個星期 (LiveCD 倒時未正式動手)


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


How to login root in Nokia OS2008 (N800/N810)

Skype in OS2008

I have just upgrade my new N800 to OS2008 beta (Maemo 4.0). Most program run faster and more smooth in OS2008, including MicroB Browser and the PDF Viewer. Of course, you should aware that many application are not ported to OS2008 yet. (Compared that there is 191 apps in www.maemo.org for OS2007 but only 37 for OS2008 )

After upgraded to OS2008, I found that I can’t login as root as in OS2007. Different from the GNU/Linux embedded devices I used before, Maemo use a better security structure. It run most application in a common user “user” instead of “root” in other embedded platforms. Sudo is used to execute tasks needed system administrator right. And you will see many rules is defined in /etc/sudoers.

### Automatically added by update-sudoers start ###
user ALL = NOPASSWD: /etc/init.d/ke-recv start
user ALL = NOPASSWD: /etc/init.d/ke-recv stop
user ALL = NOPASSWD: /etc/init.d/alarmd start
user ALL = NOPASSWD: /etc/init.d/alarmd stop
user ALL = NOPASSWD: /etc/init.d/osso-hss start
user ALL = NOPASSWD: /etc/init.d/osso-hss stop
user ALL = NOPASSWD: /usr/bin/osso-product-info
user ALL = NOPASSWD: /bin/rm -f /tmp/.opi.tmp
### Automatically added by update-sudoers end ###

In OS2007, the root user was “protected” by a simple password “rootme”. It wouldn’t cause much problem until you install ssh server in it. The password of user “user” is locked. You can change it by “su” as root and change the password of user by “passwd user“. However, things changed in OS2008. They locked both the password of “root” and “user”. You can’t login root with “su” anymore.

It is said that you can use switch it to R&D mode or install a package becomeroot to get back your root again. I have no idea about R&D mode but found the becomeroot. Here is the procedure (Beware that the following step will introduce security risk to your tablet, make sure you know what you are doing and pick good passwords):

  • Open the web browser (MicroB browser)
  • Download the becomeroot package with the web browser, choose “Open” to install it.
  • After that you can login the root by typing the following command in the XTerm:
  sudo gainroot
  • Now you can change the password of “user” and “root” with “passwd user” and “passwd root“.

Warnning: Notice you again that the above action may allow people to take the control your tablet from wireless network. Choose good passwords for the both account.


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


New Gadget: Nokia N800

Nokia N800

Let see my new Gadget!!! It’s not iPhone! Not EeePC! Not even the latest N810 but the previous version of Nokia GNU/Linux Internet Tablet N810 which released nearly a year. Wow!!!!!


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


加快 Notebook 啟動 Ubuntu 速度: 取消開機自動啟動網絡

老方法,不過好像一直沒有記下來。

在 Notebook 啟動 Ubuntu 一般都會很慢。因為 Ubuntu 的圖像開機畫面令人看不到那裡出現問題。按 Alt-Ctrl-F8 就可以發現原兇。問題在於 Notebook 多會使用無線網絡,而開機時一般都還未連上無線網絡或插上網線。而和一般 GNU/Linux 一樣, Ubuntu 開機會自動啟動網絡。當 /etc/init.d/networking 未能找到網絡,自動需要等 timeout 才宣告啟動網絡失敗和繼續下一步。這一下 timeout 要浪廢十多二十秒的時間。

反正現時的網絡連接都交由 Network Manager 管理,我何大可以 rm /etc/rcS.d/S40networking 以取消開機自動啟動網絡,侍登入帳戶後, Network Manager 自動會動連幫我們連接網絡。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


防孤兒行動!!!!!

剛剛在 Planet.Compiz-Fusion.org 看到這段 xkcd 的漫畫:

orphaned_projects.png

P.S. Foka 剛提醒我漫畫有 title 有一小段故事,我懶得貼上來,請自己點去原站,把 mouse 放在漫畫上等數秒。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


How gnome-codec-install in Ubuntu work?

Ok, I know that I can ask people to install all GStreamer plugin to solve the codecs problems. But some people keep asking which package they need exactly. One thing in Ubuntu 7.04 that help me a lot is that is that it can detect the codec you need when you try to play a multimedia file and help you to install the packages. However, I still need to told people which package they really need on other distros.

I try to look around the gnome-codec-install and dig out how it know which package we need. First, gnome-codec-install is only a symbolic link of gnome-app-install. gnome-app-install put information of all available desktop applications in .desktop file under /usr/share/app-install/desktop. Those codecs package got the field “X-AppInstall-Codecs’ in their .desktop file. update-app-install will collect the information of all .desktop and build index in /var/cache/app-install/. The index file is in GDBM. I’m lazy to decode it. Therefore, I wrote a one-line shell command to build an index table from the .desktop files. Run the following command under /usr/share/app-install/desktop


grep  -l 'X-AppInstall-Codecs' * | while read file;
    do
        pkg=`basename "$file" .desktop`;
        grep 'X-AppInstall-Codecs' $file | \
            sed -e 's/^X-AppInstall-Codecs//' \
                -e 's/[=;]0.10:/\n'$pkg':/g' \
                -e 's/\.desktop$//'
    done | awk -F: '{printf "%s:%s\n", $2, $1}' | sort | less

Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Beryl 在北京的”Wah” 電腦新體驗

Ubuntu 7.04 Beryl Cube

上星期在南京北京走了一趟,到現在才有時間寫寫這次出差的經驗。

為北京分公司做宣傳,這次北京短短兩天半的時間走訪了幾間北京的大學和高等學院介紹GNU/Linux和Computer Forensics。由於事忙,一直未有準備演講的內容,加上北京同事設提的壓力,隨手找了最簡單的Beryl作演示,結果反應好得令我出奇。Beryl獨有的火燒視窗環形視窗切換器(Ring Window Switcher)等固然引來哄動的徊響。然而,傳統的cube和橡皮糖視窗招來”Wah! Wah!”的驚嘆!

微軟在宣傳Vista時就用一系列所謂”Wow”體驗的故事和所謂”Wow”電腦新體驗的口號。三月時,我就曾和YPWong討論過利用Beryl製造一些”Yeah”/”Yo”體驗的故事和Vista打對台,後來因時間問題不了了之。但這次北京之旅,我們確實真的利用Beryl打造了”Wah”電腦新體驗的故事。


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


606 和 610

看到這兩個數目字,我們想到的不是熊貓,而是野鴨和小蜥蜴 ;P。 那 704 和 710 會送到那裡?


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Ubuntu群有多瘋狂!?

我來試試Ubuntu人有多瘋狂!? 由Ubuntu 6.10 (Edgy Eft) 升級的人請先參看 http://www.ubuntu.com/getubuntu/upgrading。 要Ubuntu 7.04 (Feisty Fawn) Desktop CD-ROM ISO的香港朋友可以試試我家的電腦:

另外還有未完成的Install Guide


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Ubunt 7.04 - 活躍的小鹿(Feisty Fawn)出世了

結果 Ubuntu 7.04 還是準時推出。不知是否太多關注這次發佈,早上 Ubuntu 官方網站經常連不到。如果真的是這個原因,Mark Shuttleworth似乎要開大事慶祝了。以這幾天的情況,我勸大家還是使用BT下載Ubuntu ISO把。我已長期開了Desktop i386amd64的torrent,希望幫到大家。

相關連結


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


Fix your chinese support in Debian 4.0

While Debian GNU/Linux 4.0 (Etch) released on Easter, there are some bugs on the Chinese support:

  • Display Full-width(全形) English character in HK locale - If you choose the HK during installation, Debian will not install the font “AR PL ShangheiSun Uni” (ttf-arphic-uming). Then it will use 12×13ja.pcf.gz in xfonts-base to display the Chinese character . Install ttf-arphic-uming will fix it.
  • No Chinese Input Method - You should install scim yourself. For hongkong people who prefer using Cangjie/Quick input method, you can install scim-tables-zh and APT will install every things you need
  • Don’t start Chinese input method engine automatically - You should install im-switch yourself

What you need to do is:

su -c 'apt-get install ttf-arphic-uming scim-tables-zh im-switch'

Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]


如何重新編譯dpkg套件

當你在使用Ubuntu/Debian的正式發行版本,但想使用在開發版本中的新加入的軟體或者想使用在開發版本中有關軟體的新版本,又或者想微調某些軟體的編譯設定。當然backport.org有不少由Debian開發版本backport回到正式發行版本的套件,而Ubuntu亦有提供edgy-backports軟體庫,但如果他們沒有提供你需要的軟體或不符合你的要求,那你就需要重新編譯dpkg套件。

注意本文都最完整和最新版本改放上OSWikiHK,請到那裡參考。

取得源碼

首先自然需要先取得有關dpkg套件的源碼包。和RPM不同的套件源碼一般都有三個檔案:

  • 源程式碼包 (*.orig.tar.gz) - 這是有關軟體原身的源程式碼包 (例如: mod-cband_0.9.7.5.orig.tar.gz) 。原則上是完全沒有被改動過(除了檔案名稱被改至符合dpkg的規格外),和在開發者網站取得的一模一樣。
  • 套件描述 (*.dsc) - 有對有關軟體的簡單描述 (例如: mod-cband_0.9.7.5-1.dsc) 。包括套件名稱、版本、維護者、可編譯平台、編譯時需要的套件和 orig.tar.gz 及 diff.gz 檔的 hash 值。為確保套件沒有被任何人更動過,所有由官方提供的dsc都已用維護者的數位簽名簽著過。
  • 補丁檔 (*.diff.gz) (非必有) - 維護者對改動 (例如: mod-cband_0.9.7.5-1.diff.gz) 。包括加入control、changelog等檔案。如果開發者一早已debian化整個源程式碼,可能不會有diff.gz檔的出現。

使用 apt-get source

取得目標dpkg套件源碼的三個檔案,最簡單自然是用apt-get source命令下載。首先你需要確定 /etc/apt/sources.list 有沒有「deb-src」一行:

deb http://ftp.hk.debian.org/debian/ sarge main contrib non-free
deb-src http://ftp.hk.debian.org/debian/ sid main contrib non-free

如果你是想由開發版本中backport一個套件回來,自然要使用開發版本的軟體庫,以Debian為例,自然是使用 sid。設定好後,在系統管理員身份下用「apt-get update」更新軟體庫資料。然後就可以用「apt-get source 套件名」取得目標dpkg套件源碼。這個指令會幫你幫別目標套件真正源碼名稱 (如套件 libapache2-mod-cband 的源碼包是 mod-cband ) ,下載套件源碼的三個檔案,並自動拆開源碼。為方便管理,建議建立目錄 ~/projects/dpkg並在裡面才進行apt-get source:

mkdir -p ~/projects/dpkg
cd ~/projects/dpkg
apt-get source libapache2-mod-cband

完成後,你會在當前目錄找到到套件源碼的三個檔案和以套件源碼名稱和版本編號組成的目錄 (例如mod-cband-0.9.7.5) ,目錄裡面就是套件的源碼。

$ ls
mod-cband-0.9.7.5
mod-cband_0.9.7.5-1.diff.gz
mod-cband_0.9.7.5-1.dsc
mod-cband_0.9.7.5.orig.tar.gz

自行下載

當然你亦可以自動下載orig.tar.gz、dsc和diff.gz三個檔案。下載後,可以用「dpkg-source -x dsc檔」把原始碼拆開:

$ dpkg-source -x mod-cband_0.9.7.5-1.dsc 
dpkg-source: extracting mod-cband in mod-cband-0.9.7.5

執行後,你會在當前目錄找到到套件源碼的三個檔案和以套件源碼名稱和版本編號組成的目錄 (例如mod-cband-0.9.7.5) ,目錄裡面就是套件的源碼。

整理編譯設定

設定版本編號

習慣上你首先要改動版本編號,記錄這次重編的目的。當然你可以略過這個步驟,但有機會做成往後升級的混亂,所以也建議花點時間做做這個簡單的工作。

版本編號和更動說明是記錄在套件源碼下 debian/changelog 中。你可以用文字編輯器直接修改這個檔案,但我們一般會先用命令「debchange -i 更動說明」加入版本更動的框架,例如:

debchange -i Backport to sarge

執行後用文字編輯器編輯debian/changelog,你會見到類似以下內容:

mod-cband (0.9.7.5-2) unstable; urgency=low

  * Backport to sarge

 – Fred Random <fred@example.org>  Tue,  3 Apr 2007 17:56:19 +0800

mod-cband (0.9.7.5-1) unstable; urgency=low

粗體為debchange新加的內容。這表示這個例子中原本你下載的套件版本編號是0.9.7.5-1,debchange會順勢把建立編號(build number)加一,變成 0.9.7.5-2 。為讓人一看就知重編後的套是backport,亦方便以後有更新時可以蓋過個版本,我們會把建立號減一,加上「.1sarge1」,令版本編號變成 0.9.7.5-0.1sarge1 。sarge後的 1 表示這個版本被重編的次數。如果在重編後發覺有問題,需要再新編,請將這個數目加一。改動後的debian/changelog 會變成如下:

mod-cband (0.9.7.5-0.1sarge1) unstable; urgency=low

  * Backport to sarge

 — Fred Random <fred@example.org>  Tue,  3 Apr 2007 17:56:19 +0800

mod-cband (0.9.7.5-1) unstable; urgency=low

安裝所需開發套件

接著你需要安裝編譯時所需開發套件,這些套件的名單在 debian/control 的的 Build-Depends 一行中:

$ egrep ‘^Build-Depends:’ debian/control
Build-Depends: debhelper (>= 4.0.0), autotools-dev, apache2-threaded-dev | apache2-prefork-dev, po-debconf

這顯示你需要安裝debhelper、autotools-dev、apache2-threaded-dev和po-debconf等四個套件才可以重編mod-cband,而debhelper必定要4.0.0或以上,apache2-threaded-dev可以用apache2-prefork-dev取替。

最簡單的方法是在系統管理員身份下打「apt-get build-deb 套件」,這命令自然會幫你下載並安裝有關套件所需開發套件。不過很多情況下不會那麼順利,在backport過程中,會遇到在正式發行本中未有所需開發套件,套件名稱改變了或版本不符合等問題,而apt-get build-deb遇到些情況會停下來。這時候你需要自行找出在正式發行本中對應的套件 (如 apache2.2-common 對應 apache2-common 或 apache-common) ,自行手動用 apt-get 下載並安裝,和更動debian/control 的需求。最差的情況下,你有機會需要重編幾個開發套件。

整理設定

接著你需要套件的相依性,即檔案 debian/control 中的 Depends 一行中:

$ egrep ‘^Depends:’ debian/control
Depends: ${misc: Depends}, ${shlibs: Depends}, apache2.2-common

這顯示你需要安裝apache2.2-common套件才可以安裝mod-cband。

你需要檢查一下你現時的發行版本是否有Depends列出的套件和版本是否符合。例如:

$ apt-cache show apache2.2-common
W: Unable to locate package apache2.2-common
E: No packages found

這表示你現時的發行版本並沒有apache2.2-common這個套件。這時候你需要自行找出在正式發行本中對應的套件 (如 apache2.2-common 對應 apache2-common 或 apache-common) ,例如:

$ apt-cache search apache common
apache - versatile, high-performance HTTP server
apache-common - support files for all Apache webservers
apache-perl - versatile, high-performance HTTP server with Perl support
apache-ssl - versatile, high-performance HTTP server with SSL support
apache2-common - next generation, scalable, extendable web server
axyl-lucene - The Axyl Luceneserver
cl-modlisp - Common Lisp interface to the Apache mod-lisp module

apache2.2-common可能對應apache2-common 或 apache-common。你需要更動debian/control 的需求,把Depend一行改成:

Depends: ${misc: Depends}, ${shlibs: Depends}, apache2-common

但最差的情況下,你有機會需要重編幾個相依的套件。

重建套件

現在你可以用debuild重編套件。因為包封套件時需要製做一個系統管理員的環境,我們需要fakeroot的協助。請打:

<

pre>debuild -rfakeroot

現在你的目錄一般會多了最少五個檔案:

$ ls
libapache2-mod-cband_0.9.7.5-0.1sarge1_i386.deb
mod-cband-0.9.7.5
mod-cband_0.9.7.5-0.1sarge1.diff.gz
mod-cband_0.9.7.5-0.1sarge1.dsc
mod-cband_0.9.7.5-0.1sarge1_i386.build
mod-cband_0.9.7.5-0.1sarge1_i386.changes
mod-cband_0.9.7.5-1.diff.gz
mod-cband_0.9.7.5-1.dsc
mod-cband_0.9.7.5.orig.tar.gz

libapache2-mod-cband_0.9.7.5-0.1sarge1_i386.deb 就是重編出來的套件。

安裝新套件

現在你可以安裝新套件了:

# dpkg -i *.deb

相關頁面


Share It: [del.icio.us] [Technorati] [Google Bookmark] [Yahoo MyWeb] [Furl]