Skip to content

Commit a676158

Browse files
authored
Merge pull request #21 from bedroge/grep_always_true
~add `|| true` to `grep` commands in `create_tarball.sh`~ developed alternative solution using additional arguments to `find`
2 parents 19aec72 + 1fa8476 commit a676158

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

create_tarball.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,31 @@ module_files_list=${tmpdir}/module_files.list.txt
4848

4949
if [ -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/.lmod ]; then
5050
# include Lmod cache and configuration file (lmodrc.lua),
51-
# skip whiteout files and backup copies of Lmod cache (spiderT.old.*)
52-
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/.lmod -type f | egrep -v '/\.wh\.|spiderT.old' >> ${files_list}
51+
# skip whiteout files (.wh.*) and backup copies of Lmod cache (spiderT.old.*)
52+
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/.lmod -type f \( \! -name 'spiderT.old.*' -a \! -name '.wh.*' \) >> ${files_list}
5353
fi
5454

5555
# include scripts that were copied by install_scripts.sh, which we want to ship in EESSI repository
5656
if [ -d ${eessi_version}/scripts ]; then
57-
find ${eessi_version}/scripts -type f | grep -v '/\.wh\.' >> ${files_list}
57+
find ${eessi_version}/scripts -type f \! -name '.wh.*' >> ${files_list}
5858
fi
5959

6060
# also include init, which is also copied by install_scripts.sh
6161
if [ -d ${eessi_version}/init ]; then
62-
find ${eessi_version}/init -type f | grep -v '/\.wh\.' >> ${files_list}
62+
find ${eessi_version}/init -type f \! -name '.wh.*' >> ${files_list}
6363
fi
6464

6565
# consider both CPU-only and accelerator subdirectories
6666
for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do
6767

6868
if [ -d ${eessi_version}/software/${os}/${subdir}/modules ]; then
6969
# module files
70-
find ${eessi_version}/software/${os}/${subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
70+
find ${eessi_version}/software/${os}/${subdir}/modules -type f \! -name '.wh.*' >> ${files_list}
7171
# module symlinks
72-
find ${eessi_version}/software/${os}/${subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
72+
find ${eessi_version}/software/${os}/${subdir}/modules -type l \! -name '.wh.*' >> ${files_list}
7373
# module files and symlinks
74-
find ${eessi_version}/software/${os}/${subdir}/modules/all -type f -o -type l \
75-
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
74+
find ${eessi_version}/software/${os}/${subdir}/modules/all -type f,l \! -name '.wh.*' \
75+
| grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
7676
>> ${module_files_list}
7777
fi
7878

@@ -85,8 +85,7 @@ for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do
8585
# installation directories), the procedure will likely not work.
8686
for package_version in $(cat ${module_files_list}); do
8787
echo "handling ${package_version}"
88-
ls -d ${eessi_version}/software/${os}/${subdir}/software/${package_version} \
89-
| grep -v '/\.wh\.' >> ${files_list} || true # Make sure we don't exit because of set -e if grep doesn't return a match
88+
find ${eessi_version}/software/${os}/${subdir}/software/${package_version} -maxdepth 0 -type d \! -name '.wh.*' >> ${files_list}
9089
done
9190
fi
9291
done

0 commit comments

Comments
 (0)