diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh index 634f6f61..9a2580d2 100755 --- a/scripts/ingest-tarball.sh +++ b/scripts/ingest-tarball.sh @@ -286,7 +286,13 @@ fi tar_file_basename=$(basename "${tar_file}") 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) +# find the first file in the tarball that corresponds to $contents_type_dir, +# e.g. the first file that actually belongs to the software layer for software tarballs +# (and, hence, skip other files, like init scripts) +tar_first_file=$(tar tf "${tar_file}" | grep -m 1 "/${contents_type_dir}/") +if [ -z ${tar_first_file} ]; then + tar_first_file=$(tar tf "${tar_file}" | head -n 1) +fi tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1) # Handle longer prefix with project name in dev.eessi.io and # get the right basedir from the tarball name