plexus-languages/generate-tarball.sh
Fridrich Strba 4da8fabfd1 Accepting request 873143 from home:mgerstner:branches:Java:packages
for security reasons improve this script:

- generate-tarball.sh: use safe temporary directory, avoid accidental deletion
  of *.jar, *.class in CWD.

OBS-URL: https://build.opensuse.org/request/show/873143
OBS-URL: https://build.opensuse.org/package/show/Java:packages/plexus-languages?expand=0&rev=10
2021-02-17 17:11:59 +00:00

27 lines
635 B
Bash

#!/bin/bash
set -e
name=plexus-languages
version="$(sed -n 's/Version:\s*//p' *.spec)"
pkgdir=`cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd`
tmpdir=`mktemp -d`
echo $tmpdir
trap 'rm -r "$tmpdir"' EXIT
pushd "$tmpdir" >/dev/null
# RETRIEVE
wget "https://github.com/codehaus-plexus/plexus-languages/archive/plexus-languages-${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
treeroot="$tmpdir/tree"
mkdir "$tmpdir/tree"
pushd "$treeroot" >/dev/null
tar xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete
find -name '*.class' -delete
tar cJf "$pkgdir/${name}-${version}.tar.xz" *