forked from Azure/azurehpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·34 lines (30 loc) · 993 Bytes
/
install.sh
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
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -d "$DIR/bin" ]; then
mkdir $DIR/bin
fi
export PATH=${DIR}/bin:$PATH
export azhpc_dir=$DIR
export azhpc_pypath=$(az --version | grep "Python location" | cut -d' ' -f3 | sed "s/'//g")
if [ -e /etc/centos-release ]; then
export AZHPC_PYTHONPATH=/usr/lib64/az/lib/python3.6/site-packages
fi
for cmd in "" build connect destroy run_install get init preprocess run scp status; do
if [ "$cmd" = "" ]; then
cmd_name=azhpc
cmd_launch=azhpc.py
else
cmd_name=azhpc-$cmd
cmd_launch="azhpc.py $cmd"
fi
if [ ! -f "$DIR/bin/$cmd_name" ]; then
cat <<EOF >$DIR/bin/$cmd_name
#!/bin/bash
#autogenerated file from azhpc install.sh
export azhpc_dir="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )/.." && pwd )"
export PYTHONPATH=\$PYTHONPATH:\$AZHPC_PYTHONPATH
exec \$azhpc_pypath \$azhpc_dir/pyazhpc/$cmd_launch \$*
EOF
chmod +x $DIR/bin/$cmd_name
fi
done