From 85e520f1435cd3cc96a792c4394aae3482cc37fe Mon Sep 17 00:00:00 2001 From: Pedro Santos Neves <10762799+Neves-P@users.noreply.github.com> Date: Mon, 2 Dec 2024 09:40:27 +0100 Subject: [PATCH] Handle different length install paths in checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bob Dröge --- scripts/ingest-tarball.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh index 559954f..f470c54 100755 --- a/scripts/ingest-tarball.sh +++ b/scripts/ingest-tarball.sh @@ -258,10 +258,11 @@ tar_first_file=$(tar tf "${tar_file}" | head -n 1) tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1) # Handle longer prefix with project name in dev.eessi.io if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then - tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f3) + tar_contents_start_level=3 else - tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2) + tar_contents_start_level=2 fi +tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f${tar_contents_start_level}) # Check if we are running as the CVMFS repo owner, otherwise run cvmfs_server with sudo is_repo_owner || cvmfs_server="sudo cvmfs_server"