rpm2targz, less: moved rpm2targz from core to opt
This commit is contained in:
parent
909a945563
commit
7b09b69c4a
6
rpm2targz/.footprint
Normal file
6
rpm2targz/.footprint
Normal file
@ -0,0 +1,6 @@
|
||||
drwxr-xr-x root/root usr/
|
||||
drwxr-xr-x root/root usr/bin/
|
||||
-rwxr-xr-x root/root usr/bin/rpm2targz
|
||||
drwxr-xr-x root/root usr/lib/
|
||||
drwxr-xr-x root/root usr/lib/rpm2targz/
|
||||
-rwxr-xr-x root/root usr/lib/rpm2targz/rpmoffset
|
2
rpm2targz/.md5sum
Normal file
2
rpm2targz/.md5sum
Normal file
@ -0,0 +1,2 @@
|
||||
8341044e13ddead93295d57f5853ab00 rpm2targz
|
||||
4501e004279155038f16000c7b45acb4 rpmoffset.c
|
14
rpm2targz/Pkgfile
Normal file
14
rpm2targz/Pkgfile
Normal file
@ -0,0 +1,14 @@
|
||||
# Description: A tool to convert RPM files to TAR.GZ files
|
||||
# URL: http://www.crux.nu
|
||||
# Maintainer: Per Lidén <per@fukt.bth.se>
|
||||
|
||||
name=rpm2targz
|
||||
version=1.0.4
|
||||
release=1
|
||||
source=(rpm2targz rpmoffset.c)
|
||||
|
||||
build() {
|
||||
gcc $CFLAGS rpmoffset.c -o rpmoffset
|
||||
install -D -m 0755 rpm2targz $PKG/usr/bin/rpm2targz
|
||||
install -D -m 0755 rpmoffset $PKG/usr/lib/rpm2targz/rpmoffset
|
||||
}
|
6
rpm2targz/README
Normal file
6
rpm2targz/README
Normal file
@ -0,0 +1,6 @@
|
||||
POST-INSTALL
|
||||
|
||||
To enable less(1) to view RPM files, add the following line to
|
||||
the case statement in /usr/lib/less/filter:
|
||||
|
||||
*.rpm) dd ibs=`/usr/lib/rpm2targz/rpmoffset < "$1"` skip=1 if="$1" | gzip -dc | cpio -tv ;;
|
66
rpm2targz/rpm2targz
Executable file
66
rpm2targz/rpm2targz
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Modified by Per Liden <per@fukt.bth.se>, 2000, 2004.
|
||||
# Han Boetes <han@mijncomputer.nl>, 2004.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
if [ "$#" = "0" ]; then
|
||||
echo "usage: ${0##*/} <file.rpm> ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If $TMPDIR is not set, then use $TMP.
|
||||
# If $TMP is not set either, then mktemp(1) will use /tmp.
|
||||
${TMPDIR:=$TMP}
|
||||
|
||||
for file_rpm in $*; do
|
||||
if [ ! -f $file_rpm ]; then
|
||||
echo "$file_rpm: file not found"
|
||||
continue
|
||||
fi
|
||||
|
||||
dir_tar_gz=`mktemp -d` || exit 1
|
||||
file_cpio=`mktemp` || exit 1
|
||||
file_cpio_z=`mktemp` || exit 1
|
||||
file_tar_gz=${file_rpm%.rpm}.tar.gz
|
||||
|
||||
echo "$file_rpm => $file_tar_gz"
|
||||
|
||||
dd ibs=`/usr/lib/rpm2targz/rpmoffset < $file_rpm` skip=1 if=$file_rpm of=$file_cpio_z 2> /dev/null
|
||||
|
||||
if file $file_cpio_z | grep "bzip2 compressed data"; then
|
||||
bzip2 -dc < $file_cpio_z > $file_cpio
|
||||
else
|
||||
gzip -dc < $file_cpio_z > $file_cpio
|
||||
fi
|
||||
|
||||
( cd $dir_tar_gz
|
||||
cpio --quiet -i -m -d < $file_cpio
|
||||
find . -type d -perm 700 -exec chmod 755 {} \;
|
||||
tar cf - .
|
||||
) | gzip > $file_tar_gz
|
||||
|
||||
rm -rf $file_cpio $file_cpio_z $dir_tar_gz
|
||||
done
|
||||
|
||||
# End of file.
|
24
rpm2targz/rpmoffset.c
Normal file
24
rpm2targz/rpmoffset.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* Find how deeply inside an .RPM the real data is */
|
||||
/* kept, and report the offset in bytes */
|
||||
|
||||
/* Wouldn't it be a lot more sane if we could just untar these things? */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* These offsets keep getting bigger, so we're going to just bite a 2MB */
|
||||
/* chunk of RAM right away so that we have enough. Yeah, horrible */
|
||||
/* quick and dirty implementation, but hey -- it gets the job done. */
|
||||
|
||||
#define RPMBUFSIZ 2097152
|
||||
const char magic[][3]={"\x1F\x8B\x08"/*gzip*/,"BZh"/*bzip2*/};
|
||||
|
||||
main()
|
||||
{
|
||||
char *buff = malloc(RPMBUFSIZ),*eb,*p;
|
||||
for (p = buff, eb = buff + read(0,buff,RPMBUFSIZ); p < eb; p++)
|
||||
if ((*p == magic[0][0] && p[1] == magic[0][1] && p[2] == magic[0][2]) ||
|
||||
(*p == magic[1][0] && p[1] == magic[1][1] && p[2] == magic[1][2]))
|
||||
printf("%d\n",p - buff),
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user