#!/usr/bin/env fish set -g curpath (realpath (dirname (status --current-filename))) set -g curfile (realpath (status --current-filename)) set -g param_mult_ver $argv[1] function get_install_dir if test "$param_mult_ver" = "multi_version" echo (realpath $curpath/../../../../latest)/tools/aoe else echo (realpath $curpath/..) end end function get_opmaster_path set -g ascend_path (realpath $curpath/../../../) if test "$param_mult_ver" = "multi_version" set -g ascend_path (realpath $curpath/../../../../latest/opp) end set -g OS (arch) set -g path_num (find $ASCEND_PATH -name libopmaster_rt2.0.so | grep $OS | wc -l) if test $path_num -gt 1 set -g opmaster_so_path (find $ASCEND_PATH -name libopmaster_rt2.0.so | grep $OS | grep "linux") else set -g opmaster_so_path (find $ASCEND_PATH -name libopmaster_rt2.0.so | grep $OS) end echo (dirname $opmaster_so_path) end set -l INSTALL_DIR (get_install_dir) set -l OPMASTER_PATH (get_opmaster_path) set -x BIN $INSTALL_DIR/bin # traverse PATH list for bin in $PATH if test $bin != $BIN set -x BIN $BIN {$bin} end end # set PATH set -gx PATH $BIN set -e BIN # set LD_LIBRARY_PATH # get lib64 realpath save local variable set -lx REAL $INSTALL_DIR/lib64 set -x LD $REAL":"$OPMASTER_PATH # split by '\n' set -lx WORDS (echo $LD_LIBRARY_PATH | sed 's/:/\n/g') # traverse LD_LIBRARY_PATH for bin in $WORDS if test $bin != $REAL set -x LD $LD":"{$bin} end end # set LD_LIBRARY_PATH set -gx LD_LIBRARY_PATH $LD set -e LD