summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsteban Carnevale <alfplayer@mailoo.org>2014-11-07 14:08:38 -0300
committerEsteban Carnevale <alfplayer@mailoo.org>2014-11-07 14:08:38 -0300
commit1cf57ad2eb6982384e001741df7b359212427fa6 (patch)
tree24b918002b4091668c287f93302be8a01344a17d
parent42bada6643e5c32beee3fda3b15df08b6c4530cd (diff)
parabola-mirror-repos: Add and fix comments
-rwxr-xr-xparabola-mirror-repos11
1 files changed, 9 insertions, 2 deletions
diff --git a/parabola-mirror-repos b/parabola-mirror-repos
index b109f1d..292fcbc 100755
--- a/parabola-mirror-repos
+++ b/parabola-mirror-repos
@@ -139,12 +139,13 @@ _prepare_locking() { eval "exec $lockfd>\"$lockfile\""; trap _no_more_locking E
_prepare_locking
-# Lock now. The lock is disabled automatically when the script exits (with any error code).
+# Lock now. The lock is disabled automatically when the script exits (with any error code)
if ! _lock xn ; then
echo "=> ERROR: Could not obtain lock. Exiting." >&2
exit 1
fi
+# Set non-configurable variables
date="$(date +%Y.%m.%d)"
current="${local_dir}-${date}"
current_component="${current##*/}"
@@ -195,6 +196,7 @@ if [[ $terminal == 1 ]] ; then
options+=" --progress"
fi
+# Create --link-dest option strings
for i in ${!link_dest[@]}; do
if [[ -d ${link_dest[$i]} ]] ; then
link_dest_option[i]="${link_dest[@]/#/--link-dest=}"
@@ -286,6 +288,7 @@ if [[ ${db_and_symlinks_update} == 1 ]] ; then
remote_repo_dirs="${remote_repo_dirs[@]/%//os}"
echo "=> Getting pool path list"
+ # Fetch symlinks from the server, extract symlink destinations and save them to the file $remote_pool_files
rsync -lrv --out-format="%L" --dry-run --exclude 'mips64el' --exclude '*mips64el.pkg.tar.*' ${remote_repo_dirs[@]} "/tmp/${script_filename}.unexistent_filename" \
| grep -- "->" \
| grep "pool.*[^/]$" \
@@ -302,17 +305,21 @@ if [[ ${db_and_symlinks_update} == 1 ]] ; then
# Avoid duplicates (comes from -any packages present in both i686/ and x86_64/)
sort -u -o "$remote_pool_files" "$remote_pool_files"
+ # Sort local pool files to pass the file to comm in the next step
sort -o "$local_pool_files" "$local_pool_files"
- # Keep lines that only appears in local_pool_files
+ # Keep lines that only appear in local_pool_files
comm -13 "$remote_pool_files" "$local_pool_files" > "$pool_files_to_delete"
+ # Calculate number of pool files to delete
NUMBER_TO_DELETE="$(wc -l $pool_files_to_delete | cut -d ' ' -f 1)"
+ # Fail if there are too many files to delete
if [[ "$NUMBER_TO_DELETE" -gt "$max_delete" ]] ; then
error " => ERROR: The number of pool package files to be deleted is ${NUMBER_TO_DELETE}, greater than the specified maximum which is ${max_delete}"
fi
+ # Delete pool files
if [[ $NUMBER_TO_DELETE -gt 0 ]] ; then
if [[ ${no_file_delete} == 1 ]] ; then
echo "=> Deleting ${NUMBER_TO_DELETE} old pool package files"