2019-07-20 17:15:29 +03:00
|
|
|
#!/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
|
2020-03-19 18:38:41 +03:00
|
|
|
export azhpc_pypath=$(az --version | grep "Python location" | cut -d' ' -f3 | sed "s/'//g")
|
2020-03-19 20:15:37 +03:00
|
|
|
if [ -e /etc/centos-release ]; then
|
|
|
|
export AZHPC_PYTHONPATH=/usr/lib64/az/lib/python3.6/site-packages
|
|
|
|
fi
|
2020-04-27 10:55:37 +03:00
|
|
|
|
|
|
|
for cmd in "" build connect destroy get init preprocess run scp status; do
|
|
|
|
if [ "$cmd" = "" ]; then
|
|
|
|
cmd_name=azhpc
|
2020-04-27 19:45:32 +03:00
|
|
|
cmd_launch=azhpc.py
|
2020-04-27 10:55:37 +03:00
|
|
|
else
|
|
|
|
cmd_name=azhpc-$cmd
|
|
|
|
cmd_launch="azhpc.py $cmd"
|
|
|
|
fi
|
2020-04-27 19:45:32 +03:00
|
|
|
|
2020-04-27 10:55:37 +03:00
|
|
|
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
|
2020-04-27 19:45:32 +03:00
|
|
|
done
|