|
|
次のページ
前のページ
目次へ
5. 最新版を組み込む
最新版を組み込むには、 rpm コマンド の動作するLinuxマシンから、ディストリビューションのあるディレクトリへの 書き込み権が必要です。 次の3つのステップを踏んでいきます -
5.1 パーミッションの修正
不幸にも、FTPプログラムは ファイルやディレクトリのパーミッションを
そのままにしてくれない場合があります。インストール作業中、いくつかの
プログラムは CD 上で直接実行されるため、CD を焼くまえに
プログラム、シェルスクリプト、そして 共有ライブラリにきちんと実行許可が
与えられていることを 確認する必要があります。この作業には 次のような
#!/bin/bash
RHVERSION=5.2
LIST=/tmp/er3hd3w25
CDDIR=/jaz/redhat-${RHVERSION}
# Find all directories, and make sure they have +x permission
find $CDDIR -type d -exec chmod -c 755 {} \;
# Find all files that are executables, shell or perl scripts
find $CDDIR -type f | file -f - | grep -v RPM \
| egrep -i 'executable|perl|bourne|shell' | cut -f1 -d: > $LIST
# Find shared libraries
find $CDDIR -name \*.so >> $LIST
# Make them executable
while read file
do
if [ ! -x $file ] ; then
chmod -c 755 $file
fi
done < $LIST
/bin/rm $LIST
exit 0
5.2 更新されたRPM と置き換える
次の
#! /bin/bash
# This script updates rpms in a RedHat distribution found in $RPMDIR.
# The old rpms will be placed in $OLDDIR.
# The new rpms should be located in $UPDDIR.
# The architechture is $ARCH.
RHVERSION=5.2
ARCH=i386
CDDIR=/jaz/redhat-${RHVERSION}
RPMDIR=${CDDIR}/${ARCH}/RedHat/RPMS
UPDDIR=${CDDIR}/updates/${ARCH}
OLDDIR=${CDDIR}/old
if [ ! -d $OLDDIR ] ; then
echo making directory $OLDDIR
mkdir $OLDDIR
fi
allow_null_glob_expansion=1
for rpm in ${UPDDIR}/*.rpm ; do
NAME=`rpm --queryformat "%{NAME}" -qp $rpm`
unset OLDNAME
for oldrpm in ${RPMDIR}/${NAME}*.rpm ; do
if [ `rpm --queryformat "%{NAME}" -qp $oldrpm` = "$NAME" ]; then
OLDNAME=$oldrpm;
break
fi
done
if [ -z "$OLDNAME" ]; then
echo $NAME is new
cp -pv $rpm $RPMDIR
else
if [ `basename $rpm` != `basename $OLDNAME` ]; then
mv $OLDNAME $OLDDIR
cp -pv $rpm $RPMDIR
fi
fi
done
# Copy new boot image files to the right place...
for newfile in ${UPDDIR}/images/* ; do
file=${CDDIR}$/${ARCH}/images/$(basename ${newfile})
if [ $newfile -nt $file ] ; then
cp -pv $newfile $file
fi
done
exit 0
5.3 新しいhdlist ファイルの生成
CD からインストールする際、CD 上の インストールプログラムは
CD 上にある
#!/bin/bash
RHVERSION=5.2
ARCH=i386
echo generating hdlist...
CDDIR=/jaz/redhat-${RHVERSION}
GENHDDIR=${CDDIR}/${ARCH}/misc/src/install
chmod u+x ${GENHDDIR}/genhdlist
chmod 644 ${CDDIR}/${ARCH}/RedHat/base/hdlist
${GENHDDIR}/genhdlist ${CDDIR}/${ARCH} || echo "*** GENHDLIST FAILED ***"
exit 0
注意:メインディレクトリ(
重要:RedHat5.2に関して
RedHat バージョン 5.2 以前のものに付属する
*** genhdlist.c.orig Fri Nov 27 12:08:13 1998
--- genhdlist.c Fri Nov 27 12:08:20 1998
***************
*** 12,23 ****
--- 12,26 ----
#define FILENAME_TAG 1000000
+ /* Not used apparently...
+
int tags[] = { RPMTAG_NAME, RPMTAG_VERSION, RPMTAG_RELEASE, RPMTAG_SERIAL,
RPMTAG_FILENAMES, RPMTAG_FILESIZES, RPMTAG_GROUP,
RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION,
RPMTAG_DESCRIPTION, RPMTAG_SUMMARY, RPMTAG_PROVIDES,
RPMTAG_SIZE, RPMTAG_OBSOLETES };
int numTags = sizeof(tags) / sizeof(int);
+ */
int main(int argc, char ** argv) {
char buf[300];
***************
*** 26,34 ****
--- 29,39 ----
struct dirent * ent;
int fd, rc, isSource;
Header h;
+ /* not used
int count, type;
int i;
void * ptr;
+ */
if (argc != 2) {
fprintf(stderr, "usage: genhdlist <dir>\n");
***************
*** 74,79 ****
--- 79,85 ----
rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
+ if (!rc) {
headerRemoveEntry(h, RPMTAG_POSTIN);
headerRemoveEntry(h, RPMTAG_POSTUN);
headerRemoveEntry(h, RPMTAG_PREIN);
***************
*** 110,115 ****
--- 116,122 ----
headerWrite(outfd, h, HEADER_MAGIC_YES);
headerFree(h);
close(fd);
+ }
}
errno = 0;
次のページ 前のページ 目次へ |
[ |