]> git.ipfire.org Git - people/ms/nightly-builds.git/blobdiff - build.sh
build.sh: Delete successfully uploaded files
[people/ms/nightly-builds.git] / build.sh
index cf95550c2226ca759c6edcf10d26fd48130e4adb..fcb7699c5f07302458b3476f0852a97f74c19e90 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -5,7 +5,7 @@ LOCKFILE="/tmp/.nightly-builds.lock"
 
 UPLOAD_DIR="${BASEDIR}/upload"
 UPLOAD_TO="pakfire@fs01.haj.ipfire.org:/pub/nightly"
-RSYNC_ARGS=( "--delay-updates" )
+RSYNC_ARGS=( "-avH" "--progress" "--delay-updates" )
 
 extract_installer_from_iso() {
        local dir="${1}"
@@ -169,12 +169,7 @@ build() {
                ./make.sh --target="${target}" clean
 
                # Upload the result
-               # If that failed, we will keep the result and it will
-               # be retried with the next build. If that succeeded, the
-               # build will be removed from disk.
-               if sync; then
-                       rm -rf "${UPLOAD_DIR}"
-               fi
+               sync
        done
 
        popd
@@ -186,8 +181,9 @@ sync() {
        # Acquire a Kerberos ticket for authentication
        kinit -k -t /etc/krb5.keytab "host/${HOSTNAME}"
 
-       rsync -avH --progress "${RSYNC_ARGS[@]}" \
-               "${UPLOAD_DIR}/" "${UPLOAD_TO}"
+       if rsync "${RSYNC_ARGS[@]}" "${UPLOAD_DIR}/" "${UPLOAD_TO}"; then
+               rm -rf "${UPLOAD_DIR}"
+       fi
 }
 
 is_locked() {