summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_setup_archlinux_schroot.sh
diff options
context:
space:
mode:
authorkpcyrd <git@rxv.cc>2017-11-02 16:15:47 +0100
committerMattia Rizzolo <mattia@debian.org>2017-11-02 16:46:48 +0100
commit5945edc9e3bc0e258d8d0e573262bf227f566334 (patch)
treec6fa5553efdc759533a1c0cca781397d5e24c153 /bin/reproducible_setup_archlinux_schroot.sh
parent2bc8dddbba45c1985def9fa84a881ce70748b050 (diff)
downloadjenkins.debian.net-5945edc9e3bc0e258d8d0e573262bf227f566334.tar.xz
reproducible-archlinux: avoid possible TOCTOU issue
Diffstat (limited to 'bin/reproducible_setup_archlinux_schroot.sh')
-rwxr-xr-xbin/reproducible_setup_archlinux_schroot.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/reproducible_setup_archlinux_schroot.sh b/bin/reproducible_setup_archlinux_schroot.sh
index c2485ce6..5b74db12 100755
--- a/bin/reproducible_setup_archlinux_schroot.sh
+++ b/bin/reproducible_setup_archlinux_schroot.sh
@@ -39,8 +39,10 @@ bootstrap() {
rm -rf --one-file-system "$SCHROOT_BASE/root.x86_64/"
tar xzf archlinux-bootstrap-$BOOTSTRAP_DATE-x86_64.tar.gz -C $SCHROOT_BASE
- rm -rf --one-file-system "$SCHROOT_BASE/$TARGET"
+ mv "$SCHROOT_BASE/$TARGET" "$SCHROOT_BASE/$TARGET.old"
mv $SCHROOT_BASE/root.x86_64 $SCHROOT_BASE/$TARGET
+ rm -rf --one-file-system "$SCHROOT_BASE/$TARGET.old"
+
rm archlinux-bootstrap-$BOOTSTRAP_DATE-x86_64.tar.gz -rf
fi