summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-04-28 02:02:47 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-04-28 02:19:08 -0400
commit9da24149f1e9197ff1961e5ae1966a675bf82d39 (patch)
treecb798c25c197190dded3a7e79d64361635e34045
parent518ad32daff9b31d4b6c25abd0f343204248391f (diff)
blacklist-update: Make it safe to run in parallel, touch up
-rw-r--r--po/es/librelib.po6
-rwxr-xr-xsrc/lib/blacklist.sh14
2 files changed, 12 insertions, 8 deletions
diff --git a/po/es/librelib.po b/po/es/librelib.po
index 9798c25..174ffa1 100644
--- a/po/es/librelib.po
+++ b/po/es/librelib.po
@@ -64,8 +64,10 @@ msgstr "Actualiza (o crea) la copia de la lista negra en caché."
msgid "Downloading blacklist of proprietary software packages"
msgstr "Descargando la lista negra de paquetes de software privativo"
-#: src/lib/blacklist.sh:69
-msgid "Using local copy of blacklist"
+# FIXME: this string needs updated
+#: src/lib/blacklist.sh:72
+#| msgid "Using local copy of blacklist"
+msgid "Using old local cache of blacklist"
msgstr "Usando copia local de la lista negra"
#: src/lib/blacklist.sh:71
diff --git a/src/lib/blacklist.sh b/src/lib/blacklist.sh
index 321f7a1..76b00ad 100755
--- a/src/lib/blacklist.sh
+++ b/src/lib/blacklist.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# This may be included with or without `set -euE`
-# Copyright (C) 2013-2014, 2016-2017 Luke Shumaker <lukeshu@parabola.nu>
+# Copyright (C) 2013-2014, 2016-2018 Luke Shumaker <lukeshu@parabola.nu>
# Copyright (C) 2017 Isaac David <isacdaavid@isacdaavid.info>
#
# License: GNU GPLv2+
@@ -59,19 +59,21 @@ blacklist-update() (
_l stat_busy "Downloading blacklist of proprietary software packages"
mkdir -p "${local_blacklist%/*}"
- if wget -N -q -O "${local_blacklist}.part" "$remote_blacklist" 2>/dev/null; then
+
+ local tmpfile
+ tmpfile="$(mktemp "${local_blacklist}.part.XXXXXXXXXX")"
+ if wget -N -q -O "$tmpfile" "$remote_blacklist" 2>/dev/null; then
+ mv -f -- "$tmpfile" "$local_blacklist"
stat_done
- mv -f "${local_blacklist}.part" "$local_blacklist"
else
+ rm -f -- "$tmpfile"
stat_done
- rm "${local_blacklist}.part"
if [[ -e "$local_blacklist" ]]; then
- _l warning "Using local copy of blacklist"
+ _l warning "Using old local cache of blacklist"
else
_l error "Download failed, exiting"
return 1 # $EXIT_FAILURE
fi
-
fi
)