71 lines
1.9 KiB
Bash
71 lines
1.9 KiB
Bash
|
||
if ! type "include" > /dev/null 2>&1; then
|
||
include() {
|
||
. "$(cd "$(dirname "$1")" && pwd)/${2}";
|
||
};
|
||
fi
|
||
include "${BASH_SOURCE[0]}" ../pragma_once.bash
|
||
if ! pragma_once ${BASH_SOURCE[0]}; then return 0; fi
|
||
include "${BASH_SOURCE[0]}" ./global_rely/export.bash
|
||
include "${BASH_SOURCE[0]}" ./other.bash
|
||
# shellcheck source=./global_rely/export.bash
|
||
# shellcheck source=./other.bash
|
||
|
||
|
||
echo -e "============================ 开始加载环境 ============================ "
|
||
## 开启调试模式,打印执行的每一行命令
|
||
#set -x
|
||
## 关闭调试模式
|
||
#set +x
|
||
|
||
_ret_=""
|
||
_root_=""
|
||
echo "OSTYPE:$OSTYPE"
|
||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||
_root_="/ae/bash"
|
||
elif [[ "$OSTYPE" == "win32"* ]]; then
|
||
_root_="/d/ae/cached_external_library/bash"
|
||
elif [[ "$OSTYPE" == "cygwin"* ]]; then
|
||
_root_="/d/ae/cached_external_library/bash"
|
||
elif [[ "$OSTYPE" == "msys"* ]]; then
|
||
_root_="/d/ae/cached_external_library/bash"
|
||
else
|
||
echo "未知操作系统类型:$OSTYPE"
|
||
exit 1
|
||
fi
|
||
|
||
#_library_root_dir_="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)/"
|
||
# 脚本在 library_root/base 下面所以往上找一层
|
||
_library_root_dir_="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/"
|
||
_cur_log_path_=""
|
||
_install_="${_root_}/install"
|
||
_src_="${_root_}/src"
|
||
_build_="${_root_}/build"
|
||
_win_="${_root_}/win"
|
||
_iso_repo_="${_root_}/iso_repo"
|
||
_wget_cache_dir_="${_root_}/0_wget_cache_dir"
|
||
_git_cache_dir_="${_root_}/0_git_cache_dir"
|
||
_build_dir_="${_root_}/0_build_dir"
|
||
_network_status_=""
|
||
|
||
|
||
|
||
|
||
echo -e "[init global bash environment!]"
|
||
print_important_var _library_root_dir_
|
||
print_important_var _cur_log_path_
|
||
check_and_create_dir_var _root_
|
||
check_and_create_dir_var _install_
|
||
check_and_create_dir_var _src_
|
||
check_and_create_dir_var _win_
|
||
check_and_create_dir_var _iso_repo_
|
||
check_and_create_dir_var _wget_cache_dir_
|
||
check_and_create_dir_var _git_cache_dir_
|
||
check_and_create_dir_var _build_dir_
|
||
|
||
|
||
|
||
echo -e "============================ 加载环境完成 ============================ "
|
||
|
||
|