代码拉取完成,页面将自动刷新
#!/bin/bash
set -e
source "$(
cd "$(dirname "$0")" || exit 1
pwd
)/../common.sh"
# 安装编译前必要应用
function install_development() {
sudo yum install -y wget tar libatomic environment-modules zlib-devel bzip2 bzip2-devel ncurses-libs ncurses-devel xz-devel
source /etc/profile
}
# 下载samtools
function download_samtools() {
echo "# samtools正在下载"
wget -t 40 -c -P "$1" https://udomain.dl.sourceforge.net/project/samtools/samtools/0.1.19/samtools-0.1.19.tar.bz2
if [[ $? -eq 0 ]]; then
echo -e "\033[1;32;1m# samtools已经下载成功\033[0m"
else
echo -e "\033[31m# samtools下载失败,请重新执行脚本\033[0m"
exit 1
fi
}
# 安装samtools
function install_samtools() {
echo "# samtools正在安装"
tar xf "$1"/samtools-0.1.19.tar.bz2 -C "$1" && rm -rf "$1"/samtools-0.1.19.tar.bz2
cd "$1"/samtools-0.1.19
sed -i -e 's/gcc/clang/g' Makefile
make
mkdir -p "$2"/samtools-0.1.19 && cp -r "$1"/samtools-0.1.19/* "$2"/samtools-0.1.19/
echo -e "\033[1;32;1m# samtools已经安装完毕\033[0m"
}
# 创建samtools的modulefiles
function write_samtools_module() {
cat>"$1/samtools-0.1.19/samtools_modulefiles"<<EOF
#%Module1.0
conflict samtools
variable modfile [file normalize [info script]]
proc getModulefileDir {} {
variable modfile
set modfile_path [file dirname \$modfile]
return \$modfile_path
}
set pwd [getModulefileDir]
set SAMTOOLS \$pwd
setenv SAMTOOLS \$SAMTOOLS
prepend-path PATH \$SAMTOOLS/bin
EOF
}
function main() {
print_current_running_script_info "samtools-0.1.19.sh"
# 校验安装路径与构建路径是否一致
is_equal_build_install_path "$1" "$2"
# 安装编译前应用
install_development
# 下载
download_samtools "$1"
# 安装
install_samtools "$1" "$2"
# 写入modulefiles
write_samtools_module "$2"
# 删除构建路径
rm -rf "$1"/samtools-0.1.19
}
main "$@"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。