tidy stx/downloads directory

$MY_REPO/stx/downloads contains links to tarballs and other files
relevant to the build.  It is populated by populate_downloads.sh.
On subsequent runs, new links might be added, but old links are
not cleaned up.

Adopt the convention used by generate-centos-repo.sh of moving
the old content under a timestamp backup directory, leaving
an empty directory to re-populate.

Closes-bug: 1908297
Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: Ib6c8b782db6c369cb00e8fe8c64be099d7a5d238
This commit is contained in:
Scott Little 2020-12-15 14:17:34 -05:00
parent a2194c6ca7
commit 1fd6f3f636
2 changed files with 12 additions and 7 deletions

View File

@ -183,13 +183,13 @@ if [ ! -d "${dest_dir}" ]; then
fi
for t in "Binary" "Source" ; do
target_dir=${dest_dir}/$t
if [ ! -d "$target_dir" ]; then
mkdir -p "$target_dir"
else
mv -f "$target_dir" "$target_dir-backup-$timestamp"
mkdir -p "$target_dir"
target_dir=${dest_dir}/${t}
if [ -d "${target_dir}" ]; then
mv -f "${target_dir}" "${target_dir}-backup-${timestamp}"
fi
mkdir -p "${target_dir}"
done
#

View File

@ -91,7 +91,12 @@ if [ -f ${extra_downloads_lst} ]; then
fi
mkdir -p ${MY_REPO}/stx/downloads
if [ -d "${downloads_dir}" ]; then
timestamp="$(date +%F_%H%M)"
mv -f "${downloads_dir}" "${downloads_dir}-backup-${timestamp}"
fi
mkdir -p ${downloads_dir}
grep -v "^#" ${tarball_lst} | while read x; do
if [ -z "$x" ]; then