[tbb-commits] [rbm/master] Bug 32527: Don't leave partially downloaded files in case of error

sysrqb at torproject.org sysrqb at torproject.org
Sat Nov 30 12:35:02 UTC 2019


commit 94fce31e54d3fd491cdb3e3b9401919c0e841360
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Wed Nov 20 16:44:13 2019 +0100

    Bug 32527: Don't leave partially downloaded files in case of error
---
 lib/RBM/DefaultConfig.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm
index f7de8bb..974a0e1 100644
--- a/lib/RBM/DefaultConfig.pm
+++ b/lib/RBM/DefaultConfig.pm
@@ -555,7 +555,13 @@ OPT_END
         return $install{"$distro-$release"} if $install{"$distro-$release"};
         return $install{$distro};
     },
-    urlget => 'wget -O[% shell_quote(dest_dir _ "/" _ c("filename")) %] [% shell_quote(c("URL")) %]',
+    urlget => <<URLGET,
+#!/bin/sh
+set -e
+tmpfile="\$(mktemp -p [% shell_quote(c("tmp_dir")) %])"
+wget -O"\$tmpfile" [% shell_quote(c("URL")) %]
+mv -f "\$tmpfile" [% shell_quote(dest_dir _ "/" _ c("filename")) %]
+URLGET
     sig_ext => [ qw(gpg asc sig) ],
     enable => 1,
     gnu_utils => sub {



More information about the tbb-commits mailing list