2012年8月2日 星期四

解決用ccr安裝軟體時出現的md5問題

ccr是chakra上使用者自行添加與維護的套件庫,
他並不受到官方的維護,
所以如果在ccr上安裝軟體有任何的問題,
要問當初打包上傳的維護者,
那麼,使用者打包的套件要是有問題,不能裝,該怎麼自行解決呢?
我以teamviewer為例,
因為維護者似乎已經不打算繼續維護這個套件了,
所以如果你要安裝可能會出現問題,
$ ccr teamviewer
0 ccr/teamviewer 7.0.9348-1
    All-in-one solution for accessing PC's using the internet
1 ccr/teamviewer6 6.0.9258-1
    All-in-one solution for accessing PC's using the internet

Type numbers to install. Separate each number with a space.
Numbers: 0
warning: teamviewer-7.0.9348-1 is up to date -- reinstalling
warning: teamviewer is flagged out of date

Ccr Targets    (1): teamviewer

Proceed with installation? [Y/n]

uRL: http://chakra-linux.org/ccr/packages/te/teamviewer/teamviewer.tar.gz
Edit teamviewer PKGBUILD with $EDITOR? [Y/n] n
==> Making package: teamviewer 7.0.9348-1 (四  8月  2 07:33:49 CST 2012)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
  -> Downloading teamviewer_linux_x64.deb...
--2012-08-02 07:33:49--  http://www.teamviewer.com/download/teamviewer_linux_x64.deb
正在查找主機 www.teamviewer.com... 46.163.100.220
正在連接 www.teamviewer.com|46.163.100.220|:80... 連上了。
已送出 HTTP 要求,正在等候回應... 200 OK
長度: 18043970 (17M) [application/x-deb]
Saving to: `teamviewer_linux_x64.deb.part'

100%[===================================================================================================>] 18,043,970  1.41M/s   in 19s   

2012-08-02 07:34:09 (904 KB/s) - `teamviewer_linux_x64.deb.part' saved [18043970/18043970]                                                 
                                                                                                                                           
  -> Found teamviewer.desktop                                                                                                              
==> Validating source files with md5sums...                                                                                                
    teamviewer_linux_x64.deb ... FAILED                                                                                                    
    teamviewer.desktop ... Passed                                                                                                          
==> ERROR: One or more files did not pass the validity check!                                                                              
The build failed.

你會發現他的錯誤訊息是說檔案沒有辦法通過偵測,還有在md5sums的部份也是FAILED,
那我該怎麼將錯誤的md5更改為正確的md5呢?
你可以cd /tmp/ccrbuild-1000/teamviewer/teamviewer/
然後你下ls的指令你會看到teamviewer_linux_x64.deb的檔案(我的系統是64bit的)
你只要對他下md5sum的指令就可以知道他的md5sum是多少了
$ md5sum teamviewer_linux_x64.deb
00d08807be74cc88c12d280be3720d0b  teamviewer_linux_x64.deb

從上面就可以看到00d08807be74cc88c12d280be3720d0b就是這個檔案的md5sum,
接下來你只要修改PKGBUILD裏面的md5sum的部份就可以了
$ kate PKGBUILD
#Mantainer: dundee

pkgname=teamviewer
pkgver=7.0.9348
pkgrel=1
pkgdesc="All-in-one solution for accessing PC's using the internet"
arch=('i686' 'x86_64')
url="http://www.teamviewer.com"
license="nonfree"
makedepends=('binutils')

[ $CARCH == 'i686' ] && \
source=("$url/download/teamviewer_linux.deb" "teamviewer.desktop") && \
md5sums=('0af22c7d12f1559c9def98d2a572334f'
         'efe412cf53a4099b6ffd7e379d5a5861') && \
depends=('libsm' 'libxext' 'freetype2' 'libxtst')
[ $CARCH == 'x86_64' ] && \
source=("$url/download/teamviewer_linux_x64.deb" "teamviewer.desktop") && \
md5sums=('fea5988830dfadeffdf5e8aaa6548bbc'
     'efe412cf53a4099b6ffd7e379d5a5861') && \
depends=('lib32-libsm' 'lib32-libxext' 'lib32-glibc' 'lib32-freetype2' 'lib32-gcc-libs' 'lib32-alsa-lib' 'lib32-libx11' 'lib32-libxtst' 'lib32-libxdamage' 'lib32-libxfixes'
'lib32-libxcb' 'lib32-libxi' 'lib32-libxau' 'lib32-libxdmcp')

package() {
  cd $srcdir
  ar x teamviewer_linux*
  tar xvf data.tar.gz
  cp -R opt $pkgdir
  cp -R usr $pkgdir
  mkdir -p $pkgdir/usr/share/applications
  cp $startdir/teamviewer.desktop $pkgdir/usr/share/applications/
}
 

看到md5sums的部份,因為我的系統是64位元,
所以我看x86_64的部份就可以了,
然後你看到md5sums的部份會有兩組,
原因是因為他除了檢查 teamviewer_linux_x64.deb,
他還檢查了teamviewer.desktop,你可以看source=那一行,
但是因為teamviewer.desktop的部份並沒有更改到他的md5sum,
所以我們不用理他,
於是你可以把剛剛檢查到的md5碼貼上來PKGBUILD裏面,
變成這樣子
[ $CARCH == 'x86_64' ] && \
source=("$url/download/teamviewer_linux_x64.deb" "teamviewer.desktop") && \
md5sums=('00d08807be74cc88c12d280be3720d0b'
     'efe412cf53a4099b6ffd7e379d5a5861') && \

我只改了第1行的md5sums的編碼而已,存檔後關閉kate,
然後再用ccr teamviewer 安裝一次
就會成功了。

在ccr的安裝上,可能會因為軟體的升版,而會遇到md5sum的問題,
這算蠻簡單解決的問題,可以學起來。

沒有留言 :

張貼留言