Don't write the mirrorlist if it can't be downloaded
Before if the ‘curl’ command failed, it wouldn't send any output to sed, which would succeed, and that would go into the destination file. Now we check the status explicitly before moving on and print a message when ‘curl’ fails.
This commit is contained in:
parent
bf6ee3888b
commit
565813b43e
1 changed files with 8 additions and 2 deletions
|
@ -65,8 +65,14 @@ sudo." | fold >&2
|
|||
fi
|
||||
|
||||
# Download, ready, output
|
||||
curl -s -L "$(make-url)" | sed 's/^#\([^#].*\)/\1/' > "$dest"
|
||||
mirrorlist=$(curl -s -L "$(make-url)")
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "$mirrorlist" | sed 's/^#\([^#].*\)/\1/' > "$dest"
|
||||
echo "Saved in ${dest}"
|
||||
else
|
||||
echo "Couldn't load mirrorlist, not updating."
|
||||
fi
|
||||
|
||||
if [[ -f "${dest}.pacnew" ]]; then
|
||||
rm "${dest}.pacnew"
|
||||
|
|
Loading…
Reference in a new issue