代码拉取完成,页面将自动刷新
同步操作将从 Michael/openharmony_oneclick_env_init 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
baseDirForScriptSelf=$(cd "$(dirname "$0")"; pwd)
# 判断git是否使用gnutls编译,如果是,提醒用户重新编译
git_core_dir=`find /usr/lib* -type d -name git-core`
confirm_rebuild_git=NO
rebuild_git=
if [ "X${git_core_dir}" == "X" ];then
# 判断能否找到,如果找不到直接重新安装git,目前没想到什么情况下会不存在这个目录,git未安装?
echo "未找到git-core目录,重新安装git"
confirm_rebuild_git=YES
else
if [ -f "${git_core_dir}/git-http-fetch" ];then
is_gnutls=`ldd ${git_core_dir}/git-http-fetch |grep libcurl-gnutls.so`
if [ "X${is_gnutls}" != "X" ];then
echo ' '
echo '========================================================================='
echo """检测到git使用gnutls编译,如果使用http/https协议下载大仓库代码,大概率出现
error: RPC failed; curl 56 GnuTLS recv error (-110)错误,建议重新安装git
=========================================================================
"""
confirm_rebuild_git=YES
fi
else
echo "未找到git-http-fetch,您的git不支持http/https协议下载git代码,建议重新安装git"
confirm_rebuild_git=YES
fi
fi
if [ "${confirm_rebuild_git}" == "YES" ];then
read -p "请确认是否重新安装git (Y/N):" rebuild_git
fi
# 输入转小写
rebuild_git=`echo ${rebuild_git}|tr '[A-Z]' '[a-z]'`
if [ "${rebuild_git}" == "y" -o "${rebuild_git}" == "yes" ];then
echo "即将重新安装git"
else
exit
fi
# 判断是否特定网络环境
unset http_proxy
unset https_proxy
is_huawei_tmp=`curl -I -m 10 -o /dev/null -s -w %{http_code} w3.huawei.com`
if [ "${is_huawei_tmp}" == "200" ];then
is_huawei=true
else
is_huawei=false
fi
# 如果是HW内网,直接下载deb安装包安装
if [ "${is_huawei}" == "true" ];then
git_deb_url=http://10.62.193.136:8081/isource/git/hw-2.22.0/ubuntu/64bit/git-huawei_2.22.0_amd64.deb
wget -O /tmp/git-huawei_2.22.0_amd64.deb ${git_deb_url}
sudo dpkg -i /tmp/git-huawei_2.22.0_amd64.deb
exit
fi
source ${baseDirForScriptSelf}/source.sh
unset http_proxy
unset https_proxy
# 设置Ubuntu的安装源,预置阿里云源,如需要修改,请编辑apt_get.sh; 如不需要设置,请注释
bash ${baseDirForScriptSelf}/apt_get.sh
if [ $? -gt 0 ];then
exit 1
fi
sudo apt update
# 卸载gnutls,卸载git
sudo apt remove --purge libcurl4-gnutls-dev -y || true
sudo apt remove --purge git -y || true
# 安装相关依赖
sudo apt install dh-autoreconf curl unzip libcurl4-openssl-dev libexpat1-dev make gettext libz-dev libssl-dev libghc-zlib-dev tcl-dev asciidoc build-essential autoconf -y
# 清理apt
sudo apt-get autoremove -y
sudo apt-get autoclean -y
# 设置代理
source ${baseDirForScriptSelf}/proxy.sh
if [ ! -d ${work_dir} ];then
mkdir ${work_dir}
fi
cd ${work_dir}
# 从gitee获取最新版本zip包
git_tarball_url="https://gitee.com$(curl -s -k https://gitee.com/mirrors/git/tags|grep -o 'href="/mirrors/git/repository/archive/.*"'|head -n1 |awk -F '"' '{print $2}' | tr -d '\n')"
echo "DOWNLOADING FROM: ${git_tarball_url}"
curl -s -k -L --retry 5 "${git_tarball_url}" --output "git-source.zip"
sudo unzip -d "${work_dir}" git-source.zip
cd "${work_dir}/git"
# 源码编译安装
sudo make configure
sudo ./configure --prefix=/usr --with-openssl
sudo make
sudo make install
bash -c 'echo "$(which git) ($(git --version))"'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。