diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh index e6f1321..a720840 100755 --- a/scripts/ingest-tarball.sh +++ b/scripts/ingest-tarball.sh @@ -143,7 +143,7 @@ function cvmfs_ingest_tarball() { function check_os() { # Check if the operating system directory is correctly set for the contents of the tarball - os=$(echo "${tar_first_file}" | cut -d / -f 3) + os=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 1 ))) if [ -z "${os}" ] then error "no operating system directory found in the tarball!" @@ -156,7 +156,7 @@ function check_os() { function check_arch() { # Check if the architecture directory is correctly set for the contents of the tarball - arch=$(echo "${tar_first_file}" | cut -d / -f 4) + arch=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 2 ))) if [ -z "${arch}" ] then error "no architecture directory found in the tarball!" @@ -258,7 +258,13 @@ version=$(echo "${tar_file_basename}" | cut -d- -f2) contents_type_dir=$(echo "${tar_file_basename}" | cut -d- -f3) tar_first_file=$(tar tf "${tar_file}" | head -n 1) tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1) -tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2) +# Handle longer prefix with project name in dev.eessi.io +if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then + tar_contents_start_level=3 +else + 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"