diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-08-19 18:50:17 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-08-19 18:50:17 -0400 |
commit | 82c5a404af30116b7f898adcc9df4efb99268e84 (patch) | |
tree | 70711106f5e54a3025d5c6b5712cc00222ad6e5f /rpm2targz | |
parent | rpmoffset: cleanup and remove size limit on cpio offset (diff) | |
download | rpm2targz-82c5a404af30116b7f898adcc9df4efb99268e84.tar.gz rpm2targz-82c5a404af30116b7f898adcc9df4efb99268e84.tar.bz2 rpm2targz-82c5a404af30116b7f898adcc9df4efb99268e84.zip |
Add a -S/--strip-path option
Often times it's nice to create a "raw" tarball which does not include the
package name in its paths.
Compare old method:
$ rpm2targz pkg-ver.rpm
$ tar tf pkg-ver.tar.gz
./pkg-ver/<files>
With new method:
$ rpm2targz -S pkg-ver.rpm
$ tar tf pkg-ver.tar.gz
./<files>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'rpm2targz')
-rwxr-xr-x | rpm2targz | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -26,16 +26,18 @@ argv0=${0##*/} usage=false stdout=false verbose=false +strip=false files=false msg="" for opt; do case ${opt} in - -h|--help) usage=true;; - -O|--stdout) stdout=true;; - -v|--verbose) verbose=true;; - --) break;; - -*) usage=true msg="unknown option '${opt}'";; - *) files=true;; + -h|--help) usage=true;; + -O|--stdout) stdout=true;; + -v|--verbose) verbose=true;; + -S|--strip-path) strip=true;; + --) break;; + -*) usage=true msg="unknown option '${opt}'";; + *) files=true;; esac done @@ -48,6 +50,7 @@ if ! ${files} || ${usage} ; then Options: -h, --help This help screen (imagine that) -O, --stdout Write tarball to stdout + -S, --strip-path Strip package name from tarball -v, --verbose Verbose output EOF @@ -109,6 +112,7 @@ for file; do case ${file} in -v|--verbose) continue;; -O|--stdout) continue;; + -S|--strip-path) continue;; --) dashdash=true; continue;; esac fi @@ -117,7 +121,7 @@ for file; do outfile=${file##*/} outfile=${outfile%.rpm} - base=${outfile%.src} + ${strip} && base="" || base=${outfile%.src} DEST="${WORKDIR}/${base}" rm -rf "${DEST}" if ! mkdir "${DEST}" ; then |