Skip to content
Snippets Groups Projects
get_modules.sh 1.29 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Hrbáč's avatar
    David Hrbáč committed
    #!/bin/bash
    
    David Hrbáč's avatar
    David Hrbáč committed
    # vim: ai ts=2 sw=2 et sts=2 ft=sh
    
    Easy Build's avatar
    Easy Build committed
    
    
    Easy Build's avatar
    Easy Build committed
    PWD="/home/easybuild/git/it4i-modules"
    
    easybuild's avatar
    easybuild committed
    cd $PWD
    
    STATE=$(git fetch 2>&1 | grep master)
    if [ ! -z "$STATE" ]; then
    
    David Hrbáč's avatar
    David Hrbáč committed
      git pull
      ./get_modules.sh
      exit 0
    
    easybuild's avatar
    easybuild committed
    fi
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    if hostname -f | grep -q "bullx"; then
    
      ml --show-hidden -t --redirect avail 2>&1| awk '{print $1 ",1"}' | grep -v -e '/,\|:' | sort -u > anselm.csv
    
    David Hrbáč's avatar
    David Hrbáč committed
      ./modules.py > anselm.md
    
    Easy Build's avatar
    Easy Build committed
    else
    
      ml --show-hidden -t avail > /dev/null 2>&1 | awk '{print $1 ",2"}' | grep -v -e '/,\|:' | sort -u > salomon.csv
    
    David Hrbáč's avatar
    David Hrbáč committed
      ./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:$dir"
    
    David Hrbáč's avatar
    David Hrbáč committed
            fi
          fi
        done
    
        export MODULEPATH
    
    
        ml --show-hidden -t --redirect avail > /dev/null 2>&1| awk '{print $1 ",4"}' | grep -v -e '/,\|:' | sort -u > "$FILENAME".csv
    
    David Hrbáč's avatar
    David Hrbáč committed
        ./modules.py > "$FILENAME".md
    
      done
    
    Easy Build's avatar
    Easy Build committed
    fi
    
    David Hrbáč's avatar
    David Hrbáč committed
    DATE=$(date -R)
    
    git diff --exit-code || git commit -am "$DATE"
    git push origin master