summaryrefslogtreecommitdiffstats
path: root/source/a/rpm2tgz/patches/0009-Add-c-option-just-as-makepkg-c-y.patch
blob: 6768401aa203271e01a0254d0fe95baef5e9cac8 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 7664b10014e4ca5b0f498d5c774653a44fdaf0e1 Mon Sep 17 00:00:00 2001
From: Igor Murzov <igor@gplsoft.org>
Date: Fri, 6 Aug 2010 01:05:41 +0400
Subject: [PATCH 09/09] Add -c option (just as makepkg -c y)

---
 rpm2targz |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/rpm2targz b/rpm2targz
index d9d6a8b..f3e51d6 100644
--- a/rpm2targz
+++ b/rpm2targz
@@ -49,6 +49,7 @@ usage() {
     echo "  -r    extract what the rpm's \"requires\" (dependencies)"
     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
   else
     echo "Usage:      $0 <file.rpm>"
@@ -98,7 +99,7 @@ if [ "$1" = "" ]; then
   usage
 fi
 
-ARGS=$(getopt "hsSndr" $* )
+ARGS=$(getopt "hsSndrc" $* )
 set -- ${ARGS}
 for i; do
   case "$1" in
@@ -122,6 +123,10 @@ for i; do
       META_NAME="true"
       shift
       ;;
+    -c)
+      CHOWN="true"
+      shift
+      ;;
     --)
       shift
       break
@@ -223,6 +228,12 @@ for i in $* ; do
     sed -ri "s/^/$PRGNAM: /;11q" $TMPDIR/install/slack-desc
   fi
 
+  # Supply -c y to makepkg if asked
+  COPT="n"
+  if [ "$CHOWN" = "true" ]; then
+    COPT="y"
+  fi
+
   # If this program was called as "rpm2targz", then repack as a plain
   # tar+gz archive.  If it was called as "rpm2tgz", use Slackware's
   # makepkg to produce the .tgz:
@@ -236,10 +247,10 @@ for i in $* ; do
       if [ "$META_NAME" = "true" ]; then
         get_meta_data $i
         cd $TMPDIR
-        /sbin/makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.$EXT
+        /sbin/makepkg -l y -c $COPT $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.$EXT
       else
         cd $TMPDIR
-        /sbin/makepkg -l y -c n $CWD/$(basename $i .rpm).$EXT
+        /sbin/makepkg -l y -c $COPT $CWD/$(basename $i .rpm).$EXT
       fi
     )
   else
-- 
1.7.1