Commit e7918c66 authored by Downloader's avatar Downloader

rsync_all.sh: fix contents_index.gz protection from deletion

parent b38069f8
......@@ -53,7 +53,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
# sync only if main dir is exist
test -d "$RPMS/${1/\/*/}" || return 0
mkdir -p $RPMS/$1/
rsync $DELETE $RSYNCOPTS --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links $2 \
rsync $DELETE $RSYNCOPTS --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links "${@:2}" \
$RSYNCPATH/$1/ $RPMS/$1/
RES=$?
echo "rsync exit: $RES"
......@@ -61,6 +61,18 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
return $RES
}
# Compress contents_index if changed
compress_contents_index()
{
local CI="$RPMS/$1/base/contents_index"
if [ -f "$CI" ] ; then
if [ ! -f "$CI.gz" ] || [ "$CI" -nt "$CI.gz" ] ; then
echo "Compressing $CI"
gzip -9 -k -f "$CI"
fi
fi
}
cd $RPMS/ || exit 1
......@@ -87,8 +99,10 @@ sync_branch()
# 1. sync files, this will skip delete if errors
func $BRANCH/$ARCH/RPMS.$COMPONENT || return
# 2. sync base
func $BRANCH/$ARCH/base || return
# 3. if all is ok, remove old files
DELETE="--delete-after --max-delete=1000" func $BRANCH/$ARCH/base --exclude=contents_index.gz || return
# 3. compress contents_index if changed
compress_contents_index $BRANCH/$ARCH
# 4. if all is ok, remove old files
#func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude base/' || return
}
......@@ -100,7 +114,8 @@ sync_branches()
if [ -n "$BASEONLY" ] ; then
for i in $LISTARCH; do
func $1/$i/base
DELETE="--delete-after --max-delete=1000" func $1/$i/base --exclude=contents_index.gz
compress_contents_index $1/$i
done
return
fi
......
Markdown is supported
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