@@ -8,7 +8,7 @@ YELLOW='\033[0;33m'
88NC=' \033[0m'
99
1010function printError {
11- echo -e " ${RED} $@ ${NC} "
11+ echo -e " ${RED} $* ${NC} "
1212}
1313
1414verbose=0
@@ -23,11 +23,11 @@ function checkModule {
2323 moduleStr=" $moduleName /$moduleVersion "
2424 printVerbose " Processing $moduleStr "
2525 ec_glob=( " $moduleFolder /easybuild/" * .eb )
26- if [[ ! -e " ${ec_glob[@ ]} " ]]; then
26+ if [[ ! -e " ${ec_glob[0 ]} " ]]; then
2727 printError " === Did not find installed EC for $moduleStr "
2828 return
2929 fi
30- ec_installed=" $ec_glob "
30+ ec_installed=" ${ ec_glob[0]} "
3131 ec_filename=$( basename " $ec_installed " )
3232 # Try with most likely location first for speed
3333 first_letter=${ec_filename: 0: 1}
@@ -67,15 +67,15 @@ if path=$(which eb 2>/dev/null); then
6767fi
6868
6969function usage {
70- echo " Usage: $( basename " $0 " ) [--verbose] [--diff] --loaded|--modules INSTALLPATH --easyconfigs EC-FOLDER"
70+ echo " Usage: $( basename " $0 " ) [--verbose] [--short] [-- diff] --loaded|--modules INSTALLPATH --easyconfigs EC-FOLDER"
7171 echo
7272 echo " Check installed modules against the source EasyConfig (EC) files to determine which have changed."
7373 echo " Can either check the currently loaded modules or all modules installed in a specific location"
7474 echo
7575 echo " --verbose Verbose status output while checking"
76- echo " --loaded Check only currently loaded modules"
7776 echo " --short Only show filename of changed ECs"
7877 echo " --diff Show diff of changed module files"
78+ echo " --loaded Check only currently loaded modules"
7979 echo " --modules INSTALLPATH Check all modules in the specified (software) installpath, i.e. the root of module-binaries"
8080 echo " --easyconfigs EC-FOLDER Path to the folder containg the current/updated EasyConfigs. ${ecDefaultFolder: +Defaults to $ecDefaultFolder } "
8181 exit 0
115115if [ -z " $easyconfigFolder " ]; then
116116 printError " Folder to easyconfigs not given!" && exit 1
117117fi
118+
118119if [ -z " $modulesFolder " ]; then
119120 if (( checkLoadedModules == 0 )) ; then
120121 printError " Need either --modules or --loaded to specify what to check!" && exit 1
@@ -123,13 +124,18 @@ elif (( checkLoadedModules == 1 )); then
123124 printError " Cannot specify --modules and --loaded!" && exit 1
124125fi
125126
127+ if (( showDiff == 1 && short == 1 )) ; then
128+ printError " Cannot specify --diff and --short" && exit 1
129+ fi
130+
126131if [ -d " $easyconfigFolder /easybuild/easyconfigs" ]; then
127132 easyconfigFolder=" $easyconfigFolder /easybuild/easyconfigs"
128133fi
129134
130135if (( checkLoadedModules == 1 )) ; then
131- for varname in $( compgen -A variable | grep ' ^EBROOT' ) ; do
132- checkModule " ${! varname} "
136+ IFS=$' \n ' read -r -d ' ' -a unique_module_paths <<< " $(for varname in $(compgen -A variable | grep '^EBROOT'); do echo " ${! varname} " ; done | sort -u )" || true
137+ for module in " ${unique_module_paths[@]} " ; do
138+ checkModule " $module "
133139 done
134140else
135141 for module in " $modulesFolder " /* /* /easybuild; do
0 commit comments