OHOS 2.0 的环境配置脚本

1020阅读 0评论2022-03-19 iibull
分类:其他平台

网上别人整理的. 

点击(此处)折叠或打开

  1. #!/bin/bash
  2. echo "Enter your email: "
  3. read YOUR_EMAIL
  4. echo "Enter your name for git"
  5. read YOUR_NAME
  6.  
  7. sudo apt update
  8.  
  9. sudo apt install dosfstools mtools mtd-utils default-jre default-jdk python3.8 python3-setuptools python3-pip git git-lfs zip -y
  10.  
  11. sudo rm -f /bin/sh
  12. sudo ln -s /bin/bash /bin/sh
  13.  
  14. if [ -f /usr/bin/python ]; then
  15. sudo rm /usr/bin/python
  16. fi
  17. sudo ln -s /usr/bin/python3 /usr/bin/python
  18.  
  19. sudo pip3 install setuptools kconfiglib pycryptodome ecdsa
  20.  
  21. sudo pip3 install six
  22.  
  23. # arg1=download URL; arg2=sha256 checksum URL
  24. # ret downloaded(0), already exist checksum right(1), download fialed(3)
  25. function DownloadAndCheck() {
  26. checkSumFile=`basename $2`
  27. downloadFile=`basename $1`
  28. echo "downloadFile=$downloadFile"
  29. echo "checksumFile=$checkSumFile"
  30. if [ -f $downloadFile ]; then
  31. curl $2 > $checkSumFile
  32. #echo " $downloadFile" >> $checkSumFile
  33. checkSum=`cat $checkSumFile`" $downloadFile"
  34. echo $checkSum
  35. echo $checkSum | sha256sum -c --status
  36. if [ $? -eq 0 ]; then
  37. return 1
  38. else
  39. rm $downloadFile
  40. fi
  41. fi
  42.  
  43. wget $1
  44. sha256sum -c --status $checkSumFile
  45. if [ $? -eq 0 ]; then
  46. return 0
  47. else
  48. return 3
  49. fi
  50. }
  51.  
  52. DownloadAndCheck "" ".sha256"
  53. mkdir -p ~/gn
  54. tar -xvf gn-linux-x86-1717.tar.gz -C ~/gn/
  55.  
  56. DownloadAndCheck "" ".sha256"
  57. tar -xvf ninja.1.9.0.tar -C ~/
  58.  
  59. if [ -f hapsigntoolv2.jar ]; then
  60. rm hapsigntoolv2.jar
  61. fi
  62. wget https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar
  63. mkdir -p developtools
  64. mv hapsigntoolv2.jar developtools/hapsigntoolv2.jar
  65.  
  66. DownloadAndCheck "" ".sha256"
  67. tar -xvf llvm.tar.gz -C ~/
  68.  
  69.  
  70. DownloadAndCheck "" ".sha256"
  71. tar -xvf hc-gen-0.65-linux.tar -C ~/
  72.  
  73. echo "export PATH=~/gn:\$PATH" >> ~/.bashrc
  74. echo "export PATH=~/ninja:\$PATH" >> ~/.bashrc
  75. echo "export PATH=~/llvm/bin:\$PATH" >> ~/.bashrc
  76. echo "export PATH=~/hc-gen:\$PATH" >> ~/.bashrc
  77. echo "export PATH=~/llvm/bin:\$PATH" >> ~/.bashrc
  78. echo "export PATH=~/developtools:\$PATH" >> ~/.bashrc
  79. echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc
  80. source ~/.bashrc
  81.  
  82. if [ -f repo-py3 ]; then
  83. rm repo-py3
  84. fi
  85. wget https://gitee.com/oschina/repo/raw/fork_flow/repo-py3
  86. sudo mv repo-py3 /usr/local/bin/repo
  87.  
  88. sudo chmod a+x /usr/local/bin/repo
  89. sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
  90.  
  91. git config --global user.name "YOUR_NAME"
  92. git config --global user.email "$YOUR_EMAIL"
  93. git config --global credential.helper store
  94.  
  95. if [ ! -f ~/.ssh/id_rsa.pub ]; then
  96. ssh-keygen -t rsa -C "$YOUR_EMAIL"
  97. fi
  98.  
  99. echo "Set the following PublicKey to gitee and press enter to continue"
  100. cat ~/.ssh/id_rsa.pub
  101. read READY
  102. echo "Checking PublicKey..."
  103. ssh -T git@gitee.com

上一篇:rapidOCR 环境
下一篇:公钥认证的流程