#!/bin/bash PWD="/home/easybuild/git/it4i-modules" cd $PWD STATE=$(git fetch 2>&1 | grep master) if [ ! -z "$STATE" ]; then git pull ./get_modules.sh exit 0 fi if hostname -f | grep -q "bullx"; then ml --show-hidden -t av > /dev/null 2>&1| awk '{print $1 ",1"}' | grep -v -e '/,\|:' | sort -u > anselm.csv ./modules.py > anselm.md else ml --show-hidden -t av > /dev/null 2>&1| awk '{print $1 ",2"}' | grep -v -e '/,\|:' | sort -u > salomon.csv ./modules.py > salomon.md for resource in "/appsuv/modules,uv2000" "/apps/phi/modules,phi" do MODULEBASE=${resource%,*} MODULEPATH="" FILENAME=${resource#*,} for dir in $MODULEBASE do # Exclude following directories if [[ ($(basename $dir) == "all") ]]; then continue fi # In case that it's directory if [ -d $dir ]; then if [ -z $MODULEPATH ]; then MODULEPATH=$dir else MODULEPATH="$MODULEPATH:$MODULEBASE/$dir" fi fi done export MODULEPATH ml --show-hidden -t av > /dev/null 2>&1| awk '{print $1 ",4"}' | grep -v -e '/,\|:' | sort -u > "$FILENAME".csv ./modules.py > "$FILENAME".md done fi DATE=$(date -R) git diff --exit-code || git commit -am "$DATE" git push origin master