Verified Commit 4fe427a2 authored by Evangelos Foutras's avatar Evangelos Foutras 🐱
Browse files

syncrepo: Drop --temp-dir option as unneeded

Using a temporary directory outside of /srv/ftp was meant to protect
against incomplete files from being synced by downstream mirrors. It
does not achieve this to much effect though; each file gets uploaded
to the temporary directory but then immediately moved under a .~tmp~
directory at its target location (.~tmp~ because of --delay-updates,
otherwise the file would be renamed to its final path).

The `--delay-updates` option by itself sufficiently protects against
temp files being transferred to downstream mirrors; when used by the
receiver, it automatically adds an exclude rule for ~.tmp~, behaving
exactly like we want it to. As such, the `--temp-dir` option doesn't
provide any further benefit and can be removed.
parent 8c92967b
Pipeline #9990 passed with stage
in 33 seconds
......@@ -38,11 +38,6 @@
# Directory where the repo is stored locally. Example: /srv/repo
target="/srv/ftp"
# Directory where files are downloaded to before being moved in place.
# This should be on the same filesystem as $target, but not a subdirectory of $target.
# Example: /srv/tmp
tmp="/srv/syncrepo-tmp"
# Lockfile path
lock="/var/lock/syncrepo.lck"
......@@ -66,14 +61,13 @@ lastupdate_url='https://rsync.archlinux.org/lastupdate'
#### END CONFIG
[ ! -d "${target}" ] && mkdir -p "${target}"
[ ! -d "${tmp}" ] && mkdir -p "${tmp}"
exec 9>"${lock}"
flock -n 9 || exit
rsync_cmd() {
local -a cmd=(rsync -rlptH --safe-links --delete-delay --delay-updates
"--timeout=600" "--contimeout=60" --no-motd "--temp-dir=${tmp}")
"--timeout=600" "--contimeout=60" --no-motd)
if stty &>/dev/null; then
cmd+=(-h -v --progress)
......
......@@ -29,11 +29,6 @@
# Directory where the repo is stored locally. Example: /srv/repo
target=""
# Directory where files are downloaded to before being moved in place.
# This should be on the same filesystem as $target, but not a subdirectory of $target.
# Example: /srv/tmp
tmp=""
# Lockfile path
lock="/var/lock/syncrepo.lck"
......@@ -57,7 +52,6 @@ lastupdate_url=''
#### END CONFIG
[ ! -d "${target}" ] && mkdir -p "${target}"
[ ! -d "${tmp}" ] && mkdir -p "${tmp}"
exec 9>"${lock}"
flock -n 9 || exit
......@@ -69,7 +63,7 @@ find "${target}" -name '.~tmp~' -exec rm -r {} +
rsync_cmd() {
local -a cmd=(rsync -rlptH --safe-links --delete-delay --delay-updates
"--timeout=600" "--contimeout=60" --no-motd "--temp-dir=${tmp}")
"--timeout=600" "--contimeout=60" --no-motd)
if stty &>/dev/null; then
cmd+=(-h -v --progress)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment