Skip to content

Commit

Permalink
exit messages and file name
Browse files Browse the repository at this point in the history
  • Loading branch information
jadams committed Dec 20, 2023
1 parent 1e3e45e commit 96d6936
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions mirrorly
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,46 @@ cleanup()
rm "${TMP_DIR}"/*-Packages 2>/dev/null || true
rm "${TMP_DIR}"/*-Release 2>/dev/null || true
rm "${TMP_DIR}"/*-Sizes 2>/dev/null || true
rm "${TMP_DIR}"/*-MD5sums 2>/dev/null || true
}

trap_handler()
{
RC="$?"
trap - ERR TERM HUP INT QUIT EXIT
cleanup
case "${RC}" in
"0")
echo Mirror sync successful
;;
"1")
echo Requirements not met 1>&2
;;
"2")
echo Permissions error 1>&2
;;
"3")
echo Error in mirrorly.conf 1>&2
;;
"4")
echo Exit code not defined 1>&2
;;
"5")
echo Missing MD5SUMS 1>&2
;;
"6")
echo Error downloading pool files 1>&2
;;
"7")
echo Error downloading dist files 1>&2
;;
"254")
echo Ran out of retry attempts 1>&2
;;
*)
echo Unknown error 1>&2
;;
esac
exit "${RC}"
}

Expand Down Expand Up @@ -241,8 +274,8 @@ stage1b()
--retries "${NUM_RETRIES}" \
--joblog "${TMP_DIR}"/download-joblog \
--jobs "${DL_JOBS}" \
get_file_from_repo
awk '{print $1"\t"$3"/"$4}' "${TMP_DIR}/need-to-download" | sort -k2 find-Sizes - | uniq > "${TMP_DIR}/combined-Sizes"
get_file_from_repo || exit 6
awk '{print $1"\t"$3"/"$4}' "${TMP_DIR}/need-to-download" | sort -k2 file-Sizes - | uniq > "${TMP_DIR}/combined-Sizes"
fi
}

Expand All @@ -257,7 +290,9 @@ stage2a()
echo "Getting dist files..."
get_release_files

echo "Downloading or checking files..."
local NUM_DIST_FILES=0
NUM_DIST_FILES="$(wc -l "${TMP_DIR}/dists-MD5sums" | cut -d' ' -f1 | tr -d '\n')"
echo "Checking or downloading ${NUM_DIST_FILES} files..."
export MIRROR_DIR
export TMP_DIR
export -f get_file_from_repo
Expand All @@ -267,7 +302,7 @@ stage2a()
--retries "${NUM_RETRIES}" \
--joblog "${TMP_DIR}"/dist-joblog \
--jobs "${DL_JOBS}" \
get_file_from_repo
get_file_from_repo || exit 7
}

stage2b()
Expand Down

0 comments on commit 96d6936

Please sign in to comment.