]> asedeno.scripts.mit.edu Git - sipb-mirrors.git/commitdiff
fedora and fedora-epel: can't write to cwd, so use a tmpdir
authorAlejandro R. Sedeño <asedeno@mit.edu>
Thu, 3 Mar 2022 19:20:31 +0000 (14:20 -0500)
committerAlejandro R. Sedeño <asedeno@mit.edu>
Thu, 3 Mar 2022 19:20:31 +0000 (14:20 -0500)
fetch-scripts/fedora
fetch-scripts/fedora-epel

index b1692837344737224afc3a690517add36131a4b7..5c4cdee7ca3231493b741ab2bfd80ce7f260646a 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 RSYNCSOURCE=rsync://mirrors.rit.edu/
 MODULE="fedora-enchilada"
@@ -6,7 +6,6 @@ MODULEDIR="fedora"
 TIMEFILE="${MIRRORDIR}/.locks/fedora-timefile"
 
 QFM="./tools/fedora/quick-fedora-mirror"
-CONF="qfm.conf"
 
 if ! [ -x "${QFM}" ]; then
     # It is expected that this script is sourced by fetch-hudson
@@ -16,6 +15,13 @@ if ! [ -x "${QFM}" ]; then
     exit 1
 fi
 
+exittrap() { :; }
+trap 'exittrap' EXIT
+
+TMPDIR=$(mktemp -d /tmp/fedora-XXXXXX) || die "Unable to mktemp"
+exittrap() { rm -rf "${TMPDIR}"; }
+
+CONF="${TMPDIR}/qmf.conf"
 cat >"${CONF}" <<EOF
 # This will be sourced by qfm, which uses zsh.
 # Where our mirrors live
@@ -33,3 +39,6 @@ VERBOSE=4
 EOF
 
 "${QFM}" --config "${CONF}" --dry-run
+
+rm -rf "${TMPDIR}"
+exittrap() { :; }
index bf3b0d28ffd2a075e8478b37dc14cfd1184ce372..71f380f2b3b41f1c8965b8ebc2e854b246f26d9d 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 RSYNCSOURCE=rsync://mirrors.rit.edu/
 MODULE="fedora-epel"
@@ -6,7 +6,6 @@ MODULEDIR="epel"
 TIMEFILE="${MIRRORDIR}/.locks/fedora-epel-timefile"
 
 QFM="./tools/fedora/quick-fedora-mirror"
-CONF="qfm.conf"
 
 if ! [ -x "${QFM}" ]; then
     # It is expected that this script is sourced by fetch-hudson
@@ -16,6 +15,13 @@ if ! [ -x "${QFM}" ]; then
     exit 1
 fi
 
+exittrap() { :; }
+trap 'exittrap' EXIT
+
+TMPDIR=$(mktemp -d /tmp/fedora-epel-XXXXXX) || die "Unable to mktemp"
+exittrap() { rm -rf "${TMPDIR}"; }
+
+CONF="${TMPDIR}/qmf.conf"
 cat >"${CONF}" <<EOF
 # This will be sourced by qfm, which uses zsh.
 # Where our mirrors live
@@ -33,3 +39,6 @@ VERBOSE=4
 EOF
 
 "${QFM}" --config "${CONF}" --dry-run
+
+rm -rf "${TMPDIR}"
+exittrap() { :; }