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" ...@@ -53,7 +53,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
# sync only if main dir is exist # sync only if main dir is exist
test -d "$RPMS/${1/\/*/}" || return 0 test -d "$RPMS/${1/\/*/}" || return 0
mkdir -p $RPMS/$1/ 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/ $RSYNCPATH/$1/ $RPMS/$1/
RES=$? RES=$?
echo "rsync exit: $RES" echo "rsync exit: $RES"
...@@ -61,6 +61,18 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1" ...@@ -61,6 +61,18 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
return $RES 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 cd $RPMS/ || exit 1
...@@ -87,8 +99,10 @@ sync_branch() ...@@ -87,8 +99,10 @@ sync_branch()
# 1. sync files, this will skip delete if errors # 1. sync files, this will skip delete if errors
func $BRANCH/$ARCH/RPMS.$COMPONENT || return func $BRANCH/$ARCH/RPMS.$COMPONENT || return
# 2. sync base # 2. sync base
func $BRANCH/$ARCH/base || return DELETE="--delete-after --max-delete=1000" func $BRANCH/$ARCH/base --exclude=contents_index.gz || return
# 3. if all is ok, remove old files # 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 #func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude base/' || return
} }
...@@ -100,7 +114,8 @@ sync_branches() ...@@ -100,7 +114,8 @@ sync_branches()
if [ -n "$BASEONLY" ] ; then if [ -n "$BASEONLY" ] ; then
for i in $LISTARCH; do 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 done
return return
fi 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