代码拉取完成,页面将自动刷新
同步操作将从 mamingshuai/openharmony_oneclick_env_init 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
baseDirForScriptSelf=$(cd "$(dirname "$0")"; pwd)
source ${baseDirForScriptSelf}/source.sh
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
## 内网不需要配置代理
if [ "${is_huawei}" == "true" ];then
unset http_proxy;unset https_proxy
else
source ${baseDirForScriptSelf}/proxy.sh
fi
# 准备python3,20.04默认是3.8.x
os_type=`lsb_release -i|awk '{print $NF}'|tr '[A-Z]' '[a-z]'`
if [ "${os_type}" == 'ubuntu' ];then
sudo bash -c "apt-get install -y python3.8 >>${baseDirForScriptSelf}/init_run.log 2>&1"
else
echo "${os_type} 系统需要源码编译python3.8"
unset http_proxy
unset https_proxy
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl
cd ${work_dir}
source ${baseDirForScriptSelf}/proxy.sh
curl -s -k -L --retry 5 "https://repo.huaweicloud.com/python/3.8.0/Python-3.8.0.tar.xz" --output "Python-3.8.0.tar.xz"
sudo tar Jxvf Python-3.8.0.tar.xz
cd Python-3.8.0
sudo ./configure #--enable-optimizations
sudo make
sudo make install
sudo ln -s /usr/share/pyshared/lsb_release.py /usr/local/lib/python3.8/site-packages/lsb_release.py
fi
python_file=`which python 2>&1|grep -v which`
python38_file=`which python3.8 2>&1|grep -v which`
sudo bash -c "update-alternatives --install ${python_file} python ${python38_file} 1 >>${baseDirForScriptSelf}/init_run.log 2>&1"
sudo bash -c "update-alternatives --install ${python_file}3 python3 ${python38_file} 1 >>${baseDirForScriptSelf}/init_run.log 2>&1"
sudo bash -c "apt-get install -y python3-setuptools python3-pip -y >>${baseDirForScriptSelf}/init_run.log 2>&1"
python3.8 -m pip install --upgrade pip >>${baseDirForScriptSelf}/init_run.log 2>&1
python3.8 -m pip install ecdsa Crypto pycryptodome pycryptodomex >>${baseDirForScriptSelf}/init_run.log 2>&1
# 解决ModuleNotFoundError: No module named 'apt_pkg'
sudo bash -c " apt install -y python3-apt >>${baseDirForScriptSelf}/init_run.log 2>&1"
cd /usr/lib/python3/dist-packages/
sudo ln -s apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so
# 判断python版本是否满足3.7+要求
python_version=`python3.8 --version|awk '{print $2}'|sed 's/\.//g'`
if [ ${python_version//./} -ge 370 ];then
echo -e "${success_color},Python version ${python_version}"
else
echo -e "${failed_color},Python version Check Failed"
exit 1
fi
source /etc/profile
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。