点击(此处)折叠或打开
-
#!/bin/bash
-
echo "Enter your email: "
-
read YOUR_EMAIL
-
echo "Enter your name for git"
-
read YOUR_NAME
-
-
sudo apt update
-
-
sudo apt install dosfstools mtools mtd-utils default-jre default-jdk python3.8 python3-setuptools python3-pip git git-lfs zip -y
-
-
sudo rm -f /bin/sh
-
sudo ln -s /bin/bash /bin/sh
-
-
if [ -f /usr/bin/python ]; then
-
sudo rm /usr/bin/python
-
fi
-
sudo ln -s /usr/bin/python3 /usr/bin/python
-
-
sudo pip3 install setuptools kconfiglib pycryptodome ecdsa
-
-
sudo pip3 install six
-
-
# arg1=download URL; arg2=sha256 checksum URL
-
# ret downloaded(0), already exist checksum right(1), download fialed(3)
-
function DownloadAndCheck() {
-
checkSumFile=`basename $2`
-
downloadFile=`basename $1`
-
echo "downloadFile=$downloadFile"
-
echo "checksumFile=$checkSumFile"
-
if [ -f $downloadFile ]; then
-
curl $2 > $checkSumFile
-
#echo " $downloadFile" >> $checkSumFile
-
checkSum=`cat $checkSumFile`" $downloadFile"
-
echo $checkSum
-
echo $checkSum | sha256sum -c --status
-
if [ $? -eq 0 ]; then
-
return 1
-
else
-
rm $downloadFile
-
fi
-
fi
-
-
wget $1
-
sha256sum -c --status $checkSumFile
-
if [ $? -eq 0 ]; then
-
return 0
-
else
-
return 3
-
fi
-
}
-
-
DownloadAndCheck "" ".sha256"
-
mkdir -p ~/gn
-
tar -xvf gn-linux-x86-1717.tar.gz -C ~/gn/
-
-
DownloadAndCheck "" ".sha256"
-
tar -xvf ninja.1.9.0.tar -C ~/
-
-
if [ -f hapsigntoolv2.jar ]; then
-
rm hapsigntoolv2.jar
-
fi
-
wget https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar
-
mkdir -p developtools
-
mv hapsigntoolv2.jar developtools/hapsigntoolv2.jar
-
-
DownloadAndCheck "" ".sha256"
-
tar -xvf llvm.tar.gz -C ~/
-
-
-
DownloadAndCheck "" ".sha256"
-
tar -xvf hc-gen-0.65-linux.tar -C ~/
-
-
echo "export PATH=~/gn:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/ninja:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/llvm/bin:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/hc-gen:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/llvm/bin:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/developtools:\$PATH" >> ~/.bashrc
-
echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc
-
source ~/.bashrc
-
-
if [ -f repo-py3 ]; then
-
rm repo-py3
-
fi
-
wget https://gitee.com/oschina/repo/raw/fork_flow/repo-py3
-
sudo mv repo-py3 /usr/local/bin/repo
-
-
sudo chmod a+x /usr/local/bin/repo
-
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
-
-
git config --global user.name "YOUR_NAME"
-
git config --global user.email "$YOUR_EMAIL"
-
git config --global credential.helper store
-
-
if [ ! -f ~/.ssh/id_rsa.pub ]; then
-
ssh-keygen -t rsa -C "$YOUR_EMAIL"
-
fi
-
-
echo "Set the following PublicKey to gitee and press enter to continue"
-
cat ~/.ssh/id_rsa.pub
-
read READY
-
echo "Checking PublicKey..."
- ssh -T git@gitee.com