rpm2tar

编译打包和其他
回复
头像
yonsan
帖子: 887
注册时间: 2005-07-01 18:56
来自: 广州市

rpm2tar

#1

帖子 yonsan » 2005-07-13 8:54

引自:
http://www.justpasha.org/unixcrap/rpm2tar

#!/bin/sh
#
# file: rpm2tar (after rpm2tgz)
# machine: wincrap
# modified: pasha oct 7 2000
# modification: 1. remove multiple arguments
# 2. more error handling, more verbose output
# and remove .rpm at the end
#

# Copyright 1997, 1998 Patrick Volkerding, Moorhead, Minnesota USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#


. /usr/local/lib/sh/functions


if [ "$1" = "" ]; then
echo "$ME: converts RPM format to tar."
echo "Usage: $ME <file.rpm>"
echo " (Outputs \"file.tar\")"
exit 1;
fi

BASE=`basename $1 .rpm`
BASE_TAR=$BASE.tar
BASE_CPIO=$BASE.cpio

if [ -f $BASE_TAR ]; then
echo "$ME: $BASE_TAR exists"
exit 1
fi

TMPDIR=/tmp/$ME$$

rm -rf $TMPDIR # clear the way, just in case of mischief
do_with_echo "mkdir $TMPDIR"

echo "$ME: doing dd and producing .cpio"
dd ibs=`rpmoffset < $1` skip=1 if=$1 | gzip -dc > $TMPDIR/$BASE_CPIO

(
cd $TMPDIR 1>&2
echo "$ME: doing cpio" 1>&2
cpio --extract --preserve-modification-time --make-directories < $BASE_CPIO 1>&2
rm -f $BASE_CPIO 1>&2
echo "$ME: doing find and chmoding everything" 1>&2
find . -type d -perm 700 -exec chmod 755 {} \; 1>&2
echo "$ME: doing tar" 1>&2
tar cf - .
) > $BASE_TAR

echo "$ME: removing .rpm"
if [ "$?" == "0" ]; then
rm $1 || echo "$ME: unable remove $1"
fi
rm -rf $TMPDIR || echo "$ME: unable remove $TMPDIR, leaving garbage"


# end of rpm2tar
I will be back!
yongyi
帖子: 3025
注册时间: 2005-05-07 23:57
联系:

#2

帖子 yongyi » 2005-07-13 8:59

难道在gentoo中说到的把rpm转换成源码才安装,就是用这代码?

==Gentoo是用rpm2tgrgz来转换的。
独自看一看大海
总想起身边走在路上的朋友
Lenovo E290-420[Celeron-M420/256M/60G/Intel GMA950]
头像
xiaosir
帖子: 46
注册时间: 2005-07-16 7:34
来自: 中国广东

#3

帖子 xiaosir » 2005-07-17 9:36

rpm本身应该就是二进制包,转换后可不会变成源码,只是不再用rpm进行管理了。
无聊的人越来越多,无聊的讨论越来越多
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#4

帖子 firehare » 2005-07-17 13:36

同意!tar包中可不一定都是源码呀!
我心无畏,源自于我心无知。
图片
回复