-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_default
executable file
·75 lines (64 loc) · 1.37 KB
/
find_default
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Find default version of compilers and toolchains
#
# Ruoshi Sun
# 2020-08-03
APPDIR="/sfs/applications"
SOFTWARE="software"
MODFILE="modulefiles"
PREFIX="standard"
CATEGORY=("core" "toolchains")
CORE=("gcc" "intel")
function print_usage {
echo "Usage: `basename $0` \"YYYYMM_list\""
}
function print_error {
RED='\e[1;31m'
NC='\e[m'
echo -e "${RED}Error: $1${NC}"
echo
print_usage
exit 1
}
function print_default {
CAT=$1
shift
for APP in $@; do
printf "%-10s" $APP
for YYYYMM in $YYYYMMs; do
MODFILE_PATH=$APPDIR/$YYYYMM/$MODFILE/$PREFIX/$CAT/$APP
if [ ! -e $MODFILE_PATH/default ]; then
DEFAULT="undefined"
else
DEFAULT=`ls -l $MODFILE_PATH/default | awk '{sub(".lua", "", $NF); print $NF}'`
fi
printf " %-20s" $DEFAULT
done
echo
done
}
# must have at least 3 arguments
NARGS=$#
if [ $NARGS -ne 1 ]; then
print_usage
exit 1
fi
if [ ! -e $APPDIR ]; then
print_error "$APPDIR not found. Please update $0."
fi
# store list of YYYYMMs
YYYYMMs=$1
shift
# print header
printf "%10s" ""
for i in "${YYYYMMs[@]}"; do
printf " %-20s" $i
done
echo
echo "core:"
print_default core ${CORE[@]}
echo
echo "toolchains:"
TOOLCHAINS=(`ls $APPDIR/${YYYYMMs%% *}/$MODFILE/$PREFIX/toolchains`)
print_default toolchains ${TOOLCHAINS[@]}
echo