CentOS 6.2 64bit に checkinstall 1.6.2 を入れる

CentOS 6.2 64bit 環境に checkinstall 1.6.2 を入れるhowto


CentOS 6.2 64bit 環境に checkinstall 1.6.2 の tar.gz から入れようとすると、 make で次の通り失敗する。

$ cd checkinstall-1.6.2
$ make
for file in locale/checkinstall-*.po ; do \
                case ${file} in \
                        locale/checkinstall-template.po)  ;; \
                        *) \
                                out=`echo $file | sed -s 's/po/mo/'` ; \
                                msgfmt -o ${out} ${file} ; \
                                if [ $? != 0 ] ; then \
                                        exit 1 ; \
                                fi ; \
                        ;; \
                esac ; \
        done
make -C installwatch
make[1]: ディレクトリ `/home/foobar/checkinstall-1.6.2/installwatch' に入ります
gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"0.7.0beta7\" installwatch.c
installwatch.c:2942: error: conflicting types for ‘readlink’
/usr/include/unistd.h:828: note: previous declaration of ‘readlink’ was here
installwatch.c:3080: error: conflicting types for ‘scandir’
/usr/include/dirent.h:252: note: previous declaration of ‘scandir’ was here
installwatch.c:3692: error: conflicting types for ‘scandir64’
/usr/include/dirent.h:275: note: previous declaration of ‘scandir64’ was here
make[1]: *** [installwatch.o] エラー 1
make[1]: ディレクトリ `/home/foobar/checkinstall-1.6.2/installwatch' から出ます
make: *** [all] エラー 2

$


こちら(システムネタ|centos6.2にcheckinstallをいれる)によると、git リポジトリの最新版では修正済みとのことなので、git clone したものを make する。

$ git clone http://checkinstall.izto.org/checkinstall.git
$ cd checkinstall


64bit 環境に合わせるため、Makefile等にパッチする。変更点は以下3点。
小修正なので vi やら emacs で弄っちゃえばOK。

  • checkinstallrc を修正
  • checkinstallrc のインストール先を /usr/local 直下に修正
  • installwatch.so のインストール先の修正
$ git diff
diff --git a/Makefile b/Makefile
index 2e28adc..b6d217c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 PREFIX=/usr/local
 BINDIR=$(PREFIX)/sbin
 LCDIR=$(PREFIX)/lib/checkinstall/locale
-CONFDIR=$(PREFIX)/lib/checkinstall
+CONFDIR=$(PREFIX)
 
 all:
        for file in locale/checkinstall-*.po ; do \
diff --git a/checkinstallrc-dist b/checkinstallrc-dist
index d4feb4e..fe5f56e 100644
--- a/checkinstallrc-dist
+++ b/checkinstallrc-dist
@@ -117,7 +117,7 @@ RESET_UIDS=0
 NEW_SLACK=1
 
 # Comma delimited list of files/directories to be ignored
-EXCLUDE=""
+EXCLUDE="/selinux"
 
 # Accept default values for all questions?
 ACCEPT_DEFAULT=0
diff --git a/installwatch/Makefile b/installwatch/Makefile
index ae34fc1..fb41eb3 100644
--- a/installwatch/Makefile
+++ b/installwatch/Makefile
@@ -11,7 +11,7 @@ PREFIX=/usr/local
 VERSION=0.7.0beta7
 
 BINDIR=$(PREFIX)/bin
-LIBDIR=$(PREFIX)/lib
+LIBDIR=$(PREFIX)/lib64
 
 all: installwatch.so

このパッチをはしょるといざ checkinstall したときに、「installwatch.soがない」とか「/selinuxに書けない」と怒られる。

# ln -s /usr/local/lib/installwatch.so /usr/local/lib64/installwatch.so

シンボリックリンクを張ったり、checkinstallrc を変更したり chekinstall --exclude=/selinux とオプションを付けたら回避できるけど、手間なので先にやっておく。

make と一旦 make install

$ make
# make install

rpm 化しておくと、色々便利なので rpm 化して make install していたものを上書き。

# mkdir -p ~/rpmbuild/SOURCES
# checkinstall

(省略)

tempファイルを削除..OK

temp dirを削除..OK


**********************************************************************

 Done. The new package has been saved to

 /root/rpmbuild/RPMS/x86_64/checkinstall-20120405-1.x86_64.rpm
 You can install it in your system anytime using:

      rpm -i checkinstall-20120405-1.x86_64.rpm

**********************************************************************

できたRPMをインストール&確認。

# rpm -ivh /root/rpmbuild/RPMS/x86_64/checkinstall-20120405-1.x86_64.rpm
準備中...                ########################################### [100%]
   1:checkinstall           ########################################### [100%]

# rpm -qi checkinstall
Name        : checkinstall                 Relocations: (not relocatable)
Version     : 20120405                          Vendor: (none)
Release     : 1                             Build Date: 2012年04月05日 18時22分23秒
Install Date: 2012年04月05日 18時23分00秒      Build Host: foobar.jp
Group       : Applications/System           Source RPM: checkinstall-20120405-1.src.rpm
Size        : 96172                            License: GPL
Signature   : (none)
Packager    : checkinstall-1.6.3
Summary     : CheckInstall installations tracker, version 1.6.2
Description :
CheckInstall installations tracker, version 1.6.2

CheckInstall  keeps  track of all the files created  or
modified  by your installation  script  ("make install"
"make install_modules",  "setup",   etc),   builds    a
standard   binary   package and  installs  it  in  your
system giving you the ability to uninstall it with your
distribution's  standard package management  utilities.

#

これで終了。
パッケージ情報が気になる人は、rpm化するときに弄ってくださいな。