slackware-current/source/a/rpm2tgz/patches/0011-ignore-rpm2cpio-error-code.patch
Patrick J Volkerding 730d3ea742 Sat Jan 29 06:17:05 UTC 2022
a/rpm2tgz-1.2.2-x86_64-5.txz:  Rebuilt.
  rpm2targz: when extracting the cpio archive from inside the RPM, use
  --no-absolute-filenames to protect against a poorly made RPM scribbling all
  over system files/directories. Thanks to Sl4ck3ver.
  Support -i option to ignore non-zero exit value from rpm2cpio.
  This allows repackaging some malformed RPMs.
  Thanks to ricky_cardo for the sample malformed RPM.
2022-01-29 17:59:50 +01:00

44 lines
1.4 KiB
Diff

--- ./rpm2targz.orig 2022-01-28 23:51:56.398715512 -0600
+++ ./rpm2targz 2022-01-28 23:53:21.350717413 -0600
@@ -50,6 +50,7 @@
echo " as documention to /usr/doc/\$PRGNAM-\$VERSION/"
echo " -d attempt a wellformed slack-desc from the rpm meta data"
echo " -c reset all directory permissions to 755 and ownership to root:root."
+ echo " -i continue to repackage even if rpm2cpio reports an error"
echo
else
echo "Usage: $0 <file.rpm>"
@@ -99,7 +100,7 @@
usage
fi
-ARGS=$(getopt "hsSndrc" $* )
+ARGS=$(getopt "hisSndrc" $* )
set -- ${ARGS}
for i; do
case "$1" in
@@ -127,6 +128,10 @@
CHOWN="true"
shift
;;
+ -i)
+ IGNOREERROR="true"
+ shift
+ ;;
--)
shift
break
@@ -160,8 +165,11 @@
ofn=$TMPDIR/$(basename $i .rpm).cpio
if which rpm2cpio 1> /dev/null 2> /dev/null ; then
rpm2cpio $i > $ofn 2> /dev/null
- if [ ! $? = 0 ]; then
- echo "ERROR: rpm2cpio failed. (maybe $i is not an RPM?)"
+ ERRORCODE=$?
+ if [ ! $ERRORCODE = 0 -a ! "$IGNOREERROR" = "true" ]; then
+ echo "ERROR: rpm2cpio failed (returned error code $ERRORCODE). Maybe $i is not an RPM?"
+ echo "If you wish to try again, you may ignore the error code and force $0 to try to"
+ echo "create a package by adding this option: -i"
rm -rf $TMPDIR
continue
fi