* [PATCH] make-release: misc fixes
@ 2010-05-24 13:12 Michael S. Tsirkin
2010-05-31 19:04 ` Michael S. Tsirkin
2010-05-31 19:20 ` Marcelo Tosatti
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-05-24 13:12 UTC (permalink / raw)
To: avi, mtosatti, kvm, ehabkost
This fixes /tmp usage in make-release script for security.
Also, create output directory if it does not exist.
This also adds a 'tarball' optin to specify output file name.
Finally, remote output file before gzip to avoid prompt
'do you want to overwrite'.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
kvm/scripts/make-release | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/kvm/scripts/make-release b/kvm/scripts/make-release
index 11d9c27..fdc402b 100755
--- a/kvm/scripts/make-release
+++ b/kvm/scripts/make-release
@@ -1,7 +1,7 @@
#!/bin/bash -e
usage() {
- echo "usage: $0 [--upload] [--formal] commit [name]"
+ echo "usage: $0 [--upload] [--formal] commit [name] [tarball]"
exit 1
}
@@ -12,7 +12,7 @@ formal=
releasedir=~/sf-release
[[ -z "$TMP" ]] && TMP="/tmp"
-tmpdir="$TMP/qemu-kvm-make-release.$$"
+tmpdir=`mktemp -d --tmpdir="$TMP" qemu-kvm-make-release.XXXXXXXXXX`
while [[ "$1" = -* ]]; do
opt="$1"
shift
@@ -40,9 +40,15 @@ if [[ -z "$name" ]]; then
name="$commit"
fi
-tarball="$releasedir/$name.tar"
+tarball="$3"
+if [[ -z "$tarball" ]]; then
+ tarball="$releasedir/$name.tar.gz"
+fi
+#strip trailing .gz if any
+tarball=${tarball/%.gz/}
cd "$(dirname "$0")"/../..
+mkdir -p "$(dirname "$tarball")"
git archive --prefix="$name/" --format=tar "$commit" > "$tarball"
mkdir -p "$tmpdir"
@@ -59,6 +65,7 @@ if [[ -n "$formal" ]]; then
rm -rf "$tmpdir"
fi
+rm -f "$tarball.gz"
gzip -9 "$tarball"
tarball="$tarball.gz"
--
1.7.1.12.g42b7f
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] make-release: misc fixes
2010-05-24 13:12 [PATCH] make-release: misc fixes Michael S. Tsirkin
@ 2010-05-31 19:04 ` Michael S. Tsirkin
2010-05-31 19:20 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-05-31 19:04 UTC (permalink / raw)
To: avi, mtosatti, kvm, ehabkost
On Mon, May 24, 2010 at 04:12:14PM +0300, Michael S. Tsirkin wrote:
> This fixes /tmp usage in make-release script for security.
> Also, create output directory if it does not exist.
> This also adds a 'tarball' optin to specify output file name.
> Finally, remote output file before gzip to avoid prompt
> 'do you want to overwrite'.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Ping. Please review/apply.
> ---
> kvm/scripts/make-release | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/kvm/scripts/make-release b/kvm/scripts/make-release
> index 11d9c27..fdc402b 100755
> --- a/kvm/scripts/make-release
> +++ b/kvm/scripts/make-release
> @@ -1,7 +1,7 @@
> #!/bin/bash -e
>
> usage() {
> - echo "usage: $0 [--upload] [--formal] commit [name]"
> + echo "usage: $0 [--upload] [--formal] commit [name] [tarball]"
> exit 1
> }
>
> @@ -12,7 +12,7 @@ formal=
>
> releasedir=~/sf-release
> [[ -z "$TMP" ]] && TMP="/tmp"
> -tmpdir="$TMP/qemu-kvm-make-release.$$"
> +tmpdir=`mktemp -d --tmpdir="$TMP" qemu-kvm-make-release.XXXXXXXXXX`
> while [[ "$1" = -* ]]; do
> opt="$1"
> shift
> @@ -40,9 +40,15 @@ if [[ -z "$name" ]]; then
> name="$commit"
> fi
>
> -tarball="$releasedir/$name.tar"
> +tarball="$3"
> +if [[ -z "$tarball" ]]; then
> + tarball="$releasedir/$name.tar.gz"
> +fi
> +#strip trailing .gz if any
> +tarball=${tarball/%.gz/}
>
> cd "$(dirname "$0")"/../..
> +mkdir -p "$(dirname "$tarball")"
> git archive --prefix="$name/" --format=tar "$commit" > "$tarball"
>
> mkdir -p "$tmpdir"
> @@ -59,6 +65,7 @@ if [[ -n "$formal" ]]; then
> rm -rf "$tmpdir"
> fi
>
> +rm -f "$tarball.gz"
> gzip -9 "$tarball"
> tarball="$tarball.gz"
>
> --
> 1.7.1.12.g42b7f
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] make-release: misc fixes
2010-05-24 13:12 [PATCH] make-release: misc fixes Michael S. Tsirkin
2010-05-31 19:04 ` Michael S. Tsirkin
@ 2010-05-31 19:20 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2010-05-31 19:20 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: avi, kvm, ehabkost
On Mon, May 24, 2010 at 04:12:14PM +0300, Michael S. Tsirkin wrote:
> This fixes /tmp usage in make-release script for security.
> Also, create output directory if it does not exist.
> This also adds a 'tarball' optin to specify output file name.
> Finally, remote output file before gzip to avoid prompt
> 'do you want to overwrite'.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-31 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-24 13:12 [PATCH] make-release: misc fixes Michael S. Tsirkin
2010-05-31 19:04 ` Michael S. Tsirkin
2010-05-31 19:20 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).