summaryrefslogtreecommitdiffstats
path: root/source/a/rpm2tgz/patches/0011-ignore-rpm2cpio-error-code.patch
blob: 61f5a04babff5d0cf50a20c96d18b6a2e550fb70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- ./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