Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let ingestion script move existing compat layers instead of removing them #176

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions scripts/ingest-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,19 @@ function ingest_compat_tarball() {
# Handle the ingestion of tarballs containing a compatibility layer
check_arch
check_os
compat_layer_path="/cvmfs/${repo}/${basedir}/${version}/compat/${os}/${arch}"
# Assume that we already had a compat layer in place if there is a startprefix script in the corresponding CVMFS directory
if [ -f "/cvmfs/${repo}/${basedir}/${version}/compat/${os}/${arch}/startprefix" ];
if [ -f "${compat_layer_path}/startprefix" ];
then
echo_yellow "Compatibility layer for version ${version}, OS ${os}, and architecture ${arch} already exists!"
echo_yellow "Removing the existing layer, and adding the new one from the tarball..."
${cvmfs_server} transaction "${repo}"
rm -rf "/cvmfs/${repo}/${basedir}/${version}/compat/${os}/${arch}/"
last_suffix=$((ls -1d ${compat_layer_path}-* | tail -n 1 | xargs basename | cut -d- -f2) 2> /dev/null)
new_suffix=$(printf '%03d\n' $((${last_suffix:-0} + 1)))
old_layer_suffixed_path="${compat_layer_path}-${new_suffix}"
echo_yellow "Moving the existing compat layer from ${compat_layer_path} to ${old_layer_suffixed_path}..."
mv ${compat_layer_path} ${old_layer_suffixed_path}
tar -C "/cvmfs/${repo}/${basedir}/" -xzf "${tar_file}"
${cvmfs_server} publish -m "update compat layer for ${version}, ${os}, ${arch}" "${repo}"
${cvmfs_server} publish -m "updated compat layer for ${version}, ${os}, ${arch}" "${repo}"
ec=$?
if [ $ec -eq 0 ]
then
Expand Down
Loading