fix: resolved issue with repodata

- repodata was being created in the wrong location
- update script to create in the path where the new snap exists
This commit is contained in:
Ben Vincent 2023-11-12 15:48:30 +11:00
parent 3227ea0eed
commit 48ea444e7c

View File

@ -44,21 +44,15 @@ perform_rsync() {
}
create_repo_metadata() {
local basepath="${1}"
local osname="${2}"
local release="${3}"
local repository="${4}"
local current_date="${5}"
local repo_path="${basepath}/snap/${osname}/${release}/${repository}-${current_date}"
local repo_path="${1}"
if [[ -d "$repo_path" ]]; then
echo "Running createrepo on ${repo_path}..."
createrepo --update "${repo_path}"
if [[ $? -eq 0 ]]; then
echo "Successfully created repository metadata for ${repository}"
echo "Successfully created repository metadata for ${repo_path}"
else
echo "Failed to create repository metadata for ${repository}" >&2
echo "Failed to create repository metadata for ${repo_path}" >&2
return 1
fi
else
@ -92,6 +86,6 @@ for conf in /etc/reposync/conf.d/*.conf; do
perform_rsync "$live_path" "$snap_path"
# After syncing each repo, fix the repository metadata
create_repo_metadata "${BASEPATH}" "${OSNAME}" "${RELEASE}" "${REPOSITORY}" "${DATE}"
create_repo_metadata "${snap_path}"
done